Skip to content

Commit bde74d9

Browse files
committed
auto merge of #18092 : michaelwoerister/rust/lldb-test-versioning, r=alexcrichton
Now that there are build bots with a stable enough LLDB version on OSX we can finally let the tests run on every PR! :joy_cat:
2 parents 9f0c29a + 423dca7 commit bde74d9

File tree

86 files changed

+135
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+135
-36
lines changed

mk/tests.mk

+4-3
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,14 @@ ifeq ($(CFG_LLDB),)
584584
CTEST_DISABLE_debuginfo-lldb = "no lldb found"
585585
endif
586586

587-
# Completely disable LLDB tests for now
588-
CTEST_DISABLE_debuginfo-lldb = "LLDB tests are not enabled yet"
589-
590587
ifeq ($(CFG_CLANG),)
591588
CTEST_DISABLE_codegen = "no clang found"
592589
endif
593590

591+
ifneq ($(CFG_OSTYPE),apple-darwin)
592+
CTEST_DISABLE_debuginfo-lldb = "lldb tests are only run on darwin"
593+
endif
594+
594595
ifeq ($(CFG_OSTYPE),apple-darwin)
595596
CTEST_DISABLE_debuginfo-gdb = "gdb on darwing needs root"
596597
endif

src/compiletest/compiletest.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::io::fs;
2525
use std::from_str::FromStr;
2626
use getopts::{optopt, optflag, reqopt};
2727
use common::Config;
28-
use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Codegen};
28+
use common::{Pretty, DebugInfoGdb, Codegen};
2929
use util::logv;
3030
use regex::Regex;
3131

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

238-
match config.mode {
239-
DebugInfoLldb => {
240-
// Some older versions of LLDB seem to have problems with multiple
241-
// instances running in parallel, so only run one test task at a
242-
// time.
243-
os::setenv("RUST_TEST_TASKS", "1");
244-
}
245-
_ => { /* proceed */ }
246-
}
247-
248238
let opts = test_opts(config);
249239
let tests = make_tests(config);
250240
// sadly osx needs some file descriptor limits raised for running tests in

src/compiletest/runtest.rs

+21-4
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,15 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
653653
script_str.push_str("version\n");
654654

655655
// Switch LLDB into "Rust mode"
656-
script_str.push_str("command script import ./src/etc/lldb_rust_formatters.py\n");
656+
let rust_src_root = find_rust_src_root(config)
657+
.expect("Could not find Rust source root");
658+
let rust_pp_module_rel_path = Path::new("./src/etc/lldb_rust_formatters.py");
659+
let rust_pp_module_abs_path = rust_src_root.join(rust_pp_module_rel_path)
660+
.as_str()
661+
.unwrap()
662+
.to_string();
663+
664+
script_str.push_str(format!("command script import {}\n", rust_pp_module_abs_path[])[]);
657665
script_str.push_str("type summary add --no-value ");
658666
script_str.push_str("--python-function lldb_rust_formatters.print_val ");
659667
script_str.push_str("-x \".*\" --category Rust\n");
@@ -683,18 +691,27 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
683691
let debugger_script = make_out_name(config, testfile, "debugger.script");
684692

685693
// Let LLDB execute the script via lldb_batchmode.py
686-
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);
694+
let debugger_run_result = run_lldb(config,
695+
&exe_file,
696+
&debugger_script,
697+
&rust_src_root);
687698

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

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

694-
fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes {
705+
fn run_lldb(config: &Config,
706+
test_executable: &Path,
707+
debugger_script: &Path,
708+
rust_src_root: &Path)
709+
-> ProcRes {
695710
// Prepare the lldb_batchmode which executes the debugger script
711+
let lldb_script_path = rust_src_root.join(Path::new("./src/etc/lldb_batchmode.py"));
712+
696713
let mut cmd = Command::new("python");
697-
cmd.arg("./src/etc/lldb_batchmode.py")
714+
cmd.arg(lldb_script_path)
698715
.arg(test_executable)
699716
.arg(debugger_script)
700717
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);

src/etc/lldb_batchmode.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ def listen():
141141
target_path = sys.argv[1]
142142
script_path = sys.argv[2]
143143

144+
print("LLDB batch-mode script")
145+
print("----------------------")
146+
print("Debugger commands script is '%s'." % script_path)
147+
print("Target executable is '%s'." % target_path)
148+
print("Current working directory is '%s'" % os.getcwd())
144149

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

152157
# Create a target from a file and arch
153158
print("Creating a target for '%s'" % target_path)
154-
target = debugger.CreateTargetWithFileAndArch(target_path, lldb.LLDB_ARCH_DEFAULT)
159+
target_error = lldb.SBError()
160+
target = debugger.CreateTarget(target_path, None, None, True, target_error)
155161

156162
if not target:
157-
print("Could not create debugging target '" + target_path + "'. Aborting.", file=sys.stderr)
163+
print("Could not create debugging target '" + target_path + "': " + str(target_error) +
164+
". Aborting.", file=sys.stderr)
158165
sys.exit(1)
159166

160167

src/test/debuginfo/basic-types-globals-metadata.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-windows: FIXME #13256
1212
// ignore-android: FIXME(#10381)
13+
// min-lldb-version: 310
1314

1415
// compile-flags:-g
1516
// gdb-command:rbreak zzz

src/test/debuginfo/basic-types-globals.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// ignore-windows: FIXME #13256
1818
// ignore-android: FIXME(#10381)
19+
// min-lldb-version: 310
1920

2021
// compile-flags:-g
2122
// gdb-command:rbreak zzz

src/test/debuginfo/basic-types-metadata.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415
// gdb-command:rbreak zzz

src/test/debuginfo/basic-types-mut-globals.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
// ignore-windows: FIXME #13256
1818
// ignore-android: FIXME(#10381)
19+
// min-lldb-version: 310
1920

2021
// compile-flags:-g
2122
// gdb-command:rbreak zzz

src/test/debuginfo/basic-types.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// its numerical value.
1616

1717
// ignore-android: FIXME(#10381)
18+
// min-lldb-version: 310
1819

1920
// compile-flags:-g
2021

src/test/debuginfo/borrowed-basic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// its numerical value.
1515

1616
// compile-flags:-g
17+
// min-lldb-version: 310
1718

1819
// === GDB TESTS ===================================================================================
1920

src/test/debuginfo/borrowed-c-style-enum.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// ignore-android: FIXME(#10381)
1212

1313
// compile-flags:-g
14+
// min-lldb-version: 310
1415

1516
// === GDB TESTS ===================================================================================
1617

src/test/debuginfo/borrowed-enum.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-tidy-linelength
1212
// ignore-android: FIXME(#10381)
13+
// min-lldb-version: 310
1314

1415
// compile-flags:-g
1516

src/test/debuginfo/borrowed-struct.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-android: FIXME(#10381)
1212
// compile-flags:-g
13+
// min-lldb-version: 310
1314

1415
// === GDB TESTS ===================================================================================
1516

src/test/debuginfo/borrowed-tuple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12-
12+
// min-lldb-version: 310
1313

1414
// compile-flags:-g
1515

src/test/debuginfo/borrowed-unique-basic.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
1415
// its numerical value.

src/test/debuginfo/box.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/boxed-struct.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/by-value-non-immediate-argument.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-tidy-linelength
1212
// ignore-android: FIXME(#10381)
13+
// min-lldb-version: 310
1314

1415
// compile-flags:-g
1516

src/test/debuginfo/by-value-self-argument-in-trait-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12-
12+
// min-lldb-version: 310
1313

1414
// compile-flags:-g
1515

src/test/debuginfo/c-style-enum-in-composite.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-tidy-linelength
1212
// ignore-android: FIXME(#10381)
13+
// min-lldb-version: 310
1314

1415
// compile-flags:-g
1516

src/test/debuginfo/c-style-enum.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// ignore-windows: FIXME #13256
1212
// ignore-android: FIXME(#10381)
13+
// min-lldb-version: 310
1314

1415
// compile-flags:-g
1516

src/test/debuginfo/closure-in-generic-function.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/cross-crate-type-uniquing.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// aux-build:cross_crate_debuginfo_type_uniquing.rs
1415
extern crate cross_crate_debuginfo_type_uniquing;

src/test/debuginfo/destructured-fn-argument.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/destructured-local.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/evec-in-struct.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/function-arg-initialization.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

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

1920
// compile-flags:-g
2021
// gdb-command:set print pretty off
21-
// gdb-command:break function-arg-initialization.rs:243
22-
// gdb-command:break function-arg-initialization.rs:258
23-
// gdb-command:break function-arg-initialization.rs:262
24-
// gdb-command:break function-arg-initialization.rs:266
25-
// gdb-command:break function-arg-initialization.rs:270
26-
// gdb-command:break function-arg-initialization.rs:274
27-
// gdb-command:break function-arg-initialization.rs:278
28-
// gdb-command:break function-arg-initialization.rs:282
29-
// gdb-command:break function-arg-initialization.rs:286
30-
// gdb-command:break function-arg-initialization.rs:294
31-
// gdb-command:break function-arg-initialization.rs:301
22+
// gdb-command:break function-arg-initialization.rs:244
23+
// gdb-command:break function-arg-initialization.rs:259
24+
// gdb-command:break function-arg-initialization.rs:263
25+
// gdb-command:break function-arg-initialization.rs:267
26+
// gdb-command:break function-arg-initialization.rs:271
27+
// gdb-command:break function-arg-initialization.rs:275
28+
// gdb-command:break function-arg-initialization.rs:279
29+
// gdb-command:break function-arg-initialization.rs:283
30+
// gdb-command:break function-arg-initialization.rs:287
31+
// gdb-command:break function-arg-initialization.rs:295
32+
// gdb-command:break function-arg-initialization.rs:302
3233

3334
// === GDB TESTS ===================================================================================
3435

src/test/debuginfo/function-arguments.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/function-prologue-stepping-no-stack-check.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// This test case checks if function arguments already have the correct value when breaking at the
1415
// beginning of a function. Functions with the #[no_stack_check] attribute have the same prologue as

src/test/debuginfo/function-prologue-stepping-regular.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// This test case checks if function arguments already have the correct value when breaking at the
1212
// beginning of a function.
1313

14+
// min-lldb-version: 310
1415
// ignore-gdb
1516
// compile-flags:-g
1617

src/test/debuginfo/generic-function.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/generic-functions-nested.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
1415

src/test/debuginfo/generic-method-on-generic-struct.rs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// ignore-android: FIXME(#10381)
1212

1313
// compile-flags:-g
14+
// min-lldb-version: 310
1415

1516
// === GDB TESTS ===================================================================================
1617

src/test/debuginfo/generic-static-method-on-struct-and-enum.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
// except according to those terms.
1010

1111
// ignore-android: FIXME(#10381)
12+
// min-lldb-version: 310
1213

1314
// compile-flags:-g
15+
1416
// gdb-command:rbreak zzz
1517
// gdb-command:run
1618

0 commit comments

Comments
 (0)