Update kernel version to 6.6 in header constant tests
[glibc.git] / sysdeps / unix / sysv / linux / tst-pidfd-consts.py
blob4a0f757a21d4d0d78dcb1f74b1b7cf45eeb95a14
1 #!/usr/bin/python3
2 # Test that glibc's sys/pidfd.h constants match the kernel's.
3 # Copyright (C) 2022-2023 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
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.
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.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with the GNU C Library; if not, see
18 # <https://www.gnu.org/licenses/>.
20 import argparse
21 import sys
23 import glibcextract
24 import glibcsyscalls
27 def main():
28 """The main entry point."""
29 parser = argparse.ArgumentParser(
30 description="Test that glibc's sys/pidfd.h constants "
31 "match the kernel's.")
32 parser.add_argument('--cc', metavar='CC',
33 help='C compiler (including options) to use')
34 args = parser.parse_args()
36 if glibcextract.compile_c_snippet(
37 '#include <linux/pidfd.h>',
38 args.cc).returncode != 0:
39 sys.exit (77)
41 linux_version_headers = glibcsyscalls.linux_kernel_version(args.cc)
42 linux_version_glibc = (6, 6)
43 sys.exit(glibcextract.compare_macro_consts(
44 '#include <sys/pidfd.h>\n',
45 '#include <asm/fcntl.h>\n'
46 '#include <linux/pidfd.h>\n',
47 args.cc,
48 'PIDFD_.*',
49 None,
50 linux_version_glibc > linux_version_headers,
51 linux_version_headers > linux_version_glibc))
53 if __name__ == '__main__':
54 main()