1import py, sys, os 2import _cffi_backend 3 4def test_no_unknown_exported_symbols(): 5 if not hasattr(_cffi_backend, '__file__'): 6 py.test.skip("_cffi_backend module is built-in") 7 if not sys.platform.startswith('linux'): 8 py.test.skip("linux-only") 9 g = os.popen("objdump -T '%s'" % _cffi_backend.__file__, 'r') 10 for line in g: 11 if not line.startswith('0'): 12 continue 13 if line[line.find(' ') + 1] == 'l': 14 continue 15 if '*UND*' in line: 16 continue 17 name = line.split()[-1] 18 if name.startswith('_') or name.startswith('.'): 19 continue 20 if name not in ('init_cffi_backend', 'PyInit__cffi_backend'): 21 raise Exception("Unexpected exported name %r" % (name,)) 22 g.close() 23