diff --git a/camkes-vm/build.py b/camkes-vm/build.py index de8ebbe8..d7d18347 100644 --- a/camkes-vm/build.py +++ b/camkes-vm/build.py @@ -44,7 +44,7 @@ def run_build(manifest_dir: str, build: Build): ] if plat.has_simulation and plat.name != 'PC99': - script.append(sim_script(build.success)) + script.append(sim_script(build.success, failure=build.error)) return run_build_script(manifest_dir, build, script) diff --git a/seL4-platforms/builds.py b/seL4-platforms/builds.py index ca0df1a3..4f7aa2fa 100644 --- a/seL4-platforms/builds.py +++ b/seL4-platforms/builds.py @@ -553,11 +553,14 @@ def summarise_junit(file_path: str) -> Tuple[int, List[str]]: "-q", junit_results, parsed_junit_results] -def sim_script(success: str, timeout=1200): +def sim_script(success: str, failure=None, timeout=1200): + """Return a script to run a simulation with timeout and expected success string. + Abort early on expected failure string.""" + fail_str = "%s {exit 1}" % failure if failure else "" return [ "expect", "-c", - 'spawn ./simulate; set timeout %d; expect { "%s" {exit 0} timeout {exit 1} }' % - (timeout, success) + 'spawn ./simulate; set timeout %d; expect "%s" {exit 0} %s timeout {exit 1}' % + (timeout, fail_str, success) ] diff --git a/sel4test-sim/build.py b/sel4test-sim/build.py index 9930f2da..2037bb65 100644 --- a/sel4test-sim/build.py +++ b/sel4test-sim/build.py @@ -18,7 +18,7 @@ def run_simulation(manifest_dir: str, build: Build): """Run one simulation build and test.""" - expect = '{ "%s" {exit 0} timeout {exit 1} }' % build.success + expect = '"%s" {exit 0} timeout {exit 1}' % build.success script = [ ["../init-build.sh"] + build.settings_args(),