[1/5] Minor cleanups in py-inferior.exp

Message ID 20230707-py-inf-fixes-30615-v1-1-7792ab559530@adacore.com
State New
Headers
Series Fix some Python Inferior methods |

Commit Message

Tom Tromey July 7, 2023, 3:07 p.m. UTC
  While working on this series, I noticed a couple of oddities in
py-inferior.exp.  One is an obviously incorrect comment, and the other
is a confusing test name.  This patch fixes these.
---
 gdb/testsuite/gdb.python/py-inferior.exp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Comments

Pedro Alves July 7, 2023, 6:06 p.m. UTC | #1
On 2023-07-07 16:07, Tom Tromey via Gdb-patches wrote:
> @@ -247,7 +246,7 @@ with_test_prefix "is_valid" {
>      gdb_test "python print (inf_list\[1\].is_valid())" "True" \
>  	"check inferior validity 3"
>  
> -    gdb_test_no_output "remove-inferiors 2" "remove-inferiors 3"
> +    gdb_test_no_output "remove-inferiors 2" "remove-inferiors 2"

You could just remove the second argument completely, it defaults to the
command string.

>      gdb_test "python print (inf_list\[0\].is_valid())" "True" \
>  	"check inferior validity 4"

There's also:

    gdb_test_no_output "remove-inferiors 3" "remove second inferior"
  
Tom Tromey July 11, 2023, 3:05 p.m. UTC | #2
>>>>> "Pedro" == Pedro Alves <pedro@palves.net> writes:

Pedro> On 2023-07-07 16:07, Tom Tromey via Gdb-patches wrote:
>> @@ -247,7 +246,7 @@ with_test_prefix "is_valid" {
>> gdb_test "python print (inf_list\[1\].is_valid())" "True" \
>> "check inferior validity 3"
>> 
>> -    gdb_test_no_output "remove-inferiors 2" "remove-inferiors 3"
>> +    gdb_test_no_output "remove-inferiors 2" "remove-inferiors 2"

Pedro> You could just remove the second argument completely, it defaults to the
Pedro> command string.

>> gdb_test "python print (inf_list\[0\].is_valid())" "True" \
>> "check inferior validity 4"

Pedro> There's also:

Pedro>     gdb_test_no_output "remove-inferiors 3" "remove second inferior"

I made both these changes for v2.

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index 58deece5d5f..33bc27ee86d 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -206,8 +206,7 @@  if [isnative] {
     }
 }
 
-# Test Inferior is_valid.  This must always be the last test in
-# this testcase as it kills the inferior.
+# Test Inferior is_valid.
 
 with_test_prefix "is_valid" {
     gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get initial list" 1
@@ -247,7 +246,7 @@  with_test_prefix "is_valid" {
     gdb_test "python print (inf_list\[1\].is_valid())" "True" \
 	"check inferior validity 3"
 
-    gdb_test_no_output "remove-inferiors 2" "remove-inferiors 3"
+    gdb_test_no_output "remove-inferiors 2" "remove-inferiors 2"
     gdb_test "python print (inf_list\[0\].is_valid())" "True" \
 	"check inferior validity 4"