linux: Return unsupported if procfs can not be mount on tst-ttyname-namespace
[glibc.git] / nptl / test-condattr-printers.py
blob940fd727d8dbda1d4c0e894a43ce29731817bd03
1 # Common tests for the ConditionVariablePrinter and
2 # ConditionVariableAttributesPrinter classes.
4 # Copyright (C) 2016-2023 Free Software Foundation, Inc.
5 # This file is part of the GNU C Library.
7 # The GNU C Library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # The GNU C Library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with the GNU C Library; if not, see
19 # <https://www.gnu.org/licenses/>.
21 import sys
23 from test_printers_common import *
25 test_source = sys.argv[1]
26 test_bin = sys.argv[2]
27 printer_files = sys.argv[3:]
28 printer_names = ['global glibc-pthread-locks']
30 try:
31 init_test(test_bin, printer_files, printer_names)
32 go_to_main()
34 check_debug_symbol('struct pthread_condattr')
36 condvar_var = 'condvar'
37 condvar_to_string = 'pthread_cond_t'
39 attr_var = 'attr'
40 attr_to_string = 'pthread_condattr_t'
42 break_at(test_source, 'Set clock')
43 continue_cmd() # Go to test_setclock
44 next_cmd(2)
45 test_printer(condvar_var, condvar_to_string, {'Clock ID': 'CLOCK_REALTIME'})
46 test_printer(attr_var, attr_to_string, {'Clock ID': 'CLOCK_REALTIME'})
48 break_at(test_source, 'Set shared')
49 continue_cmd() # Go to test_setpshared
50 next_cmd(2)
51 test_printer(condvar_var, condvar_to_string, {'Shared': 'Yes'})
52 test_printer(attr_var, attr_to_string, {'Shared': 'Yes'})
53 next_cmd(2)
54 test_printer(condvar_var, condvar_to_string, {'Shared': 'No'})
55 test_printer(attr_var, attr_to_string, {'Shared': 'No'})
57 continue_cmd() # Exit
59 except (NoLineError, pexpect.TIMEOUT) as exception:
60 print('Error: {0}'.format(exception))
61 result = FAIL
63 except DebugError as exception:
64 print(exception)
65 result = UNSUPPORTED
67 else:
68 print('Test succeeded.')
69 result = PASS
71 exit(result)