[binutils-gdb] Modify gdb.threads/pthreads.exp to test FLAG qcs arguments for thread apply.

Philippe Waroquiers philippe@sourceware.org
Thu Jul 12 21:11:00 GMT 2018


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

commit 5759ebb3b35f4bff8aba7ba06e8b0eb88d9d0831
Author: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Date:   Sun May 20 20:31:27 2018 +0200

    Modify gdb.threads/pthreads.exp to test FLAG qcs arguments for thread apply.
    
    Also, add prefixes to make some non unique tests unique.
    
    gdb/testsuite/ChangeLog
    2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
    
    	* gdb.threads/pthreads.exp: Test qcs FLAG arguments.
    	Add some test prefixes to make tests unique.

Diff:
---
 gdb/testsuite/ChangeLog                |  5 ++
 gdb/testsuite/gdb.threads/pthreads.exp | 83 ++++++++++++++++++++++++++++++++--
 2 files changed, 84 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 84bfa77..570ba53 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
 
+	* gdb.threads/pthreads.exp: Test qcs FLAG arguments.
+	Add some test prefixes to make tests unique.
+
+2018-07-12  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
 	* gdb.base/frameapply.c: New file.
 	* gdb.base/frameapply.exp: New file.
 
diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp
index 830432b..bbda52e 100644
--- a/gdb/testsuite/gdb.threads/pthreads.exp
+++ b/gdb/testsuite/gdb.threads/pthreads.exp
@@ -188,8 +188,10 @@ proc check_control_c {} {
     global gdb_prompt
 
     # Verify that all threads are running.
-    if [all_threads_running] then {
-	pass "all threads running after startup"
+    with_test_prefix "after startup" {
+	if [all_threads_running] then {
+	    pass "all threads running after startup"
+	}
     }
 
     # Send a continue followed by ^C to the process to stop it.
@@ -216,8 +218,10 @@ proc check_control_c {} {
     gdb_test "bt" ".*"
 
     # Verify that all threads can be run again after a ^C stop.
-    if [all_threads_running] then {
-	pass "all threads running after continuing from ^C stop"
+    with_test_prefix "after continue" {
+	if [all_threads_running] then {
+	    pass "all threads running after continuing from ^C stop"
+	}
     }
     return 0
 }
@@ -267,6 +271,76 @@ proc check_backtraces {} {
     }
 }
 
+proc check_qcs {} {
+    set any "\[^\r\n\]*"
+    set ws "\[ \t\]\+"
+    set number "\[0-9]\+"
+
+    # Check -c (continue) and -s (silently continue) flags.
+    gdb_test "thread apply 2-3 p notfound" \
+	[multi_line \
+	     "" \
+	     "Thread 2 ${any}" \
+	     "No symbol \\\"notfound\\\" in current context." \
+	    ] \
+	"run a failing command that aborts thread apply"
+
+    gdb_test "thread apply 2-3 -c p notfound" \
+	[multi_line \
+	     "" \
+	     "Thread 2 ${any}" \
+	     "No symbol \\\"notfound\\\" in current context." \
+	     "" \
+	     "Thread 3 ${any}" \
+	     "No symbol \\\"notfound\\\" in current context." \
+	    ] \
+	"run a failing command, -c to continue"
+
+    with_test_prefix "silent flag" {
+	foreach_with_prefix cmd_and_args {
+	    "thread apply all -s frame apply all -s"
+	    "tfaas"
+	    "taas faas"} {
+		set cmd "$cmd_and_args p i"
+		gdb_test $cmd \
+		    [multi_line \
+			 "" \
+			 "Thread 3 ${any}" \
+			 "#${number}${ws}${any} in thread2 ${any}" \
+			 "\\\$\[0-9]+ = ${number}${any}" \
+			 "" \
+			 "Thread 2 ${any}" \
+			 "#${number}${ws}${any} in thread1 ${any}" \
+			 "\\\$\[0-9]+ = ${number}${any}" \
+			] \
+		    "run a failing command except in one frame of thread 2,3, -s to silently continue"
+	    }
+    }
+
+    # Check quietness.
+    gdb_test "thread apply all -s -q frame apply all -s p i" \
+	[multi_line \
+	     "#${number}${ws}${any} in thread2 ${any}" \
+	     "\\\$\[0-9]+ = ${number}${any}" \
+	     "#${number}${ws}${any} in thread1 ${any}" \
+	     "\\\$\[0-9]+ = ${number}${any}" \
+	    ] \
+	"run a failing command except in one frame of thread 2,3, -s to silently continue.  Do not show thread information"
+
+    gdb_test "thread apply all -s -q frame apply all -s -q p i" \
+	[multi_line \
+	     "\\\$\[0-9]+ = ${number}${any}" \
+	     "\\\$\[0-9]+ = ${number}${any}" \
+	    ] \
+	"run a failing command except in one frame of thread 2,3, -s to silently continue.  Do not show thread and frame info"
+
+    # Check invalid flag combinations.
+    gdb_test "thread apply all -c -s p 1" \
+	"thread apply all: -c and -s are mutually exclusive" \
+	"check -c and -s cannot be used simultaneously"
+
+}
+
 if [runto_main] then {
     if [test_startup] then {
 	if [check_control_c] then {
@@ -274,5 +348,6 @@ if [runto_main] then {
 	    return
 	}
 	check_backtraces
+	check_qcs
     }
 }



More information about the Gdb-cvs mailing list