Skip to content

Commit

Permalink
debuginfo: Split debuginfo autotests into debuginfo-gdb and debuginfo…
Browse files Browse the repository at this point in the history
…-lldb
  • Loading branch information
michaelwoerister committed May 7, 2014
1 parent 445988b commit 55a8bd5
Show file tree
Hide file tree
Showing 108 changed files with 3,749 additions and 3,384 deletions.
23 changes: 22 additions & 1 deletion configure
Expand Up @@ -466,6 +466,26 @@ probe CFG_PDFLATEX pdflatex
probe CFG_XELATEX xelatex
probe CFG_LUALATEX lualatex
probe CFG_GDB gdb
probe CFG_LLDB lldb

if [ ! -z "$CFG_LLDB" ]
then
# If CFG_LLDB_PYTHON_DIR is not already set from the outside and valid, try to read it from
# LLDB via the -P commandline options.
if [ -z "$CFG_LLDB_PYTHON_DIR" ] || [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
then
CFG_LLDB_PYTHON_DIR=$($CFG_LLDB -P)

# If CFG_LLDB_PYTHON_DIR is not a valid directory, set it to something more readable
if [ ! -d "$CFG_LLDB_PYTHON_DIR" ]
then
CFG_LLDB_PYTHON_DIR="LLDB_PYTHON_DIRECTORY_NOT_FOUND"
fi

putvar CFG_LLDB_PYTHON_DIR
fi
fi

if [ "$CFG_OSTYPE" = "unknown-linux-gnu" ]
then
probe CFG_PAXCTL paxctl /sbin/paxctl
Expand Down Expand Up @@ -807,7 +827,8 @@ do
make_dir $h/test/bench
make_dir $h/test/perf
make_dir $h/test/pretty
make_dir $h/test/debug-info
make_dir $h/test/debuginfo-gdb
make_dir $h/test/debuginfo-lldb
make_dir $h/test/codegen
make_dir $h/test/doc-tutorial
make_dir $h/test/doc-guide-ffi
Expand Down
42 changes: 30 additions & 12 deletions mk/tests.mk
Expand Up @@ -293,7 +293,8 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-gdb-exec \
check-stage$(1)-T-$(2)-H-$(3)-debuginfo-lldb-exec \
check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
Expand Down Expand Up @@ -460,7 +461,8 @@ CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
DEBUGINFO_GDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
DEBUGINFO_LLDB_RS := $(wildcard $(S)src/test/debuginfo/*.rs)
CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)

Expand All @@ -476,7 +478,8 @@ CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
BENCH_TESTS := $(BENCH_RS)
PERF_TESTS := $(PERF_RS)
PRETTY_TESTS := $(PRETTY_RS)
DEBUGINFO_TESTS := $(DEBUGINFO_RS)
DEBUGINFO_GDB_TESTS := $(DEBUGINFO_GDB_RS)
DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)

CTEST_SRC_BASE_rpass = run-pass
Expand Down Expand Up @@ -514,10 +517,15 @@ CTEST_BUILD_BASE_perf = perf
CTEST_MODE_perf = run-pass
CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)

CTEST_SRC_BASE_debuginfo = debug-info
CTEST_BUILD_BASE_debuginfo = debug-info
CTEST_MODE_debuginfo = debug-info
CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
CTEST_SRC_BASE_debuginfo-gdb = debuginfo
CTEST_BUILD_BASE_debuginfo-gdb = debuginfo-gdb
CTEST_MODE_debuginfo-gdb = debuginfo-gdb
CTEST_RUNTOOL_debuginfo-gdb = $(CTEST_RUNTOOL)

CTEST_SRC_BASE_debuginfo-lldb = debuginfo
CTEST_BUILD_BASE_debuginfo-lldb = debuginfo-lldb
CTEST_MODE_debuginfo-lldb = debuginfo-lldb
CTEST_RUNTOOL_debuginfo-lldb = $(CTEST_RUNTOOL)

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

ifeq ($(CFG_GDB),)
CTEST_DISABLE_debuginfo = "no gdb found"
CTEST_DISABLE_debuginfo-gdb = "no gdb found"
endif

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

ifeq ($(CFG_OSTYPE),apple-darwin)
CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
CTEST_DISABLE_debuginfo-gdb = "gdb on darwing needs root"
endif

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

Expand All @@ -597,7 +613,8 @@ CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
CTEST_DEPS_debuginfo-gdb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_GDB_TESTS)
CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS)
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)

endef
Expand Down Expand Up @@ -661,7 +678,7 @@ endif

endef

CTEST_NAMES = rpass rpass-full cfail-full rfail cfail bench perf debuginfo codegen
CTEST_NAMES = rpass rpass-full cfail-full rfail cfail bench perf debuginfo-gdb debuginfo-lldb codegen

$(foreach host,$(CFG_HOST), \
$(eval $(foreach target,$(CFG_TARGET), \
Expand Down Expand Up @@ -810,7 +827,8 @@ TEST_GROUPS = \
bench \
perf \
rmake \
debuginfo \
debuginfo-gdb \
debuginfo-lldb \
codegen \
doc \
$(foreach docname,$(DOCS),doc-$(docname)) \
Expand Down
6 changes: 5 additions & 1 deletion src/compiletest/common.rs
Expand Up @@ -14,7 +14,8 @@ pub enum mode {
mode_run_fail,
mode_run_pass,
mode_pretty,
mode_debug_info,
mode_debug_info_gdb,
mode_debug_info_lldb,
mode_codegen
}

Expand Down Expand Up @@ -101,6 +102,9 @@ pub struct config {
// status whether android device available or not
pub adb_device_status: bool,

// the path containing LLDB's Python module
pub lldb_python_dir: Option<~str>,

// Explain what's going on
pub verbose: bool

Expand Down
32 changes: 15 additions & 17 deletions src/compiletest/compiletest.rs
Expand Up @@ -28,14 +28,8 @@ use std::os;
use std::io;
use std::io::fs;
use getopts::{optopt, optflag, reqopt};
use common::config;
use common::mode_run_pass;
use common::mode_run_fail;
use common::mode_compile_fail;
use common::mode_pretty;
use common::mode_debug_info;
use common::mode_codegen;
use common::mode;
use common::{config, mode_run_pass, mode_run_fail, mode_compile_fail, mode_pretty,
mode_debug_info_gdb, mode_debug_info_lldb, mode_codegen, mode};
use util::logv;

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

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

pub fn str_mode(s: ~str) -> mode {
match s.as_slice() {
"compile-fail" => mode_compile_fail,
"run-fail" => mode_run_fail,
"run-pass" => mode_run_pass,
"pretty" => mode_pretty,
"debug-info" => mode_debug_info,
"codegen" => mode_codegen,
_ => fail!("invalid mode")
"compile-fail" => mode_compile_fail,
"run-fail" => mode_run_fail,
"run-pass" => mode_run_pass,
"pretty" => mode_pretty,
"debuginfo-gdb" => mode_debug_info_gdb,
"debuginfo-lldb" => mode_debug_info_lldb,
"codegen" => mode_codegen,
s => fail!("invalid mode: " + s)
}
}

Expand All @@ -220,15 +217,16 @@ pub fn mode_str(mode: mode) -> ~str {
mode_run_fail => "run-fail".to_owned(),
mode_run_pass => "run-pass".to_owned(),
mode_pretty => "pretty".to_owned(),
mode_debug_info => "debug-info".to_owned(),
mode_debug_info_gdb => "debuginfo-gdb".to_owned(),
mode_debug_info_lldb => "debuginfo-lldb".to_owned(),
mode_codegen => "codegen".to_owned(),
}
}

pub fn run_tests(config: &config) {
if config.target == "arm-linux-androideabi".to_owned() {
match config.mode{
mode_debug_info => {
mode_debug_info_gdb => {
println!("arm-linux-androideabi debug-info \
test uses tcp 5039 port. please reserve it");
}
Expand Down
15 changes: 1 addition & 14 deletions src/compiletest/header.rs
Expand Up @@ -26,8 +26,6 @@ pub struct TestProps {
pub aux_builds: Vec<~str> ,
// Environment settings to use during execution
pub exec_env: Vec<(~str,~str)> ,
// Commands to be given to the debugger, when testing debug info
pub debugger_cmds: Vec<~str> ,
// Lines to check if they appear in the expected debugger output
pub check_lines: Vec<~str> ,
// Flag to force a crate to be built with the host architecture
Expand All @@ -46,7 +44,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
let mut compile_flags = None;
let mut run_flags = None;
let mut pp_exact = None;
let mut debugger_cmds = Vec::new();
let mut check_lines = Vec::new();
let mut force_host = false;
let mut check_stdout = false;
Expand Down Expand Up @@ -91,11 +88,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
None => {}
}

match parse_debugger_cmd(ln) {
Some(dc) => debugger_cmds.push(dc),
None => ()
};

match parse_check_line(ln) {
Some(cl) => check_lines.push(cl),
None => ()
Expand All @@ -111,7 +103,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
pp_exact: pp_exact,
aux_builds: aux_builds,
exec_env: exec_env,
debugger_cmds: debugger_cmds,
check_lines: check_lines,
force_host: force_host,
check_stdout: check_stdout,
Expand Down Expand Up @@ -173,10 +164,6 @@ fn parse_run_flags(line: &str) -> Option<~str> {
parse_name_value_directive(line, "run-flags".to_owned())
}

fn parse_debugger_cmd(line: &str) -> Option<~str> {
parse_name_value_directive(line, "debugger".to_owned())
}

fn parse_check_line(line: &str) -> Option<~str> {
parse_name_value_directive(line, "check".to_owned())
}
Expand Down Expand Up @@ -226,7 +213,7 @@ fn parse_name_directive(line: &str, directive: &str) -> bool {
line.contains(directive)
}

fn parse_name_value_directive(line: &str,
pub fn parse_name_value_directive(line: &str,
directive: ~str) -> Option<~str> {
let keycolon = directive + ":";
match line.find_str(keycolon) {
Expand Down

5 comments on commit 55a8bd5

@bors
Copy link
Contributor

@bors bors commented on 55a8bd5 May 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at michaelwoerister@55a8bd5

@bors
Copy link
Contributor

@bors bors commented on 55a8bd5 May 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging michaelwoerister/rust/lldb-autotests = 55a8bd5 into auto

@bors
Copy link
Contributor

@bors bors commented on 55a8bd5 May 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

michaelwoerister/rust/lldb-autotests = 55a8bd5 merged ok, testing candidate = 828ffab

@bors
Copy link
Contributor

@bors bors commented on 55a8bd5 May 7, 2014

@bors
Copy link
Contributor

@bors bors commented on 55a8bd5 May 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 828ffab

Please sign in to comment.