From 9c5ef235cc595d0f51b0810786c2b512bef7c69f Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Mon, 7 Jan 2013 13:05:37 -0500 Subject: tests: Add support for skipping tests, skip EIO tests if not enabled The EIO tests depend on the EIO support from the "encumbered" repository, which means that they are not normally built with gem5. This causes all EIO related tests to fail, which is both annoying and confusing. This patch addresses this by adding support for skipping tests if certain conditions (e.g., the presence of a SimObject) can not be met. It introduces the following Python functions that can be called from within a test case: * skip_test -- Skip a test and optionally print why the test was skipped. * has_sim_object -- Test if a SimObject exists. * require_sim_object -- Test if a SimObject exists and skip, or optionally fail, the test if not. Additionally, this patch updates the EIO tests to check for the presence of EioProcess. --- tests/SConscript | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/SConscript') diff --git a/tests/SConscript b/tests/SConscript index 9bf9e3aeb..bfdc9a566 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -150,6 +150,9 @@ def run_test(target, source, env): # Hand the return status to scons and let scons decide what # to do about it (typically terminate unless run with -k). return status + elif status == 2: + # The test was skipped + pass else: print 'M5 exited with non-zero status', status # complete but failed execution (call to exit() with non-zero @@ -159,6 +162,8 @@ def run_test(target, source, env): # Generate status file contents based on exit status of m5 or diff-out if status == 0: status_str = "passed." + elif status == 2: + status_str = "skipped." else: status_str = "FAILED!" f = file(str(target[0]), 'w') @@ -188,6 +193,8 @@ def print_test(target, source, env): status = termcap.Red + status[:-1] + termcap.Normal + status[-1] elif status == "passed.": status = termcap.Green + status[:-1] + termcap.Normal + status[-1] + elif status == "skipped.": + status = termcap.Yellow + status[:-1] + termcap.Normal + status[-1] # put it back in the list and join with space words[-1] = status -- cgit v1.2.3