]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/generate-sym-test.py
Merge pull request #12431 from poettering/tmpfiles-chmod-chown-order
[thirdparty/systemd.git] / src / test / generate-sym-test.py
1 #!/usr/bin/env python3
2 import sys, re
3
4 print('#include <stdio.h>')
5 for header in sys.argv[2:]:
6 print('#include "{}"'.format(header.split('/')[-1]))
7
8 print('''
9 const void* symbols[] = {''')
10
11 for line in open(sys.argv[1]):
12 match = re.search('^ +([a-zA-Z0-9_]+);', line)
13 if match:
14 s = match.group(1)
15 if s == 'sd_bus_object_vtable_format':
16 print(' &{},'.format(s))
17 else:
18 print(' {},'.format(s))
19
20 print('''};
21
22 int main(void) {
23 unsigned i;
24 for (i = 0; i < sizeof(symbols)/sizeof(void*); i++)
25 printf("%p\\n", symbols[i]);
26 return 0;
27 }''')