Skip to content

Commit 61f6b05

Browse files
committed
---
yaml --- r: 4518 b: refs/heads/master c: 40ae704 h: refs/heads/master v: v3
1 parent 2f6189d commit 61f6b05

File tree

9 files changed

+42
-21
lines changed

9 files changed

+42
-21
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 0cd607bcbdc70d3d7ccefd5faf830cc8e5d68c86
2+
refs/heads/master: 40ae704ff2fc419c162527345bad63dd06394afe

trunk/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ CFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
185185
--build-base test/compile-fail/ \
186186
--mode compile-fail \
187187

188-
# FIXME (236): run-fail should run under valgrind once unwinding works
189188
RFAIL_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
190189
--src-base $$(S)src/test/run-fail/ \
191190
--build-base test/run-fail/ \
192191
--mode run-fail \
192+
$$(CTEST_RUNTOOL) \
193193

194194
RPASS_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
195195
--src-base $(S)src/test/run-pass/ \

trunk/src/test/compiletest/header.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ type test_props = {
1616
compile_flags: option::t[str],
1717
// If present, the name of a file that this test should match when
1818
// pretty-printed
19-
pp_exact: option::t[str]
19+
pp_exact: option::t[str],
20+
// FIXME: no-valgrind is a temporary directive until all of run-fail
21+
// is valgrind-clean
22+
no_valgrind: bool
2023
};
2124

2225
// Load any test directives embedded in the file
2326
fn load_props(testfile: &str) -> test_props {
2427
let error_patterns = ~[];
2528
let compile_flags = option::none;
2629
let pp_exact = option::none;
30+
let no_valgrind = false;
2731
for each ln: str in iter_header(testfile) {
2832
alt parse_error_pattern(ln) {
2933
option::some(ep) { error_patterns += ~[ep]; }
@@ -37,11 +41,16 @@ fn load_props(testfile: &str) -> test_props {
3741
if option::is_none(pp_exact) {
3842
pp_exact = parse_pp_exact(ln, testfile);
3943
}
44+
45+
if no_valgrind == false {
46+
no_valgrind = parse_name_directive(ln, "no-valgrind");
47+
}
4048
}
4149
ret {
4250
error_patterns: error_patterns,
4351
compile_flags: compile_flags,
44-
pp_exact: pp_exact
52+
pp_exact: pp_exact,
53+
no_valgrind: no_valgrind
4554
};
4655
}
4756

trunk/src/test/compiletest/runtest.rs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,22 @@ fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) {
5353
if procres.status != 0 {
5454
fatal_procres("compilation failed!", procres); }
5555

56-
procres = exec_compiled_test(cx, testfile);
56+
procres = exec_compiled_test(cx, props, testfile);
5757

5858
if procres.status == 0 {
5959
fatal_procres("run-fail test didn't produce an error!",
6060
procres);
6161
}
6262

63+
// This is the value valgrind returns on failure
64+
// FIXME: Why is this value neither the value we pass to
65+
// valgrind as --error-exitcode (1), nor the value we see as the
66+
// exit code on the command-line (137)?
67+
const valgrind_err: int = 9;
68+
if procres.status == valgrind_err {
69+
fatal_procres("run-fail test isn't valgrind-clean!", procres);
70+
}
71+
6372
check_error_patterns(props, testfile, procres);
6473
}
6574

@@ -69,7 +78,7 @@ fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) {
6978
if procres.status != 0 {
7079
fatal_procres("compilation failed!", procres); }
7180

72-
procres = exec_compiled_test(cx, testfile);
81+
procres = exec_compiled_test(cx, props, testfile);
7382

7483

7584
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 {
219228
cx.config.compile_lib_path, option::none)
220229
}
221230

222-
fn exec_compiled_test(cx: &cx, testfile: &str) -> procres {
223-
compose_and_run(cx, testfile, make_run_args,
231+
fn exec_compiled_test(cx: &cx, props: &test_props,
232+
testfile: &str) -> procres {
233+
compose_and_run(cx, testfile, bind make_run_args(_, props, _),
224234
cx.config.run_lib_path, option::none)
225235
}
226236

@@ -248,12 +258,17 @@ fn make_exe_name(config: &config, testfile: &str) -> str {
248258
output_base_name(config, testfile) + os::exec_suffix()
249259
}
250260

251-
fn make_run_args(config: &config, testfile: &str) -> procargs {
252-
// If we've got another tool to run under (valgrind),
253-
// then split apart its command
254-
let args =
261+
fn make_run_args(config: &config,
262+
props: &test_props, testfile: &str) -> procargs {
263+
let toolargs = if !props.no_valgrind {
264+
// If we've got another tool to run under (valgrind),
265+
// then split apart its command
255266
split_maybe_args(config.runtool)
256-
+ [make_exe_name(config, testfile)];
267+
} else {
268+
[]
269+
};
270+
271+
let args = toolargs + [make_exe_name(config, testfile)];
257272
ret {prog: args.(0), args: vec::slice(args, 1u, vec::len(args))};
258273
}
259274

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
2-
31
// error-pattern:wooooo
2+
// no-valgrind
43
fn main() { let a = 1; if 1 == 1 { a = 2; } fail "woooo" + "o"; }

trunk/src/test/run-fail/fmt-fail.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// error-pattern:meh
2+
// no-valgrind
23
use std;
34
import std::str;
45

trunk/src/test/run-fail/linked-failure.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// -*- rust -*-
22

33
// error-pattern:1 == 2
4+
// no-valgrind
45

56
fn child() { assert (1 == 2); }
67

trunk/src/test/run-fail/vec-overrun.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
2-
3-
41
// -*- rust -*-
52

63
// error-pattern:bounds check
4+
// no-valgrind
75
fn main() {
86
let v: vec[int] = [10];
97
let x: int = 0;

trunk/src/test/run-fail/vec-underrun.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
2-
3-
41
// -*- rust -*-
52

63
// error-pattern:bounds check
4+
// no-valgrind
75
fn main() {
86
let v: vec[int] = [10, 20];
97
let x: int = 0;

0 commit comments

Comments
 (0)