Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debuginfo: Activate LLDB tests on Darwin. #18092

Merged
merged 5 commits into from
Oct 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,14 @@ ifeq ($(CFG_LLDB),)
CTEST_DISABLE_debuginfo-lldb = "no lldb found"
endif

# Completely disable LLDB tests for now
CTEST_DISABLE_debuginfo-lldb = "LLDB tests are not enabled yet"

ifeq ($(CFG_CLANG),)
CTEST_DISABLE_codegen = "no clang found"
endif

ifneq ($(CFG_OSTYPE),apple-darwin)
CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
endif

ifeq ($(CFG_OSTYPE),apple-darwin)
CTEST_DISABLE_debuginfo-gdb = "gdb on darwing needs root"
endif
Expand Down
12 changes: 1 addition & 11 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use std::io::fs;
use std::from_str::FromStr;
use getopts::{optopt, optflag, reqopt};
use common::Config;
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
use common::{Pretty, DebugInfoGdb, Codegen};
use util::logv;
use regex::Regex;

Expand Down Expand Up @@ -235,16 +235,6 @@ pub fn run_tests(config: &Config) {
os::setenv("RUST_TEST_TASKS","1");
}

match config.mode {
DebugInfoLldb => {
// Some older versions of LLDB seem to have problems with multiple
// instances running in parallel, so only run one test task at a
// time.
os::setenv("RUST_TEST_TASKS", "1");
}
_ => { /* proceed */ }
}

let opts = test_opts(config);
let tests = make_tests(config);
// sadly osx needs some file descriptor limits raised for running tests in
Expand Down
25 changes: 21 additions & 4 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,15 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
script_str.push_str("version\n");

// Switch LLDB into "Rust mode"
script_str.push_str("command script import ./src/etc/lldb_rust_formatters.py\n");
let rust_src_root = find_rust_src_root(config)
.expect("Could not find Rust source root");
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py");
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
.as_str()
.unwrap()
.to_string();

script_str.push_str(format!("command script import {}\n", rust_pp_module_abs_path[])[]);
script_str.push_str("type summary add --no-value ");
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
script_str.push_str("-x \".*\" --category Rust\n");
Expand Down Expand Up @@ -683,18 +691,27 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
let debugger_script = make_out_name(config, testfile, "debugger.script");

// Let LLDB execute the script via lldb_batchmode.py
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
let debugger_run_result = run_lldb(config,
&exe_file,
&debugger_script,
&rust_src_root);

if !debugger_run_result.status.success() {
fatal_proc_rec("Error while running LLDB", &debugger_run_result);
}

check_debugger_output(&debugger_run_result, check_lines.as_slice());

fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
fn run_lldb(config: &Config,
test_executable: &Path,
debugger_script: &Path,
rust_src_root: &Path)
-> ProcRes {
// Prepare the lldb_batchmode which executes the debugger script
let lldb_script_path = rust_src_root.join(Path::new("./src/etc/lldb_batchmode.py"));

let mut cmd = Command::new("python");
cmd.arg("./src/etc/lldb_batchmode.py")
cmd.arg(lldb_script_path)
.arg(test_executable)
.arg(debugger_script)
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
Expand Down
11 changes: 9 additions & 2 deletions src/etc/lldb_batchmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ def listen():
target_path = sys.argv[1]
script_path = sys.argv[2]

print("LLDB batch-mode script")
print("----------------------")
print("Debugger commands script is '%s'." % script_path)
print("Target executable is '%s'." % target_path)
print("Current working directory is '%s'" % os.getcwd())

# Create a new debugger instance
debugger = lldb.SBDebugger.Create()
Expand All @@ -151,10 +156,12 @@ def listen():

# Create a target from a file and arch
print("Creating a target for '%s'" % target_path)
target = debugger.CreateTargetWithFileAndArch(target_path, lldb.LLDB_ARCH_DEFAULT)
target_error = lldb.SBError()
target = debugger.CreateTarget(target_path, None, None, True, target_error)

if not target:
print("Could not create debugging target '" + target_path + "'. Aborting.", file=sys.stderr)
print("Could not create debugging target '" + target_path + "': " + str(target_error) +
". Aborting.", file=sys.stderr)
sys.exit(1)


Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-globals-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types-mut-globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g
// gdb-command:rbreak zzz
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/basic-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// its numerical value.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// its numerical value.

// compile-flags:-g
// min-lldb-version: 310

// === GDB TESTS ===================================================================================

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// ignore-android: FIXME(#10381)

// compile-flags:-g
// min-lldb-version: 310

// === GDB TESTS ===================================================================================

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-android: FIXME(#10381)
// compile-flags:-g
// min-lldb-version: 310

// === GDB TESTS ===================================================================================

Expand Down
2 changes: 1 addition & 1 deletion src/test/debuginfo/borrowed-tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)

// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-unique-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
// its numerical value.
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/boxed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/by-value-non-immediate-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
2 changes: 1 addition & 1 deletion src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)

// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/c-style-enum-in-composite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-windows: FIXME #13256
// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/closure-in-generic-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/cross-crate-type-uniquing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// aux-build:cross_crate_debuginfo_type_uniquing.rs
extern crate cross_crate_debuginfo_type_uniquing;
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/destructured-fn-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/destructured-local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/evec-in-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
23 changes: 12 additions & 11 deletions src/test/debuginfo/function-arg-initialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// This test case checks if function arguments already have the correct value when breaking at the
// first line of the function, that is if the function prologue has already been executed at the
Expand All @@ -18,17 +19,17 @@

// compile-flags:-g
// gdb-command:set print pretty off
// gdb-command:break function-arg-initialization.rs:243
// gdb-command:break function-arg-initialization.rs:258
// gdb-command:break function-arg-initialization.rs:262
// gdb-command:break function-arg-initialization.rs:266
// gdb-command:break function-arg-initialization.rs:270
// gdb-command:break function-arg-initialization.rs:274
// gdb-command:break function-arg-initialization.rs:278
// gdb-command:break function-arg-initialization.rs:282
// gdb-command:break function-arg-initialization.rs:286
// gdb-command:break function-arg-initialization.rs:294
// gdb-command:break function-arg-initialization.rs:301
// gdb-command:break function-arg-initialization.rs:244
// gdb-command:break function-arg-initialization.rs:259
// gdb-command:break function-arg-initialization.rs:263
// gdb-command:break function-arg-initialization.rs:267
// gdb-command:break function-arg-initialization.rs:271
// gdb-command:break function-arg-initialization.rs:275
// gdb-command:break function-arg-initialization.rs:279
// gdb-command:break function-arg-initialization.rs:283
// gdb-command:break function-arg-initialization.rs:287
// gdb-command:break function-arg-initialization.rs:295
// gdb-command:break function-arg-initialization.rs:302

// === GDB TESTS ===================================================================================

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/function-arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// This test case checks if function arguments already have the correct value when breaking at the
// beginning of a function. Functions with the #[no_stack_check] attribute have the same prologue as
Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/function-prologue-stepping-regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// This test case checks if function arguments already have the correct value when breaking at the
// beginning of a function.

// min-lldb-version: 310
// ignore-gdb
// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-functions-nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-method-on-generic-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// ignore-android: FIXME(#10381)

// compile-flags:-g
// min-lldb-version: 310

// === GDB TESTS ===================================================================================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
// except according to those terms.

// ignore-android: FIXME(#10381)
// min-lldb-version: 310

// compile-flags:-g

// gdb-command:rbreak zzz
// gdb-command:run

Expand Down
Loading