Add JIT testing to compiletest with --jit
This commit is contained in:
parent
b999973c0f
commit
e27b8f7f02
@ -49,5 +49,10 @@ type config = {
|
||||
// Flags to pass to the compiler
|
||||
rustcflags: Option<~str>,
|
||||
|
||||
// Run tests using the JIT
|
||||
jit: bool,
|
||||
|
||||
// Explain what's going on
|
||||
verbose: bool};
|
||||
verbose: bool
|
||||
|
||||
};
|
||||
|
@ -32,7 +32,8 @@ fn parse_config(args: ~[~str]) -> config {
|
||||
getopts::reqopt(~"mode"), getopts::optflag(~"ignored"),
|
||||
getopts::optopt(~"runtool"), getopts::optopt(~"rustcflags"),
|
||||
getopts::optflag(~"verbose"),
|
||||
getopts::optopt(~"logfile")];
|
||||
getopts::optopt(~"logfile"),
|
||||
getopts::optflag(~"jit")];
|
||||
|
||||
assert (vec::is_not_empty(args));
|
||||
let args_ = vec::tail(args);
|
||||
@ -64,6 +65,7 @@ fn parse_config(args: ~[~str]) -> config {
|
||||
|s| Path(s)),
|
||||
runtool: getopts::opt_maybe_str(matches, ~"runtool"),
|
||||
rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"),
|
||||
jit: getopts::opt_present(matches, ~"jit"),
|
||||
verbose: getopts::opt_present(matches, ~"verbose")};
|
||||
}
|
||||
|
||||
@ -81,6 +83,7 @@ fn log_config(config: config) {
|
||||
logv(c, fmt!("filter: %s", opt_str(config.filter)));
|
||||
logv(c, fmt!("runtool: %s", opt_str(config.runtool)));
|
||||
logv(c, fmt!("rustcflags: %s", opt_str(config.rustcflags)));
|
||||
logv(c, fmt!("jit: %b", config.jit));
|
||||
logv(c, fmt!("verbose: %b", config.verbose));
|
||||
logv(c, fmt!("\n"));
|
||||
}
|
||||
|
@ -48,11 +48,15 @@ fn run_cfail_test(config: config, props: test_props, testfile: &Path) {
|
||||
}
|
||||
|
||||
fn run_rfail_test(config: config, props: test_props, testfile: &Path) {
|
||||
let mut procres = compile_test(config, props, testfile);
|
||||
let procres = if !config.jit {
|
||||
let procres = compile_test(config, props, testfile);
|
||||
|
||||
if procres.status != 0 { fatal_procres(~"compilation failed!", procres); }
|
||||
if procres.status != 0 { fatal_procres(~"compilation failed!", procres); }
|
||||
|
||||
procres = exec_compiled_test(config, props, testfile);
|
||||
exec_compiled_test(config, props, testfile)
|
||||
} else {
|
||||
jit_test(config, props, testfile)
|
||||
};
|
||||
|
||||
// The value our Makefile configures valgrind to return on failure
|
||||
const valgrind_err: int = 100;
|
||||
@ -76,13 +80,19 @@ fn check_correct_failure_status(procres: procres) {
|
||||
}
|
||||
|
||||
fn run_rpass_test(config: config, props: test_props, testfile: &Path) {
|
||||
let mut procres = compile_test(config, props, testfile);
|
||||
if !config.jit {
|
||||
let mut procres = compile_test(config, props, testfile);
|
||||
|
||||
if procres.status != 0 { fatal_procres(~"compilation failed!", procres); }
|
||||
if procres.status != 0 { fatal_procres(~"compilation failed!", procres); }
|
||||
|
||||
procres = exec_compiled_test(config, props, testfile);
|
||||
procres = exec_compiled_test(config, props, testfile);
|
||||
|
||||
if procres.status != 0 { fatal_procres(~"test run failed!", procres); }
|
||||
if procres.status != 0 { fatal_procres(~"test run failed!", procres); }
|
||||
} else {
|
||||
let mut procres = jit_test(config, props, testfile);
|
||||
|
||||
if procres.status != 0 { fatal_procres(~"jit failed!", procres); }
|
||||
}
|
||||
}
|
||||
|
||||
fn run_pretty_test(config: config, props: test_props, testfile: &Path) {
|
||||
@ -295,10 +305,19 @@ type procres = {status: int, stdout: ~str, stderr: ~str, cmdline: ~str};
|
||||
|
||||
fn compile_test(config: config, props: test_props,
|
||||
testfile: &Path) -> procres {
|
||||
compile_test_(config, props, testfile, [])
|
||||
}
|
||||
|
||||
fn jit_test(config: config, props: test_props, testfile: &Path) -> procres {
|
||||
compile_test_(config, props, testfile, [~"--jit"])
|
||||
}
|
||||
|
||||
fn compile_test_(config: config, props: test_props,
|
||||
testfile: &Path, extra_args: &[~str]) -> procres {
|
||||
let link_args = ~[~"-L", aux_output_dir_name(config, testfile).to_str()];
|
||||
compose_and_run_compiler(
|
||||
config, props, testfile,
|
||||
make_compile_args(config, props, link_args,
|
||||
make_compile_args(config, props, link_args + extra_args,
|
||||
make_exe_name, testfile),
|
||||
None)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user