Skip to content

Commit

Permalink
[gdb/testsuite] Simplify gdb.base/info-types.exp.tcl
Browse files Browse the repository at this point in the history
The regexp matching state machine in gdb.base/info-types.exp.tcl handles
"File .*:" lines individually.  Now that we do line-by-line matching, that's
no longer necessary.

Simplify accordingly.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-06-07  Tom de Vries  <tdevries@suse.de>

	* gdb.base/info-types.exp.tcl: Remove "File .*" matching from regexp
	matching state machine.
  • Loading branch information
vries committed Jun 7, 2021
1 parent bc37aac commit 409cac3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
5 changes: 5 additions & 0 deletions gdb/testsuite/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2021-06-07 Tom de Vries <tdevries@suse.de>

* gdb.base/info-types.exp.tcl: Remove "File .*" matching from regexp
matching state machine.

2021-06-07 Tom de Vries <tdevries@suse.de>

* gdb.base/new-ui-pending-input.exp
Expand Down
20 changes: 8 additions & 12 deletions gdb/testsuite/gdb.base/info-types.exp.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ proc run_test { lang } {
return 0
}

set file_re "File .*[string_to_regexp $srcfile]:"

if { $lang == "c++" } {
set output_lines \
[list \
$file_re \
"98:\[\t \]+CL;" \
"42:\[\t \]+anon_struct_t;" \
"65:\[\t \]+anon_union_t;" \
Expand Down Expand Up @@ -126,6 +129,7 @@ proc run_test { lang } {
} else {
set output_lines \
[list \
$file_re \
"52:\[\t \]+typedef enum {\\.\\.\\.} anon_enum_t;" \
"45:\[\t \]+typedef struct {\\.\\.\\.} anon_struct_t;" \
"68:\[\t \]+typedef union {\\.\\.\\.} anon_union_t;" \
Expand Down Expand Up @@ -160,28 +164,20 @@ proc run_test { lang } {
if { $state == 0 } { set state 1 } else { set state -1 }
exp_continue
}
-re "^\r\nFile .*[string_to_regexp $srcfile]:" {
if { $state == 1 } { set state 2 } else { set state -2 }
exp_continue
}
-re "^\r\nFile \[^\r\n\]*:" {
if { $state == 2 } { set state -4 }
exp_continue
}
-re "^\r\n(\[^\r\n\]*)(?=\r\n)" {
if { $state == 2 } {
if { $state == 1 } {
set line $expect_out(1,string)
set res [match_line $line $output_lines idx]
if { $res == 1 } {
set state 3
set state 2
} elseif { $res == -1 } {
set state -3
set state -2
}
}
exp_continue
}
-re -wrap "" {
if { $state == 3} {
if { $state == 2} {
pass $gdb_test_name
} else {
fail "$gdb_test_name (state == $state)"
Expand Down

0 comments on commit 409cac3

Please sign in to comment.