From: Tom de Vries Date: Sun, 17 Aug 2025 06:57:09 +0000 (+0200) Subject: [gdb/testsuite] Use regexp to match $_gdb_{major,minor} X-Git-Tag: gdb-17-branchpoint~275 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f28a89fd767ff58693b9d5af8e42e211168fae50;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Use regexp to match $_gdb_{major,minor} Every time we update the gdb version number, test-case gdb.base/default.exp needs updating because it matches the values of convenience variables $_gdb_{major,minor} using hardcoded expected values: ... {$_gdb_major = 17} \ {$_gdb_minor = 1} \ ... I'm assuming the values were hardcoded because gdb_test_list_exact was used. Since the previous patch, that's not longer the case, so use regexps instead, getting rid of this annoyance [1]. Tested on x86_64-linux. [1] https://sourceware.org/pipermail/gdb-patches/2019-October/160935.html --- diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 50fae7cd55f..d8571654ad9 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -766,8 +766,6 @@ set show_conv_list \ {$_gdb_maint_setting = } \ {$_gdb_setting_str = } \ {$_gdb_setting = } \ - {$_gdb_major = 17} \ - {$_gdb_minor = 1} \ {$_shell_exitsignal = void} \ {$_shell_exitcode = 0} \ {$_active_linker_namespaces = 1} \ @@ -812,6 +810,18 @@ if { [regexp "$re_var = $re_val" $lines] } { set all_found 0 } +set re_vars \ + [list \ + [string_to_regexp {$_gdb_major}] \ + [string_to_regexp {$_gdb_minor}]] +foreach re_var $re_vars { + if { [regexp "$re_var = $decimal" $lines] } { + incr matches + } else { + set all_found 0 + } +} + if { [regexp [string_to_regexp {$_tlb = void}] $lines] } { incr matches } else {