]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix failure in gdb.python/py-startup-opt.exp
authorTom de Vries <tdevries@suse.de>
Wed, 4 Dec 2024 09:21:00 +0000 (10:21 +0100)
committerTom de Vries <tdevries@suse.de>
Wed, 4 Dec 2024 09:21:00 +0000 (10:21 +0100)
In commit 922ab963e1c ("[gdb/python] Handle empty PYTHONDONTWRITEBYTECODE") I
added a test in gdb.python/py-startup-opt.exp that checks the
"show python dont-write-bytecode" output.

Then in commit 348290c7ef4 ("[gdb/python] Warn and ignore ineffective python
settings") I changed the output of "show python dont-write-bytecode" after
python initialization.

I tested these changes individually, and found no problems but after
committing both the test started failing, which the Linaro CI reported.

Fix this by updating the expected output.

While we're at it, make the test a bit more generic by testing
"show python $setting" in all cases.

Tested on x86_64-linux, using:
- PYTHONDONTWRITEBYTECODE=
- PYTHONDONTWRITEBYTECODE=1
- unset PYTHONDONTWRITEBYTECODE

gdb/testsuite/gdb.python/py-startup-opt.exp

index df35a37865828993decf0e6b3d94f0f3d65b3ef3..038814a1d63b6826ead27dbca215b8fce204c1c6 100644 (file)
@@ -94,13 +94,15 @@ proc test_python_settings { exp_state } {
            "  print (\"${attr} is off\")" "" \
            "end" "${attr} is ${answer}"
 
-       if { $attr == "dont_write_bytecode" && $exp_state == "off" } {
+       if { $attr == "dont_write_bytecode" } {
            set setting dont-write-bytecode
-           set show_setting \
-               "Python's $setting setting is auto (currently $answer)."
-           gdb_test "show python $setting" \
-               [string_to_regexp $show_setting]
+       } else {
+           set setting ignore-environment
        }
+       set show_setting \
+           "Python's $setting setting is $answer."
+       gdb_test "show python $setting" \
+           [string_to_regexp $show_setting]
     }
 
     gdb_exit