Use a unique exit status when the runtime fails normally
Check for it in run-fail tests
This commit is contained in:
@@ -99,6 +99,9 @@ static size_t const TIME_SLICE_IN_MS = 10;
|
|||||||
|
|
||||||
static size_t const BUF_BYTES = 2048;
|
static size_t const BUF_BYTES = 2048;
|
||||||
|
|
||||||
|
// The error status to use when the process fails
|
||||||
|
#define PROC_FAIL_CODE 101;
|
||||||
|
|
||||||
// Every reference counted object should use this macro and initialize
|
// Every reference counted object should use this macro and initialize
|
||||||
// ref_count.
|
// ref_count.
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ rust_kernel::fail() {
|
|||||||
// Runtime to terminate it in an unusual way" when trying to shutdown
|
// Runtime to terminate it in an unusual way" when trying to shutdown
|
||||||
// cleanly.
|
// cleanly.
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
exit(1);
|
exit(rval);
|
||||||
#endif
|
#endif
|
||||||
for(size_t i = 0; i < num_threads; ++i) {
|
for(size_t i = 0; i < num_threads; ++i) {
|
||||||
rust_scheduler *thread = threads[i];
|
rust_scheduler *thread = threads[i];
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ rust_scheduler::fail() {
|
|||||||
log(NULL, log_err, "domain %s @0x%" PRIxPTR " root task failed",
|
log(NULL, log_err, "domain %s @0x%" PRIxPTR " root task failed",
|
||||||
name, this);
|
name, this);
|
||||||
I(this, kernel->rval == 0);
|
I(this, kernel->rval == 0);
|
||||||
kernel->rval = 1;
|
kernel->rval = PROC_FAIL_CODE;
|
||||||
kernel->fail();
|
kernel->fail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,15 +51,21 @@ fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) {
|
|||||||
|
|
||||||
procres = exec_compiled_test(cx, props, testfile);
|
procres = exec_compiled_test(cx, props, testfile);
|
||||||
|
|
||||||
if procres.status == 0 {
|
// The value our Makefile configures valgrind to return on failure
|
||||||
fatal_procres("run-fail test didn't produce an error!", procres);
|
|
||||||
}
|
|
||||||
|
|
||||||
const valgrind_err: int = 100;
|
const valgrind_err: int = 100;
|
||||||
if procres.status == valgrind_err {
|
if procres.status == valgrind_err {
|
||||||
fatal_procres("run-fail test isn't valgrind-clean!", procres);
|
fatal_procres("run-fail test isn't valgrind-clean!", 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",
|
||||||
|
procres.status),
|
||||||
|
procres);
|
||||||
|
}
|
||||||
|
|
||||||
check_error_patterns(props, testfile, procres);
|
check_error_patterns(props, testfile, procres);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user