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