Skip to content

Commit 55a8bd5

Browse files
debuginfo: Split debuginfo autotests into debuginfo-gdb and debuginfo-lldb
1 parent 445988b commit 55a8bd5

File tree

108 files changed

+3749
-3384
lines changed

Some content is hidden

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

108 files changed

+3749
-3384
lines changed

configure

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,26 @@ probe CFG_PDFLATEX pdflatex
466466
probe CFG_XELATEX xelatex
467467
probe CFG_LUALATEX lualatex
468468
probe CFG_GDB gdb
469+
probe CFG_LLDB lldb
470+
471+
if [ ! -z "$CFG_LLDB" ]
472+
then
473+
# If CFG_LLDB_PYTHON_DIR is not already set from the outside and valid, try to read it from
474+
# LLDB via the -P commandline options.
475+
if [ -z "$CFG_LLDB_PYTHON_DIR" ] || [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
476+
then
477+
CFG_LLDB_PYTHON_DIR=$($CFG_LLDB -P)
478+
479+
# If CFG_LLDB_PYTHON_DIR is not a valid directory, set it to something more readable
480+
if [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
481+
then
482+
CFG_LLDB_PYTHON_DIR="LLDB_PYTHON_DIRECTORY_NOT_FOUND"
483+
fi
484+
485+
putvar CFG_LLDB_PYTHON_DIR
486+
fi
487+
fi
488+
469489
if [ "$CFG_OSTYPE" = "unknown-linux-gnu" ]
470490
then
471491
probe CFG_PAXCTL paxctl /sbin/paxctl
@@ -807,7 +827,8 @@ do
807827
make_dir $h/test/bench
808828
make_dir $h/test/perf
809829
make_dir $h/test/pretty
810-
make_dir $h/test/debug-info
830+
make_dir $h/test/debuginfo-gdb
831+
make_dir $h/test/debuginfo-lldb
811832
make_dir $h/test/codegen
812833
make_dir $h/test/doc-tutorial
813834
make_dir $h/test/doc-guide-ffi

mk/tests.mk

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
293293
check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
294294
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
295295
check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
296-
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
296+
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
297+
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
297298
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
298299
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
299300
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
@@ -460,7 +461,8 @@ CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
460461
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
461462
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
462463
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
463-
DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
464+
DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
465+
DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
464466
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
465467
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
466468

@@ -476,7 +478,8 @@ CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
476478
BENCH_TESTS := $(BENCH_RS)
477479
PERF_TESTS := $(PERF_RS)
478480
PRETTY_TESTS := $(PRETTY_RS)
479-
DEBUGINFO_TESTS := $(DEBUGINFO_RS)
481+
DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
482+
DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
480483
CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
481484

482485
CTEST_SRC_BASE_rpass = run-pass
@@ -514,10 +517,15 @@ CTEST_BUILD_BASE_perf = perf
514517
CTEST_MODE_perf = run-pass
515518
CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)
516519

517-
CTEST_SRC_BASE_debuginfo = debug-info
518-
CTEST_BUILD_BASE_debuginfo = debug-info
519-
CTEST_MODE_debuginfo = debug-info
520-
CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
520+
CTEST_SRC_BASE_debuginfo-gdb = debuginfo
521+
CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
522+
CTEST_MODE_debuginfo-gdb = debuginfo-gdb
523+
CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)
524+
525+
CTEST_SRC_BASE_debuginfo-lldb = debuginfo
526+
CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
527+
CTEST_MODE_debuginfo-lldb = debuginfo-lldb
528+
CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)
521529

522530
CTEST_SRC_BASE_codegen = codegen
523531
CTEST_BUILD_BASE_codegen = codegen
@@ -529,15 +537,22 @@ CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
529537
# during attempts to run those tests.
530538

531539
ifeq ($(CFG_GDB),)
532-
CTEST_DISABLE_debuginfo = "no gdb found"
540+
CTEST_DISABLE_debuginfo-gdb = "no gdb found"
541+
endif
542+
543+
ifeq ($(CFG_LLDB),)
544+
CTEST_DISABLE_debuginfo-lldb = "no lldb found"
533545
endif
534546

547+
# Completely disable LLDB tests for now
548+
CTEST_DISABLE_debuginfo-lldb = "LLDB tests are not enabled yet"
549+
535550
ifeq ($(CFG_CLANG),)
536551
CTEST_DISABLE_codegen = "no clang found"
537552
endif
538553

539554
ifeq ($(CFG_OSTYPE),apple-darwin)
540-
CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
555+
CTEST_DISABLE_debuginfo-gdb = "gdb on darwing needs root"
541556
endif
542557

543558
# CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
@@ -587,6 +602,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
587602
--adb-path=$(CFG_ADB) \
588603
--adb-test-dir=$(CFG_ADB_TEST_DIR) \
589604
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
605+
--lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
590606
--target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
591607
$$(CTEST_TESTARGS)
592608

@@ -597,7 +613,8 @@ CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
597613
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
598614
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
599615
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
600-
CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
616+
CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
617+
CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS)
601618
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
602619

603620
endef
@@ -661,7 +678,7 @@ endif
661678

662679
endef
663680

664-
CTEST_NAMES = rpass rpass-full cfail-full rfail cfail bench perf debuginfo codegen
681+
CTEST_NAMES = rpass rpass-full cfail-full rfail cfail bench perf debuginfo-gdb debuginfo-lldb codegen
665682

666683
$(foreach host,$(CFG_HOST), \
667684
$(eval $(foreach target,$(CFG_TARGET), \
@@ -810,7 +827,8 @@ TEST_GROUPS = \
810827
bench \
811828
perf \
812829
rmake \
813-
debuginfo \
830+
debuginfo-gdb \
831+
debuginfo-lldb \
814832
codegen \
815833
doc \
816834
$(foreach docname,$(DOCS),doc-$(docname)) \

src/compiletest/common.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ pub enum mode {
1414
mode_run_fail,
1515
mode_run_pass,
1616
mode_pretty,
17-
mode_debug_info,
17+
mode_debug_info_gdb,
18+
mode_debug_info_lldb,
1819
mode_codegen
1920
}
2021

@@ -101,6 +102,9 @@ pub struct config {
101102
// status whether android device available or not
102103
pub adb_device_status: bool,
103104

105+
// the path containing LLDB's Python module
106+
pub lldb_python_dir: Option<~str>,
107+
104108
// Explain what's going on
105109
pub verbose: bool
106110

src/compiletest/compiletest.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@ use std::os;
2828
use std::io;
2929
use std::io::fs;
3030
use getopts::{optopt, optflag, reqopt};
31-
use common::config;
32-
use common::mode_run_pass;
33-
use common::mode_run_fail;
34-
use common::mode_compile_fail;
35-
use common::mode_pretty;
36-
use common::mode_debug_info;
37-
use common::mode_codegen;
38-
use common::mode;
31+
use common::{config, mode_run_pass, mode_run_fail, mode_compile_fail, mode_pretty,
32+
mode_debug_info_gdb, mode_debug_info_lldb, mode_codegen, mode};
3933
use util::logv;
4034

4135
pub mod procsrv;
@@ -87,6 +81,7 @@ pub fn parse_config(args: Vec<~str> ) -> config {
8781
optopt("", "host", "the host to build for", "HOST"),
8882
optopt("", "adb-path", "path to the android debugger", "PATH"),
8983
optopt("", "adb-test-dir", "path to tests for the android debugger", "PATH"),
84+
optopt("", "lldb-python-dir", "directory containing LLDB's python module", "PATH"),
9085
optopt("", "test-shard", "run shard A, of B shards, worth of the testsuite", "A.B"),
9186
optflag("h", "help", "show this message"));
9287

@@ -154,6 +149,7 @@ pub fn parse_config(args: Vec<~str> ) -> config {
154149
"arm-linux-androideabi" == opt_str2(matches.opt_str("target")) &&
155150
"(none)" != opt_str2(matches.opt_str("adb-test-dir")) &&
156151
!opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
152+
lldb_python_dir: matches.opt_str("lldb-python-dir"),
157153
test_shard: test::opt_shard(matches.opt_str("test-shard")),
158154
verbose: matches.opt_present("verbose")
159155
}
@@ -204,13 +200,14 @@ pub fn opt_str2(maybestr: Option<~str>) -> ~str {
204200

205201
pub fn str_mode(s: ~str) -> mode {
206202
match s.as_slice() {
207-
"compile-fail" => mode_compile_fail,
208-
"run-fail" => mode_run_fail,
209-
"run-pass" => mode_run_pass,
210-
"pretty" => mode_pretty,
211-
"debug-info" => mode_debug_info,
212-
"codegen" => mode_codegen,
213-
_ => fail!("invalid mode")
203+
"compile-fail" => mode_compile_fail,
204+
"run-fail" => mode_run_fail,
205+
"run-pass" => mode_run_pass,
206+
"pretty" => mode_pretty,
207+
"debuginfo-gdb" => mode_debug_info_gdb,
208+
"debuginfo-lldb" => mode_debug_info_lldb,
209+
"codegen" => mode_codegen,
210+
s => fail!("invalid mode: " + s)
214211
}
215212
}
216213

@@ -220,15 +217,16 @@ pub fn mode_str(mode: mode) -> ~str {
220217
mode_run_fail => "run-fail".to_owned(),
221218
mode_run_pass => "run-pass".to_owned(),
222219
mode_pretty => "pretty".to_owned(),
223-
mode_debug_info => "debug-info".to_owned(),
220+
mode_debug_info_gdb => "debuginfo-gdb".to_owned(),
221+
mode_debug_info_lldb => "debuginfo-lldb".to_owned(),
224222
mode_codegen => "codegen".to_owned(),
225223
}
226224
}
227225

228226
pub fn run_tests(config: &config) {
229227
if config.target == "arm-linux-androideabi".to_owned() {
230228
match config.mode{
231-
mode_debug_info => {
229+
mode_debug_info_gdb => {
232230
println!("arm-linux-androideabi debug-info \
233231
test uses tcp 5039 port. please reserve it");
234232
}

src/compiletest/header.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ pub struct TestProps {
2626
pub aux_builds: Vec<~str> ,
2727
// Environment settings to use during execution
2828
pub exec_env: Vec<(~str,~str)> ,
29-
// Commands to be given to the debugger, when testing debug info
30-
pub debugger_cmds: Vec<~str> ,
3129
// Lines to check if they appear in the expected debugger output
3230
pub check_lines: Vec<~str> ,
3331
// Flag to force a crate to be built with the host architecture
@@ -46,7 +44,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
4644
let mut compile_flags = None;
4745
let mut run_flags = None;
4846
let mut pp_exact = None;
49-
let mut debugger_cmds = Vec::new();
5047
let mut check_lines = Vec::new();
5148
let mut force_host = false;
5249
let mut check_stdout = false;
@@ -91,11 +88,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
9188
None => {}
9289
}
9390

94-
match parse_debugger_cmd(ln) {
95-
Some(dc) => debugger_cmds.push(dc),
96-
None => ()
97-
};
98-
9991
match parse_check_line(ln) {
10092
Some(cl) => check_lines.push(cl),
10193
None => ()
@@ -111,7 +103,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
111103
pp_exact: pp_exact,
112104
aux_builds: aux_builds,
113105
exec_env: exec_env,
114-
debugger_cmds: debugger_cmds,
115106
check_lines: check_lines,
116107
force_host: force_host,
117108
check_stdout: check_stdout,
@@ -173,10 +164,6 @@ fn parse_run_flags(line: &str) -> Option<~str> {
173164
parse_name_value_directive(line, "run-flags".to_owned())
174165
}
175166

176-
fn parse_debugger_cmd(line: &str) -> Option<~str> {
177-
parse_name_value_directive(line, "debugger".to_owned())
178-
}
179-
180167
fn parse_check_line(line: &str) -> Option<~str> {
181168
parse_name_value_directive(line, "check".to_owned())
182169
}
@@ -226,7 +213,7 @@ fn parse_name_directive(line: &str, directive: &str) -> bool {
226213
line.contains(directive)
227214
}
228215

229-
fn parse_name_value_directive(line: &str,
216+
pub fn parse_name_value_directive(line: &str,
230217
directive: ~str) -> Option<~str> {
231218
let keycolon = directive + ":";
232219
match line.find_str(keycolon) {

0 commit comments

Comments
 (0)