aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-14 15:09:28 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-14 15:09:28 -0800
commiteb56795d36b7079b3b6a627c79be10789e028dec (patch)
tree7da88dfdd90fe97783068190a914c6b7801b17c0 /tests/runner.py
parent84e717376a9926782b10e3f3364b014bfee88d88 (diff)
parent423519b3650d1966fd8e436065ea60f937134a4d (diff)
Merge pull request #246 from adetaylor/atexit-fix
Fix for order in which 'atexit' registered functions are called
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index e2bb13d4..ac422e9e 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -2439,6 +2439,27 @@ def process(filename):
self.do_run(src, '*1*', force_c=True)
+ def test_atexit(self):
+ # Confirms they are called in reverse order
+ src = r'''
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ static void cleanA() {
+ printf("A");
+ }
+ static void cleanB() {
+ printf("B");
+ }
+
+ int main() {
+ atexit(cleanA);
+ atexit(cleanB);
+ return 0;
+ }
+ '''
+ self.do_run(src, 'BA')
+
def test_time(self):
# XXX Not sure what the right output is here. Looks like the test started failing with daylight savings changes. Modified it to pass again.
src = open(path_from_root('tests', 'time', 'src.c'), 'r').read()