Skip to content

Commit 9686686

Browse files
committed
test: fix Windows CI by rewriting symbols-leak-test from bash to python
The CI started installing some wrapper instead of a real bash which is what gets found. See: actions/runner-images#1081 Given meson is written in python, it should always be available hopefully. Signed-off-by: Ran Benita <[email protected]>
1 parent bb638b5 commit 9686686

File tree

3 files changed

+64
-20
lines changed

3 files changed

+64
-20
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ test(
478478
)
479479
test(
480480
'symbols-leak-test',
481-
find_program('test/symbols-leak-test.bash'),
481+
find_program('test/symbols-leak-test.py'),
482482
env: test_env,
483483
)
484484
if get_option('enable-x11')

test/symbols-leak-test.bash

Lines changed: 0 additions & 19 deletions
This file was deleted.

test/symbols-leak-test.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env python3
2+
"""Check that all exported symbols are specified in the symbol version scripts.
3+
4+
If this fails, please update the appropriate .map file (adding new version
5+
nodes as needed).
6+
"""
7+
import glob
8+
import os
9+
import pathlib
10+
import re
11+
import sys
12+
13+
14+
top_srcdir = pathlib.Path(os.environ['top_srcdir'])
15+
16+
17+
def symbols_from_map(path):
18+
return re.findall(r'^\s+(xkb_.*);', path.read_text(), re.MULTILINE)
19+
20+
21+
def symbols_from_src(path):
22+
return re.findall(r'XKB_EXPORT.*\n(xkb_.*)\(', path.read_text())
23+
24+
25+
def diff(map_path, src_paths):
26+
map_symbols = set(symbols_from_map(map_path))
27+
src_symbols = set.union(set(), *(symbols_from_src(path) for path in src_paths))
28+
return sorted(map_symbols - src_symbols), sorted(src_symbols - map_symbols)
29+
30+
31+
exit = 0
32+
33+
# xkbcommon symbols
34+
left, right = diff(
35+
top_srcdir/'xkbcommon.map',
36+
[
37+
*(top_srcdir/'src').glob('*.c'),
38+
*(top_srcdir/'src'/'xkbcomp').glob('*.c'),
39+
*(top_srcdir/'src'/'compose').glob('*.c'),
40+
],
41+
)
42+
if left:
43+
print('xkbcommon map has extra symbols:', ' '.join(left))
44+
exit = 1
45+
if right:
46+
print('xkbcommon src has extra symbols:', ' '.join(right))
47+
exit = 1
48+
49+
# xkbcommon-x11 symbols
50+
left, right = diff(
51+
top_srcdir/'xkbcommon-x11.map',
52+
[
53+
*(top_srcdir/'src'/'x11').glob('*.c'),
54+
],
55+
)
56+
if left:
57+
print('xkbcommon-x11 map has extra symbols:', ' '.join(left))
58+
exit = 1
59+
if right:
60+
print('xkbcommon-x11 src has extra symbols:', ' '.join(right))
61+
exit = 1
62+
63+
sys.exit(exit)

0 commit comments

Comments
 (0)