aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorDavid Claughton <dave@eclecticdave.com>2011-11-08 21:13:59 +0000
committerDavid Claughton <dave@eclecticdave.com>2011-12-03 01:29:44 +0000
commitca12d620e84fc5284976fb3ecfb8ef30ee7cfe4a (patch)
treeaec53cc648157cf6eab5469a472ba872c735da9e /tests/runner.py
parent62000632bb844fd0b6473ad0387ce3b82bc62909 (diff)
Modify exit() to throw an object and catch it.
* Changed exit from throwing an text string to throwing an Error-derived object encapsulating the exit status. Then catch it in 'callMain' and return the status. Enable this functionality by setting CATCH_EXIT_CODE in settings.js
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index b372ee51..06069da2 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4531,6 +4531,19 @@ Child2:9
except:
pass
+ def test_exit_status(self):
+ Settings.CATCH_EXIT_CODE = 1
+
+ src = '''
+ #include <stdio.h>
+ #include <stdlib.h>
+ int main()
+ {
+ printf("hello, world!\\n");
+ exit(118); // Unusual exit status to make sure it's working!
+ }
+ '''
+ self.do_run(src, 'hello, world!\nExit Status: 118')
# Generate tests for all our compilers
def make_run(name, compiler, llvm_opts, embetter, quantum_size, typed_arrays):