[v4,1/6] gdb/testsuite: Reduce indentation in gdb.threads/threadcrash.exp

Message ID 20240308093342.26745-2-tdevries@suse.de
State Committed
Headers
Series Fixes to gdb.threads/threadcrash.exp |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed

Commit Message

Tom de Vries March 8, 2024, 9:33 a.m. UTC
  In test-case gdb.threads/threadcrash.exp we have an unnecessarily indented
gdb_test_multiple:
...
    gdb_test_multiple "thread apply all backtrace" \
	"Get thread information" -lbl {
	    -re "#\[0-9\]+\\\?\\\?\[^\n\]*" {
...

Fix this by moving the command into a variable, allowing the
"gdb_test_multiple ... {" to fit on a single 80 chars line.

Tested on arm-linux and x86_64-linux.
---
 gdb/testsuite/gdb.threads/threadcrash.exp | 116 +++++++++++-----------
 1 file changed, 58 insertions(+), 58 deletions(-)
  

Comments

Tom Tromey March 13, 2024, 5:12 p.m. UTC | #1
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> In test-case gdb.threads/threadcrash.exp we have an unnecessarily indented
Tom> gdb_test_multiple:
Tom> ...
Tom>     gdb_test_multiple "thread apply all backtrace" \
Tom> 	"Get thread information" -lbl {
Tom> 	    -re "#\[0-9\]+\\\?\\\?\[^\n\]*" {
Tom> ...

Tom> Fix this by moving the command into a variable, allowing the
Tom> "gdb_test_multiple ... {" to fit on a single 80 chars line.

I like it.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.threads/threadcrash.exp
index 996e020d1e8..3d269ec88c5 100644
--- a/gdb/testsuite/gdb.threads/threadcrash.exp
+++ b/gdb/testsuite/gdb.threads/threadcrash.exp
@@ -53,64 +53,64 @@  proc thread_apply_all {} {
 
     set unwind_fail false
 
-    gdb_test_multiple "thread apply all backtrace" \
-	"Get thread information" -lbl {
-	    -re "#\[0-9\]+\\\?\\\?\[^\n\]*" {
-		set unwind_fail true
-		exp_continue
-	    }
-	    -re "\[^\n\]*syscall_task .location=SIGNAL_ALT_STACK\[^\n\]*" {
-		lappend test_list [multi_line ".*sleep.*" \
-					      ".*do_syscall_task .location=SIGNAL_ALT_STACK.*" \
-					      ".*signal_handler.*" \
-					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
-					      ".*thread_function.*"]
-		exp_continue
-	    }
-	    -re "\[^\n\]*syscall_task .location=SIGNAL_HANDLER\[^\n\]*" {
-		lappend test_list [multi_line ".*sleep.*" \
-					      ".*do_syscall_task .location=SIGNAL_HANDLER.*" \
-					      ".*signal_handler.*" \
-					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
-					      ".*thread_function.*"]
-		exp_continue
-	    }
-	    -re "\[^\n\]*syscall_task .location=NORMAL\[^\n\]*" {
-		lappend test_list [multi_line ".*sleep.*" \
-					      ".*do_syscall_task .location=NORMAL.*" \
-					      ".*thread_function.*"]
-		exp_continue
-	    }
-	    -re "\[^\n\]*spin_task .location=SIGNAL_ALT_STACK\[^\n\]*" {
-		lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_ALT_STACK.*" \
-					      ".*signal_handler.*" \
-					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
-					      ".*thread_function.*"]
-		exp_continue
-	    }
-	    -re "\[^\n\]*spin_task .location=SIGNAL_HANDLER\[^\n\]*" {
-		lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_HANDLER.*" \
-					      ".*signal_handler.*" \
-					      ".*signal handler called.*" \
-					      ".*pthread_kill.*" \
-					      ".*thread_function.*"]
-		exp_continue
-	    }
-	    -re "\[^\n\]*spin_task .location=NORMAL\[^\n\]*" {
-		lappend test_list [multi_line ".*do_spin_task .location=NORMAL..*" \
-					      ".*thread_function.*"]
-		exp_continue
-	    }
-	    -re "\[^\n\]*main\[^\n\]*" {
-		lappend test_list ".*main.*"
-		exp_continue
-	    }
-	    -re "$::gdb_prompt " {
-		pass $gdb_test_name
-	    }
+    set cmd "thread apply all backtrace"
+    gdb_test_multiple $cmd "Get thread information" -lbl {
+	-re "#\[0-9\]+\\\?\\\?\[^\n\]*" {
+	    set unwind_fail true
+	    exp_continue
+	}
+	-re "\[^\n\]*syscall_task .location=SIGNAL_ALT_STACK\[^\n\]*" {
+	    lappend test_list [multi_line ".*sleep.*" \
+				   ".*do_syscall_task .location=SIGNAL_ALT_STACK.*" \
+				   ".*signal_handler.*" \
+				   ".*signal handler called.*" \
+				   ".*pthread_kill.*" \
+				   ".*thread_function.*"]
+	    exp_continue
+	}
+	-re "\[^\n\]*syscall_task .location=SIGNAL_HANDLER\[^\n\]*" {
+	    lappend test_list [multi_line ".*sleep.*" \
+				   ".*do_syscall_task .location=SIGNAL_HANDLER.*" \
+				   ".*signal_handler.*" \
+				   ".*signal handler called.*" \
+				   ".*pthread_kill.*" \
+				   ".*thread_function.*"]
+	    exp_continue
+	}
+	-re "\[^\n\]*syscall_task .location=NORMAL\[^\n\]*" {
+	    lappend test_list [multi_line ".*sleep.*" \
+				   ".*do_syscall_task .location=NORMAL.*" \
+				   ".*thread_function.*"]
+	    exp_continue
+	}
+	-re "\[^\n\]*spin_task .location=SIGNAL_ALT_STACK\[^\n\]*" {
+	    lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_ALT_STACK.*" \
+				   ".*signal_handler.*" \
+				   ".*signal handler called.*" \
+				   ".*pthread_kill.*" \
+				   ".*thread_function.*"]
+	    exp_continue
+	}
+	-re "\[^\n\]*spin_task .location=SIGNAL_HANDLER\[^\n\]*" {
+	    lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_HANDLER.*" \
+				   ".*signal_handler.*" \
+				   ".*signal handler called.*" \
+				   ".*pthread_kill.*" \
+				   ".*thread_function.*"]
+	    exp_continue
+	}
+	-re "\[^\n\]*spin_task .location=NORMAL\[^\n\]*" {
+	    lappend test_list [multi_line ".*do_spin_task .location=NORMAL..*" \
+				   ".*thread_function.*"]
+	    exp_continue
+	}
+	-re "\[^\n\]*main\[^\n\]*" {
+	    lappend test_list ".*main.*"
+	    exp_continue
+	}
+	-re "$::gdb_prompt " {
+	    pass $gdb_test_name
+	}
     }
 
     gdb_assert {$unwind_fail == false}