public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix python.exp with check-read1
@ 2019-07-29 13:07 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-07-29 13:07 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5beafce944b6b200d1fa80d7f4a8656cb2ecf2fa

commit 5beafce944b6b200d1fa80d7f4a8656cb2ecf2fa
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Jul 29 15:07:47 2019 +0200

    [gdb/testsuite] Fix python.exp with check-read1
    
    when running python/python.exp with check-read1, we get:
    ...
    (gdb) PASS: gdb.python/python.exp: prompt substitution readline - end
    python gdb.prompt_hook = error_prompt^M
    Python Exception <type 'exceptions.RuntimeError'> Python exception calledPASS: gdb.python/python.exp: set hook
    : ^M
    (gdb) PASS: gdb.python/python.exp: set the hook to default
    python gdb.prompt_hook = None^M
    (gdb) PASS: gdb.python/python.exp: set print-stack full for prompt error test
    set python print-stack full^M
    (gdb) FAIL: gdb.python/python.exp: set the hook
    python gdb.prompt_hook = error_prompt^M
    Traceback (most recent call last):^M
      File "<string>", line 3, in error_prompt^M
    RuntimeError: Python exception called^M
    (gdb) FAIL: gdb.python/python.exp: set the hook to default
    ...
    
    The problem is that gdb_test_multiple here:
    ...
    gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
        -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python excepti
    on called.*" {
           pass "set hook"
        }
    }
    ...
    specifies a regexp that ends with ".*" but doesn't specify the expected
    $gdb_prompt.
    
    Consequently, due to check-read1, the ".*" is matched to "" and the remaining
    $gdb_prompt  is read by the the following gdb_py_test_silent_cmd, which has
    its own $gdb_prompt read by the following gdb_py_test_silent_cmd, which has
    its own $gdb_prompt causing a mismatch for the following gdb_test_multiple:
    ...
    gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
        -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" {
            pass "set hook"
        }
    }
    ...
    which causes both FAILs.
    
    The second gdb_test_multiple has the same problem as the first, but it happens
    not to cause a FAIL because it's followed by a gdb_py_test_silent_cmd and a
    clean_restart.
    
    Fix the regexps in both gdb_test_multiple calls.
    
    Tested on x86_64-linux.
    
    gdb/testsuite/ChangeLog:
    
    2019-07-29  Tom de Vries  <tdevries@suse.de>
    
    	* gdb.python/python.exp: Don't terminate gdb_test_multiple regexp
    	with ".*".

Diff:
---
 gdb/testsuite/ChangeLog             | 5 +++++
 gdb/testsuite/gdb.python/python.exp | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 96ced4e..c2f9d66 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2019-07-29  Tom de Vries  <tdevries@suse.de>
 
+	* gdb.python/python.exp: Don't terminate gdb_test_multiple regexp
+	with ".*".
+
+2019-07-29  Tom de Vries  <tdevries@suse.de>
+
 	* lib/gdb.exp (skip_libstdcxx_probe_tests_prompt, gdb_is_target_1):
 	Pass prompt_regexp parameter to gdb_test_multiple calls.
 
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 3b5d1a4..fe55234 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -453,7 +453,7 @@ gdb_py_test_multiple "prompt substitution readline" \
   "end" ""
 
 gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
-    -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*" {
+    -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*$gdb_prompt $" {
 	pass "set hook"
     }
 }
@@ -465,7 +465,7 @@ gdb_py_test_silent_cmd "set python print-stack full" \
     "set print-stack full for prompt error test" 1
 
 gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" {
-    -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*" {
+    -re "Traceback.*File.*line.*RuntimeError.*Python exception called.*$gdb_prompt $" {
 	pass "set hook"
     }
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-29 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 13:07 [binutils-gdb] [gdb/testsuite] Fix python.exp with check-read1 Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).