Fix test always passing in python/py-linetable.exp
authorSimon Marchi <simon.marchi@ericsson.com>
Wed, 26 Nov 2014 18:03:57 +0000 (13:03 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 27 Nov 2014 14:27:08 +0000 (09:27 -0500)
The following test is found in python/py-linetable.exp:

gdb_test "python print sorted(fset)" \
    "\[20L, 21L, 22L, 24L, 25L, 28L, 29L, 30L, 32L, 33L, 37L, 39L, 40L, 42L, 44L, 45L, 46L\].*" \
    "Test frozen set contains line numbers"

I noticed that it passed when using Python 3, even though it should fail
because of the missing parentheses for the call print.

There needs to be more escaping of the square brackets. Currently, it is
interpreted as "any one character from this big list of characters,
followed by .*". When adding the required amount of backslashes, the
test starts failing as it should.

Moreover, both in Python 2.7 and Python 3.3 the numbers don't have the L
suffix, so now the test fails because of that. Anybody knows why they
were there in the first place? I just tested with Python 2.4 and there
are no Ls.

gdb/testsuite/ChangeLog:

* gdb.python/py-linetable.exp: Escape properly sorted(fset)
test expected output.  Add parentheses for the call to print.
Remove L suffix from integers.

Signed-off-by: Simon Marchi <simon.marchi@ericsson.com>
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-linetable.exp

index a21e88ed310c2f2a1569ff8a936e312f4e82cd9e..16fa87d304e6cc5a074501ae5fc2355f835caaf3 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-27  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * gdb.python/py-linetable.exp: Escape properly sorted(fset)
+       test expected output.  Add parentheses for the call to print.
+       Remove L suffix from integers.
+
 2014-11-26  Doug Evans  <dje@google.com>
 
        * gdb.dwarf2/dw2-op-out-param.S: Fix comment.
index 682b5b7e84e8936f7e636ec645a0f8669077ccd1..2f24ab4dee7055b7348226a1987d71d051530cb1 100644 (file)
@@ -60,8 +60,8 @@ gdb_test "python print lt.line(1)" "None" \
 # Test gdb.Linetable.sourcelines ()
 gdb_py_test_silent_cmd "python fset = lt.source_lines()" \
     "Get all source lines into a frozen set" 0
-gdb_test "python print sorted(fset)" \
-    "\[20L, 21L, 22L, 24L, 25L, 28L, 29L, 30L, 32L, 33L, 37L, 39L, 40L, 42L, 44L, 45L, 46L\].*" \
+gdb_test "python print (sorted(fset))" \
+    "\\\[20, 21, 22, 24, 25, 28, 29, 30, 32, 33, 37, 39, 40, 42, 44, 45, 46\\\].*" \
     "Test frozen set contains line numbers"
 
 # Test gdb.Linetable.has_line ()
This page took 0.030496 seconds and 4 git commands to generate.