aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/core/test_mod_globalstruct.in19
-rw-r--r--tests/core/test_mod_globalstruct.out1
-rw-r--r--tests/test_core.py22
3 files changed, 23 insertions, 19 deletions
diff --git a/tests/core/test_mod_globalstruct.in b/tests/core/test_mod_globalstruct.in
new file mode 100644
index 00000000..3e1ed493
--- /dev/null
+++ b/tests/core/test_mod_globalstruct.in
@@ -0,0 +1,19 @@
+
+ #include <stdio.h>
+
+ struct malloc_params {
+ size_t magic, page_size;
+ };
+
+ malloc_params mparams;
+
+ #define SIZE_T_ONE ((size_t)1)
+ #define page_align(S) (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
+
+ int main()
+ {
+ mparams.page_size = 4096;
+ printf("*%d,%d,%d,%d*\n", mparams.page_size, page_align(1000), page_align(6000), page_align(66474));
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_mod_globalstruct.out b/tests/core/test_mod_globalstruct.out
new file mode 100644
index 00000000..3be9bc19
--- /dev/null
+++ b/tests/core/test_mod_globalstruct.out
@@ -0,0 +1 @@
+*4096,4096,8192,69632* \ No newline at end of file
diff --git a/tests/test_core.py b/tests/test_core.py
index e5874a6a..b4bdbe1c 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -1745,26 +1745,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run_from_file(src, output)
def test_mod_globalstruct(self):
- src = '''
- #include <stdio.h>
-
- struct malloc_params {
- size_t magic, page_size;
- };
-
- malloc_params mparams;
-
- #define SIZE_T_ONE ((size_t)1)
- #define page_align(S) (((S) + (mparams.page_size - SIZE_T_ONE)) & ~(mparams.page_size - SIZE_T_ONE))
+ test_path = path_from_root('tests', 'core', 'test_mod_globalstruct')
+ src, output = (test_path + s for s in ('.in', '.out'))
- int main()
- {
- mparams.page_size = 4096;
- printf("*%d,%d,%d,%d*\\n", mparams.page_size, page_align(1000), page_align(6000), page_align(66474));
- return 0;
- }
- '''
- self.do_run(src, '*4096,4096,8192,69632*')
+ self.do_run_from_file(src, output)
def test_pystruct(self):
src = '''