Hash :
f0b1441f
Author :
Date :
2020-07-23T08:49:54
test: make the symbols-leak-test executable Python leaks like crazy when run under valgrind. But if we make the script executable **and** it has uses the env invocation (i.e. #!/usr/bin/env python3), the leaks disappear. This is not the case for a shebang of /usr/bin/python3. Why exactly this is the case I'm not sure but executables we plan to run should have the exec bit set. So this is a janitor patch with the nice side effect of fixing our valgrind runs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
#!/usr/bin/env python3
"""Check that all exported symbols are specified in the symbol version scripts.
If this fails, please update the appropriate .map file (adding new version
nodes as needed).
"""
import os
import pathlib
import re
import sys
top_srcdir = pathlib.Path(os.environ['top_srcdir'])
def symbols_from_map(path):
return re.findall(r'^\s+(xkb_.*);', path.read_text('utf-8'), re.MULTILINE)
def symbols_from_src(path):
return re.findall(r'XKB_EXPORT.*\n(xkb_.*)\(', path.read_text('utf-8'))
def diff(map_path, src_paths):
map_symbols = set(symbols_from_map(map_path))
src_symbols = set.union(set(), *(symbols_from_src(path) for path in src_paths))
return sorted(map_symbols - src_symbols), sorted(src_symbols - map_symbols)
exit = 0
# xkbcommon symbols
left, right = diff(
top_srcdir/'xkbcommon.map',
[
*(top_srcdir/'src').glob('*.c'),
*(top_srcdir/'src'/'xkbcomp').glob('*.c'),
*(top_srcdir/'src'/'compose').glob('*.c'),
],
)
if left:
print('xkbcommon map has extra symbols:', ' '.join(left))
exit = 1
if right:
print('xkbcommon src has extra symbols:', ' '.join(right))
exit = 1
# xkbcommon-x11 symbols
left, right = diff(
top_srcdir/'xkbcommon-x11.map',
[
*(top_srcdir/'src'/'x11').glob('*.c'),
],
)
if left:
print('xkbcommon-x11 map has extra symbols:', ' '.join(left))
exit = 1
if right:
print('xkbcommon-x11 src has extra symbols:', ' '.join(right))
exit = 1
sys.exit(exit)