]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/tst-signal-numbers.py
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / tst-signal-numbers.py
CommitLineData
a8110b72
JM
1#!/usr/bin/python3
2# Test that glibc's signal numbers match the kernel's.
2b778ceb 3# Copyright (C) 2018-2021 Free Software Foundation, Inc.
a8110b72
JM
4# This file is part of the GNU C Library.
5#
6# The GNU C Library is free software; you can redistribute it and/or
7# modify it under the terms of the GNU Lesser General Public
8# License as published by the Free Software Foundation; either
9# version 2.1 of the License, or (at your option) any later version.
10#
11# The GNU C Library is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14# Lesser General Public License for more details.
15#
16# You should have received a copy of the GNU Lesser General Public
17# License along with the GNU C Library; if not, see
5a82c748 18# <https://www.gnu.org/licenses/>.
a8110b72
JM
19
20import argparse
21import sys
22
23import glibcextract
24
25
26def main():
27 """The main entry point."""
28 parser = argparse.ArgumentParser(
29 description="Test that glibc's signal numbers match the kernel's.")
30 parser.add_argument('--cc', metavar='CC',
31 help='C compiler (including options) to use')
32 args = parser.parse_args()
33 sys.exit(glibcextract.compare_macro_consts(
34 '#define _GNU_SOURCE 1\n'
35 '#include <signal.h>\n',
36 '#define _GNU_SOURCE 1\n'
37 '#include <stddef.h>\n'
38 '#include <asm/signal.h>\n',
39 args.cc,
40 # Filter out constants that aren't signal numbers.
41 'SIG[A-Z]+',
42 # Discard obsolete signal numbers and unrelated constants:
43 # SIGCLD, SIGIOT, SIGSWI, SIGUNUSED.
44 # SIGSTKSZ, SIGRTMIN, SIGRTMAX.
45 'SIG(CLD|IOT|RT(MIN|MAX)|STKSZ|SWI|UNUSED)'))
46
47if __name__ == '__main__':
48 main()