Begin valgrinding run-fail tests
Introduce a temporary no-valgrind directive for the few that aren't clean
This commit is contained in:
parent
0cd607bcbd
commit
40ae704ff2
@ -185,11 +185,11 @@ CFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--build-base test/compile-fail/ \
|
||||
--mode compile-fail \
|
||||
|
||||
# FIXME (236): run-fail should run under valgrind once unwinding works
|
||||
RFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--src-base $$(S)src/test/run-fail/ \
|
||||
--build-base test/run-fail/ \
|
||||
--mode run-fail \
|
||||
$$(CTEST_RUNTOOL) \
|
||||
|
||||
RPASS_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
|
||||
--src-base $(S)src/test/run-pass/ \
|
||||
|
@ -16,7 +16,10 @@ type test_props = {
|
||||
compile_flags: option::t[str],
|
||||
// If present, the name of a file that this test should match when
|
||||
// pretty-printed
|
||||
pp_exact: option::t[str]
|
||||
pp_exact: option::t[str],
|
||||
// FIXME: no-valgrind is a temporary directive until all of run-fail
|
||||
// is valgrind-clean
|
||||
no_valgrind: bool
|
||||
};
|
||||
|
||||
// Load any test directives embedded in the file
|
||||
@ -24,6 +27,7 @@ fn load_props(testfile: &str) -> test_props {
|
||||
let error_patterns = ~[];
|
||||
let compile_flags = option::none;
|
||||
let pp_exact = option::none;
|
||||
let no_valgrind = false;
|
||||
for each ln: str in iter_header(testfile) {
|
||||
alt parse_error_pattern(ln) {
|
||||
option::some(ep) { error_patterns += ~[ep]; }
|
||||
@ -37,11 +41,16 @@ fn load_props(testfile: &str) -> test_props {
|
||||
if option::is_none(pp_exact) {
|
||||
pp_exact = parse_pp_exact(ln, testfile);
|
||||
}
|
||||
|
||||
if no_valgrind == false {
|
||||
no_valgrind = parse_name_directive(ln, "no-valgrind");
|
||||
}
|
||||
}
|
||||
ret {
|
||||
error_patterns: error_patterns,
|
||||
compile_flags: compile_flags,
|
||||
pp_exact: pp_exact
|
||||
pp_exact: pp_exact,
|
||||
no_valgrind: no_valgrind
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,22 @@ fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) {
|
||||
if procres.status != 0 {
|
||||
fatal_procres("compilation failed!", procres); }
|
||||
|
||||
procres = exec_compiled_test(cx, testfile);
|
||||
procres = exec_compiled_test(cx, props, testfile);
|
||||
|
||||
if procres.status == 0 {
|
||||
fatal_procres("run-fail test didn't produce an error!",
|
||||
procres);
|
||||
}
|
||||
|
||||
// This is the value valgrind returns on failure
|
||||
// FIXME: Why is this value neither the value we pass to
|
||||
// valgrind as --error-exitcode (1), nor the value we see as the
|
||||
// exit code on the command-line (137)?
|
||||
const valgrind_err: int = 9;
|
||||
if procres.status == valgrind_err {
|
||||
fatal_procres("run-fail test isn't valgrind-clean!", procres);
|
||||
}
|
||||
|
||||
check_error_patterns(props, testfile, procres);
|
||||
}
|
||||
|
||||
@ -69,7 +78,7 @@ fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) {
|
||||
if procres.status != 0 {
|
||||
fatal_procres("compilation failed!", procres); }
|
||||
|
||||
procres = exec_compiled_test(cx, testfile);
|
||||
procres = exec_compiled_test(cx, props, testfile);
|
||||
|
||||
|
||||
if procres.status != 0 { fatal_procres("test run failed!", procres); }
|
||||
@ -219,8 +228,9 @@ fn compile_test(cx: &cx, props: &test_props, testfile: &str) -> procres {
|
||||
cx.config.compile_lib_path, option::none)
|
||||
}
|
||||
|
||||
fn exec_compiled_test(cx: &cx, testfile: &str) -> procres {
|
||||
compose_and_run(cx, testfile, make_run_args,
|
||||
fn exec_compiled_test(cx: &cx, props: &test_props,
|
||||
testfile: &str) -> procres {
|
||||
compose_and_run(cx, testfile, bind make_run_args(_, props, _),
|
||||
cx.config.run_lib_path, option::none)
|
||||
}
|
||||
|
||||
@ -248,12 +258,17 @@ fn make_exe_name(config: &config, testfile: &str) -> str {
|
||||
output_base_name(config, testfile) + os::exec_suffix()
|
||||
}
|
||||
|
||||
fn make_run_args(config: &config, testfile: &str) -> procargs {
|
||||
// If we've got another tool to run under (valgrind),
|
||||
// then split apart its command
|
||||
let args =
|
||||
fn make_run_args(config: &config,
|
||||
props: &test_props, testfile: &str) -> procargs {
|
||||
let toolargs = if !props.no_valgrind {
|
||||
// If we've got another tool to run under (valgrind),
|
||||
// then split apart its command
|
||||
split_maybe_args(config.runtool)
|
||||
+ [make_exe_name(config, testfile)];
|
||||
} else {
|
||||
[]
|
||||
};
|
||||
|
||||
let args = toolargs + [make_exe_name(config, testfile)];
|
||||
ret {prog: args.(0), args: vec::slice(args, 1u, vec::len(args))};
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
|
||||
// error-pattern:wooooo
|
||||
// no-valgrind
|
||||
fn main() { let a = 1; if 1 == 1 { a = 2; } fail "woooo" + "o"; }
|
@ -1,4 +1,5 @@
|
||||
// error-pattern:meh
|
||||
// no-valgrind
|
||||
use std;
|
||||
import std::str;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// -*- rust -*-
|
||||
|
||||
// error-pattern:1 == 2
|
||||
// no-valgrind
|
||||
|
||||
fn child() { assert (1 == 2); }
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
|
||||
|
||||
|
||||
// -*- rust -*-
|
||||
|
||||
// error-pattern:bounds check
|
||||
// no-valgrind
|
||||
fn main() {
|
||||
let v: vec[int] = [10];
|
||||
let x: int = 0;
|
||||
|
@ -1,9 +1,7 @@
|
||||
|
||||
|
||||
|
||||
// -*- rust -*-
|
||||
|
||||
// error-pattern:bounds check
|
||||
// no-valgrind
|
||||
fn main() {
|
||||
let v: vec[int] = [10, 20];
|
||||
let x: int = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user