aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Taylor <adrian@macrobug.com>2012-02-12 11:42:00 +0000
committerAdrian Taylor <adrian@macrobug.com>2012-02-12 11:46:48 +0000
commit3549dcd84fb8fc8695bef23ac135dbacd00e87af (patch)
tree4a8347eef23f11a7a5f112eef119b287f922954d
parent9059287d1e5351a76599633b0a66d69468595313 (diff)
Adding test that atexit calls things in the right order.
-rwxr-xr-xtests/runner.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index fd447863..1cd94111 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -2418,6 +2418,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()