1 # Common tests for the ConditionVariablePrinter and
2 # ConditionVariableAttributesPrinter classes.
4 # Copyright (C) 2016-2022 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/>.
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']
31 init_test(test_bin
, printer_files
, printer_names
)
34 check_debug_symbol('struct pthread_condattr')
36 condvar_var
= 'condvar'
37 condvar_to_string
= 'pthread_cond_t'
40 attr_to_string
= 'pthread_condattr_t'
42 break_at(test_source
, 'Set clock')
43 continue_cmd() # Go to test_setclock
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
51 test_printer(condvar_var
, condvar_to_string
, {'Shared': 'Yes'})
52 test_printer(attr_var
, attr_to_string
, {'Shared': 'Yes'})
54 test_printer(condvar_var
, condvar_to_string
, {'Shared': 'No'})
55 test_printer(attr_var
, attr_to_string
, {'Shared': 'No'})
59 except (NoLineError
, pexpect
.TIMEOUT
) as exception
:
60 print('Error: {0}'.format(exception
))
63 except DebugError
as exception
:
68 print('Test succeeded.')