aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-01 20:58:15 -0700
committeralon@honor <none@none>2010-10-01 20:58:15 -0700
commit9a60dd64cdccc60d7a789ffa1f16536f8b106a0b (patch)
treee74085575573ccdcacc2a3b43f18c545eb265395 /tests/runner.py
parent73a87bedee8b225ed76c8efebe1a032d0bf91ec5 (diff)
test+fix for modifying fields of global structures
Diffstat (limited to 'tests/runner.py')
-rw-r--r--tests/runner.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index d2c5e4f1..08bb8648 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -541,6 +541,28 @@ class T(unittest.TestCase):
'''
self.do_test(src, '*70,97,15,3,3029,90*')
+ 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))
+
+ 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_test(src, '*4096,4096,8192,69632*')
+
def test_ptrtoint(self):
src = '''
#include <stdio.h>