]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Use regexp to match $_gdb_{major,minor}
authorTom de Vries <tdevries@suse.de>
Sun, 17 Aug 2025 06:57:09 +0000 (08:57 +0200)
committerTom de Vries <tdevries@suse.de>
Sun, 17 Aug 2025 06:57:09 +0000 (08:57 +0200)
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

gdb/testsuite/gdb.base/default.exp

index 50fae7cd55ff36805039434571aee3f1351dfb14..d8571654ad9e106572d3c57a860d3cd952779a8c 100644 (file)
@@ -766,8 +766,6 @@ set show_conv_list \
        {$_gdb_maint_setting = <internal function _gdb_maint_setting>} \
        {$_gdb_setting_str = <internal function _gdb_setting_str>} \
        {$_gdb_setting = <internal function _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 {