diff options
author | Jez Ng <me@jezng.com> | 2013-07-11 19:34:01 -0700 |
---|---|---|
committer | Jez Ng <me@jezng.com> | 2013-07-11 20:37:58 -0700 |
commit | 470b7da45616f7c72794cf3ced71f21db2ebdc2c (patch) | |
tree | 66ea2d5aea7699a4b444e093ed666fc0b9ff71aa /tests/runner.py | |
parent | c1e1d87bc3b9e249795543e44a1224c2f03154ce (diff) |
Filter out unnamed_addr globals from symbol table.
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/runner.py b/tests/runner.py index a892eb56..89bf0c56 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -5899,7 +5899,7 @@ extern "C" __attribute__((noinline)) void foo(int x) { printf("%d\n", x); } -void repeatable() { +extern "C" __attribute__((noinline)) void repeatable() { void* self = dlopen(NULL, RTLD_LAZY); int* global_ptr = (int*)dlsym(self, "global"); void (*foo_ptr)(int) = (void (*)(int))dlsym(self, "foo"); @@ -5912,7 +5912,22 @@ int main() { repeatable(); return 0; }''' - self.do_run(src, '123\n123') + def post(filename): + with open(filename) as f: + for line in f: + if 'var SYMBOL_TABLE' in line: + table = line + break + else: + raise Exception('Could not find symbol table!') + import json + table = json.loads(table[table.find('{'):table.rfind('}')+1]) + actual = list(sorted(table.keys())) + # ensure there aren't too many globals; we don't want unnamed_addr + assert actual == ['_foo', '_global', '_main', '_repeatable'], \ + "Symbol table does not match: %s" % actual + + self.do_run(src, '123\n123', post_build=(None, post)) def test_rand(self): return self.skip('rand() is now random') # FIXME |