aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_atexit.in17
-rw-r--r--tests/core/test_atexit.out1
-rw-r--r--tests/test_core.py20
3 files changed, 21 insertions, 17 deletions
diff --git a/tests/core/test_atexit.in b/tests/core/test_atexit.in
new file mode 100644
index 00000000..56489a6c
--- /dev/null
+++ b/tests/core/test_atexit.in
@@ -0,0 +1,17 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ static void cleanA() {
+ printf("A");
+ }
+ static void cleanB() {
+ printf("B");
+ }
+
+ int main() {
+ atexit(cleanA);
+ atexit(cleanB);
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_atexit.out b/tests/core/test_atexit.out
new file mode 100644
index 00000000..c1c30196
--- /dev/null
+++ b/tests/core/test_atexit.out
@@ -0,0 +1 @@
+BA \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index 64a195e1..49a4d094 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2418,24 +2418,10 @@ The current type of b is: 9
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");
- }
+ test_path = path_from_root('tests', 'core', 'test_atexit')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main() {
- atexit(cleanA);
- atexit(cleanB);
- return 0;
- }
- '''
- self.do_run(src, 'BA')
+ self.do_run_from_file(src, output)
def test_pthread_specific(self):
if self.emcc_args is None: return self.skip('requires emcc')