From: Andrew Burgess Date: Thu, 13 Feb 2025 16:43:39 +0000 (+0000) Subject: gdb/testsuite: clean ups in gdb.python/py-source-styling.exp X-Git-Tag: binutils-2_45~1580 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9764ef043b1dabe86f0445dd31b3df3a369ae41;p=thirdparty%2Fbinutils-gdb.git gdb/testsuite: clean ups in gdb.python/py-source-styling.exp The top comment in gdb.python/py-source-styling.exp was completely wrong, clearly a cut&paste job from elsewhere. Write a comment that actually reflects what the test does. I've also moved the allow_python_tests check earlier in the file. And I changed some 'return -1' into just 'return'. I'm not aware that the '-1' adds any value. I also folded a 'pass $gdb_test_name' into the preceding gdb_assert, which I think is neater. There is no change in what is actually being tested after this commit. Approved-By: Tom Tromey --- diff --git a/gdb/testsuite/gdb.python/py-source-styling.exp b/gdb/testsuite/gdb.python/py-source-styling.exp index 7b5c1b0e338..a40677181ce 100644 --- a/gdb/testsuite/gdb.python/py-source-styling.exp +++ b/gdb/testsuite/gdb.python/py-source-styling.exp @@ -13,8 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# This file is part of the GDB testsuite. It checks for memory leaks -# associated with allocating and deallocation gdb.Inferior objects. +# Check that the Python pygments module can be used for source +# highlighting when GNU source highlight is not available (or is +# disabled, as is done in this test). + +require allow_python_tests load_lib gdb-python.exp @@ -26,14 +29,12 @@ with_ansi_styling_terminal { # capable, otherwise we'll get a UnicodeEncodeError trying to # encode the output. if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { - return -1 + return } - if { ![allow_python_tests] } { continue } - if { ![gdb_py_module_available "pygments"] } { unsupported "pygments module not available" - return -1 + return } if ![runto_main] { @@ -55,8 +56,7 @@ with_ansi_styling_terminal { exp_continue } -re "$gdb_prompt $" { - gdb_assert { $seen_style_escape } - pass $gdb_test_name + gdb_assert { $seen_style_escape } $gdb_test_name } } }