Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / clztest.exp
blobb1293b00ee2911ec8c217261a9b2d073dc5658fc
1 # Copyright 2011-2024 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 load_lib dwarf.exp
18 standard_testfile .S
19 set test "clztest"
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 require dwarf2_support
24 # This test can only be run on x86-64 targets.
25 require is_x86_64_m64_target
27 if { [prepare_for_testing "failed to prepare" "${test}" ${test}.S \
28       {nodebug nopie additional_flags=-nostdlib}] } {
29     return -1
32 if ![runto_main] {
33     return -1
36 # Initialize tests to be an empty array.
37 unset -nocomplain tests
38 array set tests {}
40 proc gdb-test {line var value} {
41     global tests
43     lappend tests($line) [list $var $value 0]
46 proc xfail-gdb-test {line var value} {
47     global tests
49     lappend tests($line) [list $var $value 1]
52 proc scan_gdb_tests {} {
53     global srcdir subdir test
55     set file "$srcdir/$subdir/$test.c"
57     set fd [open "$file"]
58     while {![eof $fd]} {
59         set line [gets $fd]
60         if {! [regexp "\{ (gdb-test .+) \} \}" $line ignore test_cmd]} {
61             continue
62         }
64         eval $test_cmd
65     }
66     close $fd
69 scan_gdb_tests
71 foreach line [lsort [array names tests]] {
72     gdb_test "break ${test}.c:$line" "Breakpoint .*" \
73         "set breakpoint at ${test}.c:$line"
74     gdb_continue_to_breakpoint "continue to ${test}.c:$line"
76     foreach testvec $tests($line) {
77         set var [lindex $testvec 0]
78         set value [lindex $testvec 1]
79         set should_xfail [lindex $testvec 2]
81         if {$should_xfail} {
82             setup_xfail *-*-*
83         }
85         gdb_test "print $var" \
86             " = $value" \
87             "check value of $var at ${test}.c:$line"
88     }