File: test_cffi_binary.py

package info (click to toggle)
python-cffi 1.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,440 kB
  • ctags: 4,423
  • sloc: python: 25,052; ansic: 12,528; asm: 116; makefile: 97; sh: 28
file content (20 lines) | stat: -rw-r--r-- 720 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import py, sys, os
import _cffi_backend

def test_no_unknown_exported_symbols():
    if not hasattr(_cffi_backend, '__file__'):
        py.test.skip("_cffi_backend module is built-in")
    if not sys.platform.startswith('linux'):
        py.test.skip("linux-only")
    g = os.popen("objdump -T '%s'" % _cffi_backend.__file__, 'r')
    for line in g:
        if not line.startswith('0'):
            continue
        if '*UND*' in line:
            continue
        name = line.split()[-1]
        if name.startswith('_') or name.startswith('.'):
            continue
        if name not in ('init_cffi_backend', 'PyInit__cffi_backend'):
            raise Exception("Unexpected exported name %r" % (name,))
    g.close()