add ability to run multi-crate tests, run tests with --inline
This commit is contained in:
parent
aa77cf3472
commit
5c1338a18e
|
@ -253,8 +253,9 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
|
|||
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
|
||||
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
|
||||
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X) \
|
||||
--aux-base $$(S)src/test/aux/ \
|
||||
--stage-id stage$(1)-$(2) \
|
||||
--rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)" \
|
||||
--rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2) --inline" \
|
||||
$$(CTEST_TESTARGS)
|
||||
|
||||
CFAIL_ARGS$(1)-T-$(2)-H-$(3) := \
|
||||
|
|
|
@ -134,7 +134,7 @@ fn visit_ids(item: @ast::item, vfn: fn@(ast::node_id)) {
|
|||
},
|
||||
|
||||
visit_item: fn@(i: @ast::item) {
|
||||
vfn(i.id)
|
||||
vfn(i.id);
|
||||
},
|
||||
|
||||
visit_local: fn@(l: @ast::local) {
|
||||
|
@ -772,7 +772,8 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
|
|||
let id0 = entry_doc[c::tag_table_id].as_int();
|
||||
let id = xcx.tr_id(id0);
|
||||
|
||||
#debug[">> Side table document with tag 0x%x found for id %d (orig %d)",
|
||||
#debug[">> Side table document with tag 0x%x \
|
||||
found for id %d (orig %d)",
|
||||
tag, id, id0];
|
||||
|
||||
if tag == (c::tag_table_mutbl as uint) {
|
||||
|
|
|
@ -2,29 +2,43 @@ import option;
|
|||
|
||||
enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, }
|
||||
|
||||
type config =
|
||||
type config = {
|
||||
// The library paths required for running the compiler
|
||||
compile_lib_path: str,
|
||||
|
||||
// The library paths required for running compiled programs
|
||||
run_lib_path: str,
|
||||
|
||||
// The rustc executable
|
||||
rustc_path: str,
|
||||
|
||||
// The directory containing the tests to run
|
||||
src_base: str,
|
||||
|
||||
// The directory where programs should be built
|
||||
build_base: str,
|
||||
|
||||
// Directory for auxiliary libraries
|
||||
aux_base: str,
|
||||
|
||||
// The name of the stage being built (stage1, etc)
|
||||
stage_id: str,
|
||||
|
||||
// The test mode, compile-fail, run-fail, run-pass
|
||||
mode: mode,
|
||||
|
||||
// Run ignored tests
|
||||
run_ignored: bool,
|
||||
|
||||
// Only run tests that match this filter
|
||||
filter: option<str>,
|
||||
|
||||
// A command line to prefix program execution with,
|
||||
// for running under valgrind
|
||||
// Flags to pass to the compiler
|
||||
// Explain what's going on
|
||||
{compile_lib_path: str,
|
||||
run_lib_path: str,
|
||||
rustc_path: str,
|
||||
src_base: str,
|
||||
build_base: str,
|
||||
stage_id: str,
|
||||
mode: mode,
|
||||
run_ignored: bool,
|
||||
filter: option<str>,
|
||||
runtool: option<str>,
|
||||
|
||||
// Flags to pass to the compiler
|
||||
rustcflags: option<str>,
|
||||
|
||||
// Explain what's going on
|
||||
verbose: bool};
|
||||
|
|
|
@ -35,7 +35,8 @@ fn parse_config(args: [str]) -> config {
|
|||
let opts =
|
||||
[getopts::reqopt("compile-lib-path"), getopts::reqopt("run-lib-path"),
|
||||
getopts::reqopt("rustc-path"), getopts::reqopt("src-base"),
|
||||
getopts::reqopt("build-base"), getopts::reqopt("stage-id"),
|
||||
getopts::reqopt("build-base"), getopts::reqopt("aux-base"),
|
||||
getopts::reqopt("stage-id"),
|
||||
getopts::reqopt("mode"), getopts::optflag("ignored"),
|
||||
getopts::optopt("runtool"), getopts::optopt("rustcflags"),
|
||||
getopts::optflag("verbose")];
|
||||
|
@ -53,6 +54,7 @@ fn parse_config(args: [str]) -> config {
|
|||
rustc_path: getopts::opt_str(match, "rustc-path"),
|
||||
src_base: getopts::opt_str(match, "src-base"),
|
||||
build_base: getopts::opt_str(match, "build-base"),
|
||||
aux_base: getopts::opt_str(match, "aux-base"),
|
||||
stage_id: getopts::opt_str(match, "stage-id"),
|
||||
mode: str_mode(getopts::opt_str(match, "mode")),
|
||||
run_ignored: getopts::opt_present(match, "ignored"),
|
||||
|
|
|
@ -17,12 +17,15 @@ type test_props = {
|
|||
compile_flags: option<str>,
|
||||
// If present, the name of a file that this test should match when
|
||||
// pretty-printed
|
||||
pp_exact: option<str>
|
||||
pp_exact: option<str>,
|
||||
// Modules from aux directory that should be compiled
|
||||
aux_builds: [str]
|
||||
};
|
||||
|
||||
// Load any test directives embedded in the file
|
||||
fn load_props(testfile: str) -> test_props {
|
||||
let error_patterns = [];
|
||||
let aux_builds = [];
|
||||
let compile_flags = option::none;
|
||||
let pp_exact = option::none;
|
||||
iter_header(testfile) {|ln|
|
||||
|
@ -38,11 +41,16 @@ fn load_props(testfile: str) -> test_props {
|
|||
if option::is_none(pp_exact) {
|
||||
pp_exact = parse_pp_exact(ln, testfile);
|
||||
}
|
||||
|
||||
option::may(parse_aux_build(ln)) {|ab|
|
||||
aux_builds += [ab];
|
||||
}
|
||||
};
|
||||
ret {
|
||||
error_patterns: error_patterns,
|
||||
compile_flags: compile_flags,
|
||||
pp_exact: pp_exact
|
||||
pp_exact: pp_exact,
|
||||
aux_builds: aux_builds
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -82,6 +90,10 @@ fn parse_error_pattern(line: str) -> option<str> {
|
|||
parse_name_value_directive(line, "error-pattern")
|
||||
}
|
||||
|
||||
fn parse_aux_build(line: str) -> option<str> {
|
||||
parse_name_value_directive(line, "aux-build")
|
||||
}
|
||||
|
||||
fn parse_compile_flags(line: str) -> option<str> {
|
||||
parse_name_value_directive(line, "compile-flags")
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ actual:\n\
|
|||
|
||||
fn make_typecheck_args(config: config, _testfile: str) -> procargs {
|
||||
let prog = config.rustc_path;
|
||||
let args = ["-", "--no-trans", "--lib"];
|
||||
let args = ["-", "--no-trans", "--lib", "-L", config.build_base];
|
||||
args += split_maybe_args(config.rustcflags);
|
||||
ret {prog: prog, args: args};
|
||||
}
|
||||
|
@ -287,7 +287,16 @@ type procres = {status: int, stdout: str, stderr: str, cmdline: str};
|
|||
|
||||
fn compile_test(config: config, props: test_props,
|
||||
testfile: str) -> procres {
|
||||
compose_and_run(config, testfile, bind make_compile_args(_, props, _),
|
||||
vec::iter(props.aux_builds) {|rel_ab|
|
||||
let abs_ab = fs::connect(config.aux_base, rel_ab);
|
||||
compose_and_run(config, abs_ab,
|
||||
make_compile_args(_, props, ["--lib"],
|
||||
make_lib_name, _),
|
||||
config.compile_lib_path, option::none);
|
||||
}
|
||||
|
||||
compose_and_run(config, testfile,
|
||||
make_compile_args(_, props, [], make_exe_name, _),
|
||||
config.compile_lib_path, option::none)
|
||||
}
|
||||
|
||||
|
@ -305,15 +314,23 @@ fn compose_and_run(config: config, testfile: str,
|
|||
procargs.prog, procargs.args, input);
|
||||
}
|
||||
|
||||
fn make_compile_args(config: config, props: test_props, testfile: str) ->
|
||||
fn make_compile_args(config: config, props: test_props, extras: [str],
|
||||
xform: fn(config, str) -> str, testfile: str) ->
|
||||
procargs {
|
||||
let prog = config.rustc_path;
|
||||
let args = [testfile, "-o", make_exe_name(config, testfile)];
|
||||
let args = [testfile, "-o", xform(config, testfile),
|
||||
"-L", config.build_base] + extras;
|
||||
args += split_maybe_args(config.rustcflags);
|
||||
args += split_maybe_args(props.compile_flags);
|
||||
ret {prog: prog, args: args};
|
||||
}
|
||||
|
||||
fn make_lib_name(config: config, testfile: str) -> str {
|
||||
// what we return here is not particularly important, as it
|
||||
// happens; rustc ignores everything except for the directory.
|
||||
output_base_name(config, testfile)
|
||||
}
|
||||
|
||||
fn make_exe_name(config: config, testfile: str) -> str {
|
||||
output_base_name(config, testfile) + os::exec_suffix()
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ fn test_option_int() {
|
|||
}
|
||||
|
||||
fn deserialize_0<S: deserializer>(s: S) -> option<int> {
|
||||
s.read_enum("option") {||
|
||||
s.read_enum("core::option::t") {||
|
||||
s.read_enum_variant {|i|
|
||||
alt check i {
|
||||
0u { none }
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#[inline]
|
||||
fn iter<T>(v: [T], f: fn(T)) {
|
||||
let i = 0u;
|
||||
let n = vec::len(v);
|
||||
while i < n {
|
||||
f(v[i]);
|
||||
i += 1u;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue