]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: clean ups in gdb.python/py-source-styling.exp
authorAndrew Burgess <aburgess@redhat.com>
Thu, 13 Feb 2025 16:43:39 +0000 (16:43 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 14 Feb 2025 21:12:32 +0000 (21:12 +0000)
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 <tom@tromey.com>
gdb/testsuite/gdb.python/py-source-styling.exp

index 7b5c1b0e3384e10d6026053c3764232ce918f4de..a40677181ce5a3494b8e2820eaea7297a6ba2544 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# 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
        }
     }
 }