]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix hardcoded constant in gdb.python/py-pp-maint.exp
authorTom de Vries <tdevries@suse.de>
Sat, 20 Sep 2025 12:48:57 +0000 (14:48 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 20 Sep 2025 12:48:57 +0000 (14:48 +0200)
In test-case gdb.python/py-pp-maint.exp, I came across:
...
gdb_test "disable pretty-printer global lookup_function_lookup_test" \
     "1 printer disabled.*[expr $num_pp - 1] of $num_pp printers enabled"

gdb_test "disable pretty-printer global pp-test;.*" \
    "[expr 5] printers disabled.*0 of $num_pp printers enabled"
...

The "[expr 5]" can simply be rewritten as "5", but instead use the construct
used in the previous gdb_test: [expr {$num_pp - 1}], given that the numbers
should match.

Tested on x86_64-linux.

gdb/testsuite/gdb.python/py-pp-maint.exp

index 74d8e76c6086a99ca377bac0f6aff4445e261a10..c87f30da975d1ae2442886901e44981379a9c1ec 100644 (file)
@@ -75,7 +75,7 @@ gdb_test "disable pretty-printer global lookup_function_lookup_test" \
     "1 printer disabled.*[expr $num_pp - 1] of $num_pp printers enabled"
 
 gdb_test "disable pretty-printer global pp-test;.*" \
-    "[expr 5] printers disabled.*0 of $num_pp printers enabled"
+    "[expr {$num_pp - 1}] printers disabled.*0 of $num_pp printers enabled"
 
 gdb_test "info pretty-printer global .*function" \
     {.*function_lookup_test \[disabled\].*} \