From facc7fd2ef65f482a8ae966b22bf6ed9acb6e10a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 16 Sep 2011 11:44:55 -0700 Subject: [PATCH] Check for the correct exit code on cfail tests. Closes #938 --- src/test/compiletest/runtest.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/compiletest/runtest.rs b/src/test/compiletest/runtest.rs index 46b74e799f4f..de188f3927e3 100644 --- a/src/test/compiletest/runtest.rs +++ b/src/test/compiletest/runtest.rs @@ -41,6 +41,7 @@ fn run_cfail_test(cx: cx, props: test_props, testfile: str) { fatal_procres("compile-fail test compiled successfully!", procres); } + check_correct_failure_status(procres); check_error_patterns(props, testfile, procres); } @@ -57,16 +58,19 @@ fn run_rfail_test(cx: cx, props: test_props, testfile: str) { fatal_procres("run-fail test isn't valgrind-clean!", procres); } + check_correct_failure_status(procres); + check_error_patterns(props, testfile, procres); +} + +fn check_correct_failure_status(procres: procres) { // The value the rust runtime returns on failure const rust_err: int = 101; if procres.status != rust_err { fatal_procres( - #fmt("run-fail test produced the wrong error code: %d", + #fmt("failure produced the wrong error code: %d", procres.status), procres); } - - check_error_patterns(props, testfile, procres); } fn run_rpass_test(cx: cx, props: test_props, testfile: str) {