From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailsec109.isp.belgacom.be (mailsec109.isp.belgacom.be [195.238.20.105]) by sourceware.org (Postfix) with ESMTPS id 4F3CF3972452 for ; Tue, 23 Jun 2020 20:52:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4F3CF3972452 IronPort-SDR: gmiWgW+ygTDg0QLGAYab+jMRm2JqGPZWSYNDNpdqxLC/FzNv1rBrjfaa1eOECrlF7cEqlvBq6Z RLR76PL/+1RDZgUHTYXkPCVQSUcmEIb92v0ktuK5OQSCFii3g5ut9gcIFgyixnwSALINS2kizD 7TzVt+OcCe/VKufZnflYKzU9GJb2wFbEm/+KKQ8uNhzvd7j0F5H1sja6UNp8HIm8Cjv3i1meVT /z7xuDWf2J6VgtGwsTCbKWRv45TGYuC3EEovkJz4HqYR88b8vJSPcBWl4cUBLhE9K1SltxjAok Il8= IronPort-PHdr: =?us-ascii?q?9a23=3AqEFXXhy453kCvX3XCy+O+j09IxM/srCxBDY+r6?= =?us-ascii?q?Qd2u4VIJqq85mqBkHD//Il1AaPAdyGrasU1qGP6f2ocFdDyK7JiGoFfp1IWk?= =?us-ascii?q?1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBA?= =?us-ascii?q?j0OxZrKeTpAI7SiNm82/yv95HJbAhEmTqwbalvIBi1rQjdudQajZViJ60s1h?= =?us-ascii?q?bHv3xEdvhMy2h1P1yThRH85smx/J5n7Stdvu8q+tBDX6vnYak2VKRUAzs6PW?= =?us-ascii?q?874s3rrgTDQhCU5nQASGUWkwFHDBbD4RrnQ5r+qCr6tu562CmHIc37SK0/VD?= =?us-ascii?q?q+46t3ThLjlSEKPCM7/m7KkMx9lKJVrgy8qRJxwIDaZ46aOvVlc6/Bft4XX3?= =?us-ascii?q?ZNU9xNWyBdBI63cosBD/AGPeZdt4TzvVsOrRq6BQmtHOPv0iFHjWL20qIgye?= =?us-ascii?q?QhFhjG3BEhH90QqnTUt8j+OaAKUeC1zanIyTTDb+tO2Tjj8oTJfAouoeuLXb?= =?us-ascii?q?JpbMrRyFcgFxnejliLsozlPDOU1uITvGiH9eZvTvyghnchpgpsrTeh2t0ihZ?= =?us-ascii?q?PVhoIJ1F/E7yN5zZ42KNC3VEJ3f8KoHYVfuiyYN4V7TM0sT31ntig1xbAIt4?= =?us-ascii?q?C3ciYUxZkl2xLSafOJfomW7x/+SOqcIyt1in1qdb6igRu57EuuyvXkW8WqzV?= =?us-ascii?q?pHrDBJnsTCu30MzRDe6dWLRuFz80qv3zuEyhrd5fteIU8ukKrWM5shwrktmZ?= =?us-ascii?q?UNqUnDBSr2mFnujK+Ra0Uk5vCk6+T5bbXioZ+RL4p0hRzkPqQuncy/BPo3Ph?= =?us-ascii?q?APX2id5+u8yKXu8VPkTLhIlPE6j6fUvZHAKckYu6K1GQFY34g75xa6FTim0d?= =?us-ascii?q?AYnXcdLFJCfRKKl5DpO1HPIPD8DPe/m0ysnylxy/HIJLLhGJLNLmHekLfgY7?= =?us-ascii?q?l98VVcxREozdBc55NUDK8OIO7pVkDqqtPUFgU5PBCsw+b7FNV90ZsTWW2SDa?= =?us-ascii?q?CCKa/SqUWH5v4zLOmMeoAVoy3wK+Mi5/7zl382hUESfKez0psNdn+0BPNmI1?= =?us-ascii?q?+WYXD0mNcODX8KvhYiTOztkFCCST5TZ3e2X6I9/jE7EJypAZ3NR4+3mryB2z?= =?us-ascii?q?67HoBXZm9YEFCMCmzld56HW/YMbiKdPNNhniYfWre/GMcd0kShuAW/07N7Je?= =?us-ascii?q?rZ4QUDso/539Vq7vfe0xYo+m9aFcOYhlmNTmV1hnsFDwA/xqdmvE1w0EzLhb?= =?us-ascii?q?B4gvhZDcReoexASAAjKJ/R1fdSENPjXA/dON2EHgX1Cu66CC08G4pii+QFZF?= =?us-ascii?q?xwTo2v?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2BZBADHavJe/yFRiNlmHgEBCxIMR4E?= =?us-ascii?q?4C4F7gR5UX40lhX2SEot9CwEBAQEBAQEBAQgbEQECBAEBhEeCFiU3Bg4CAwE?= =?us-ascii?q?BAQMCBQEBBgEBAQEBAQUEAYYOOQyCOyKDTgEjI0+BAoJbSwGDALl2hVGDOIF?= =?us-ascii?q?AgTiHdoR8gUw/gRABgmKBeokjBI8XiXObKigHgl2BBwQLhy2QWQ8ghAmacQG?= =?us-ascii?q?FPaYhhESBaYF5bYM8CUcZDZd0hHNCMDcCBggBAQMJVwEiAY9hAQE?= X-IPAS-Result: =?us-ascii?q?A2BZBADHavJe/yFRiNlmHgEBCxIMR4E4C4F7gR5UX40lh?= =?us-ascii?q?X2SEot9CwEBAQEBAQEBAQgbEQECBAEBhEeCFiU3Bg4CAwEBAQMCBQEBBgEBA?= =?us-ascii?q?QEBAQUEAYYOOQyCOyKDTgEjI0+BAoJbSwGDALl2hVGDOIFAgTiHdoR8gUw/g?= =?us-ascii?q?RABgmKBeokjBI8XiXObKigHgl2BBwQLhy2QWQ8ghAmacQGFPaYhhESBaYF5b?= =?us-ascii?q?YM8CUcZDZd0hHNCMDcCBggBAQMJVwEiAY9hAQE?= Received: from 33.81-136-217.adsl-dyn.isp.belgacom.be (HELO md.home) ([217.136.81.33]) by relay.skynet.be with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 23 Jun 2020 22:52:04 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Subject: [RFA] Make test names unique in python.exp and guile.exp Date: Tue, 23 Jun 2020 22:51:59 +0200 Message-Id: <20200623205159.23461-1-philippe.waroquiers@skynet.be> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2020 20:52:07 -0000 Note that gdb_test_multiline and gdb_py_test_multiple are using the "input line" as the test name, and so when there is a duplicated input line (such as a line containing "end"), we have duplicated test names => as gdb_test_multiline and gdb_py_test_multiple are identical, as indicated in FIXME, move this to gdb.exp, and make the test name unique by adding the inputnr to the pass message for each input. YYYY-MM-DD Philippe Waroquiers * lib/gdb.exp (gdb_test_multiline): New, moved from gdb-guile.exp, have a seq nr in each pass message. * lib/gdb-guile.exp (gdb_test_multiline): Move to gdb.exp. * lib/gdb-python.exp (gdb_py_test_multiple): Remove. * gdb.python/python.exp: Make test names unique, use gdb_test_multiline instead of gdb_py_test_multiple. * gdb.guile/guile.exp: Make test names unique. --- gdb/testsuite/gdb.python/python.exp | 50 ++++++++++++++--------------- gdb/testsuite/lib/gdb-guile.exp | 20 ------------ gdb/testsuite/lib/gdb-python.exp | 19 ----------- gdb/testsuite/lib/gdb.exp | 22 +++++++++++++ 4 files changed, 47 insertions(+), 64 deletions(-) diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index a751787b26..8efecd8655 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -46,7 +46,7 @@ gdb_test_multiple "python print (23)" "verify python support" { "source source2.py when python disabled" # Verify multi-line python commands cause an error. - gdb_py_test_multiple "multi-line python command" \ + gdb_test_multiline "multi-line python command" \ "python" "" \ "print (23)" "" \ "end" "not supported.*" @@ -56,7 +56,7 @@ gdb_test_multiple "python print (23)" "verify python support" { -re "$gdb_prompt $" {} } -gdb_py_test_multiple "multi-line python command" \ +gdb_test_multiline "multi-line python command" \ "python" "" \ "print (23)" "" \ "end" "23" @@ -77,15 +77,15 @@ with_test_prefix "python interactive help" { } } -gdb_py_test_multiple "show python command" \ +gdb_test_multiline "show python command" \ "define zzq" "Type commands for definition of .* just \"end\"\\.*" \ "python" "" \ "print (23)" "" \ - "end" "" \ + " end" "" \ "end" "" \ "show user zzq" "User command \"zzq\":.* python.*print \\(23\\).* end" -gdb_py_test_multiple "indented multi-line python command" \ +gdb_test_multiline "indented multi-line python command" \ "python" "" \ "def foo ():" "" \ " print ('hello, world!')" "" \ @@ -124,7 +124,7 @@ gdb_test "python gdb.execute('echo 2\\necho 3\\\\n\\n')" "23" \ gdb_test " " "23" "gdb.execute does not affect repeat history" # Test post_event. -gdb_py_test_multiple "post event insertion" \ +gdb_test_multiline "post event insertion" \ "python" "" \ "someVal = 0" "" \ "class Foo(object):" "" \ @@ -194,7 +194,7 @@ gdb_test "python print (a)" ".*aliases -- User-defined aliases of other commands gdb_py_test_silent_cmd "python nothread = gdb.selected_thread()" "Attempt to aquire thread with no inferior" 1 gdb_test "python print (nothread == None)" "True" "ensure that no threads are returned" -gdb_py_test_multiple "register atexit function" \ +gdb_test_multiline "register atexit function" \ "python" "" \ "import atexit" "" \ "def printit(arg):" "" \ @@ -229,10 +229,10 @@ runto $lineno gdb_test "python gdb.decode_line(\"main.c:43\")" \ "gdb.error: No source file named main.c.*" "test decode_line no source named main" -gdb_py_test_silent_cmd "python symtab = gdb.decode_line()" "test decode_line current location" 1 -gdb_test "python print (len(symtab))" "2" "test decode_line current location" -gdb_test "python print (symtab\[0\])" "None" "test decode_line expression parse" -gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line current location" +gdb_py_test_silent_cmd "python symtab = gdb.decode_line()" "test decode_line current location =" 1 +gdb_test "python print (len(symtab))" "2" "test decode_line current location len" +gdb_test "python print (symtab\[0\])" "None" "test decode_line expression parse None" +gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line current location len 1" # Test that decode_line with an empty string argument does not crash. gdb_py_test_silent_cmd "python symtab2 = gdb.decode_line('')" \ @@ -246,18 +246,18 @@ if { [is_remote host] } { gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "test decode_line current location filename" gdb_test "python print (symtab\[1\]\[0\].line)" "$lineno" "test decode_line current location line number" -gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"python.c:26 if foo\")" "test decode_line python.c:26" 1 -gdb_test "python print (len(symtab))" "2" "test decode_line python.c:26 length" +gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"python.c:26 if foo\")" "test decode_line python.c:26 decode" 1 +gdb_test "python print (len(symtab))" "2" "test decode_line python.c:26 length 2" gdb_test "python print (symtab\[0\])" "if foo" "test decode_line expression parse" -gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line python.c:26 length" +gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line python.c:26 length 1" gdb_test "python print (symtab\[1\]\[0\].symtab)" ".*${python_c}" "test decode_line python.c:26 filename" gdb_test "python print (symtab\[1\]\[0\].line)" "26" "test decode_line python.c:26 line number" gdb_test "python gdb.decode_line(\"randomfunc\")" \ "gdb.error: Function \"randomfunc\" not defined.*" "test decode_line randomfunc" gdb_py_test_silent_cmd "python symtab = gdb.decode_line(\"func1\")" "test decode_line func1()" 1 -gdb_test "python print (len(symtab))" "2" "test decode_line func1 length" -gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line func1 length" +gdb_test "python print (len(symtab))" "2" "test decode_line func1 length 2" +gdb_test "python print (len(symtab\[1\]))" "1" "test decode_line func1 length 1" if { [is_remote host] } { set python_1_c [string_to_regexp "python-1.c"] @@ -308,7 +308,7 @@ gdb_py_test_silent_cmd "set python print-stack full" \ # Test prompt substituion -gdb_py_test_multiple "prompt substitution" \ +gdb_test_multiline "prompt substitution" \ "python" "" \ "someCounter = 0" "" \ "def prompt(current):" "" \ @@ -319,7 +319,7 @@ gdb_py_test_multiple "prompt substitution" \ " return \"py prompt \" + str (someCounter) + \" \"" "" \ "end" "" -gdb_py_test_multiple "prompt substitution readline" \ +gdb_test_multiline "prompt substitution readline" \ "python" "" \ "pCounter = 0" "" \ "def program_prompt(current):" "" \ @@ -336,7 +336,7 @@ set testfake "testfake" gdb_test_multiple "python gdb.prompt_hook = prompt" "set the hook" { -re "\[\r\n\]$newprompt $" { - pass "set hook" + pass "set hook prompt" } } @@ -395,7 +395,7 @@ gdb_test_multiple "end" "end programming" { } } -gdb_py_test_multiple "prompt substitution readline" \ +gdb_test_multiline "prompt substitution readline import" \ "python" "" \ "import gdb.command.prompt" "" \ "end" "" @@ -449,7 +449,7 @@ gdb_test "show python print-stack" \ gdb_py_test_silent_cmd "set python print-stack message" \ "Test print-stack set setting to message" 1 -gdb_py_test_multiple "prompt substitution readline" \ +gdb_test_multiline "prompt substitution readline error_prompt" \ "python" "" \ "pCounter = 0" "" \ "def error_prompt(current):" "" \ @@ -458,24 +458,24 @@ gdb_py_test_multiple "prompt substitution readline" \ gdb_test_multiple "python gdb.prompt_hook = error_prompt" "set the hook" { -re "Python Exception (exceptions.RuntimeError|<(type 'exceptions.|class ')RuntimeError'>) Python exception called.*$gdb_prompt $" { - pass "set hook" + pass "set hook error_prompt" } } gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \ - "set the hook to default" 1 + "set the hook to default 1" 1 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.*$gdb_prompt $" { - pass "set hook" + pass "set hook error_prompt traceback" } } gdb_py_test_silent_cmd "python gdb.prompt_hook = None" \ - "set the hook to default" 1 + "set the hook to default 2" 1 # Start with a fresh gdb. clean_restart ${testfile} diff --git a/gdb/testsuite/lib/gdb-guile.exp b/gdb/testsuite/lib/gdb-guile.exp index bda994b74c..ab6277b45a 100644 --- a/gdb/testsuite/lib/gdb-guile.exp +++ b/gdb/testsuite/lib/gdb-guile.exp @@ -54,26 +54,6 @@ proc gdb_scm_test_silent_cmd { cmd name {report_pass 1} } { } } -# Usage: gdb_test_multiline NAME INPUT RESULT {INPUT RESULT} ... -# Run a test named NAME, consisting of multiple lines of input. -# After each input line INPUT, search for result line RESULT. -# Succeed if all results are seen; fail otherwise. -# FIXME: Move to gdb.exp and remove Python's gdb_py_test_multiple. - -proc gdb_test_multiline { name args } { - global gdb_prompt - foreach {input result} $args { - if {[gdb_test_multiple $input "$name - $input" { - -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" { - pass "$name - $input" - } - }]} { - return 1 - } - } - return 0 -} - # Load Scheme file FILE_NAME. # TEST_NAME can be used to specify the name of the test, # otherwise a standard test name is provided. diff --git a/gdb/testsuite/lib/gdb-python.exp b/gdb/testsuite/lib/gdb-python.exp index 2408f2e221..b41032feb2 100644 --- a/gdb/testsuite/lib/gdb-python.exp +++ b/gdb/testsuite/lib/gdb-python.exp @@ -27,25 +27,6 @@ proc gdb_py_test_silent_cmd { cmd name report_pass } { } } -# Usage: gdb_py_test_multiple NAME INPUT RESULT {INPUT RESULT}... -# Run a test named NAME, consisting of multiple lines of input. -# After each input line INPUT, search for result line RESULT. -# Succeed if all results are seen; fail otherwise. - -proc gdb_py_test_multiple { name args } { - global gdb_prompt - foreach {input result} $args { - if {[gdb_test_multiple $input "$name - $input" { - -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" { - pass "$name - $input" - } - }]} { - return 1 - } - } - return 0 -} - # Return the result of python expression EXPR. DEFAULT is returned if # there's an error. TEST is the test message to use. It can be # omitted, in which case a test message is built from EXP. This is diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 7b243f5fff..12886c43f1 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1236,6 +1236,28 @@ proc gdb_test_multiple { command message args } { return $result } +# Usage: gdb_test_multiline NAME INPUT RESULT {INPUT RESULT} ... +# Run a test named NAME, consisting of multiple lines of input. +# After each input line INPUT, search for result line RESULT. +# Succeed if all results are seen; fail otherwise. + +proc gdb_test_multiline { name args } { + global gdb_prompt + set inputnr 0 + foreach {input result} $args { + set inputnr [expr ${inputnr} + 1] + if {[gdb_test_multiple $input "$name - $input" { + -re "\[\r\n\]*($result)\[\r\n\]+($gdb_prompt | *>)$" { + pass "$name - $input (input nr $inputnr)" + } + }]} { + return 1 + } + } + return 0 +} + + # gdb_test COMMAND PATTERN MESSAGE QUESTION RESPONSE # Send a command to gdb; test the result. # -- 2.20.1