From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 2B76D3858404; Mon, 11 Mar 2024 09:57:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B76D3858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710151028; bh=q2wTNF9d0HJLvRKA+mGhxOYbW3SRkUASb4xb7CUdCOI=; h=From:To:Subject:Date:From; b=PF8HY2MFOMb7UhDpGaEmIxD0Rl8GXnaosqUhg8atg8pQ75YjOVnG2eyCbnlB1LZ/5 Vx1nOFQEawf6jtpVbKu1K09a8XIwXQUNNqvvkUGYxD8B2+YVaSo6jwUr76JUr//+Tu 1OUwB4Cqcy30PhpxBiY6tCLmX9EENrwbFdvFDJvI= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: Simplify gdb.threads/threadcrash.exp X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: b95b92ec093cea8014e33fdca2f800c4e5ce91be X-Git-Newrev: 623840fc07dd8f3b21276d018d442cdf60292e73 Message-Id: <20240311095708.2B76D3858404@sourceware.org> Date: Mon, 11 Mar 2024 09:57:08 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D623840fc07dd= 8f3b21276d018d442cdf60292e73 commit 623840fc07dd8f3b21276d018d442cdf60292e73 Author: Tom de Vries Date: Mon Mar 11 10:57:32 2024 +0100 gdb/testsuite: Simplify gdb.threads/threadcrash.exp =20 I noticed in gdb.threads/threadcrash.exp that the usage of test_list is somewhat convoluted. =20 Simplify the test-case by storing a classification instead of a pattern= in test_list. =20 Tested on arm-linux and x86_64-linux. Diff: --- gdb/testsuite/gdb.threads/threadcrash.exp | 89 +++++++++++++++++++++------= ---- 1 file changed, 60 insertions(+), 29 deletions(-) diff --git a/gdb/testsuite/gdb.threads/threadcrash.exp b/gdb/testsuite/gdb.= threads/threadcrash.exp index 966708acd96..16fd7eb4e23 100644 --- a/gdb/testsuite/gdb.threads/threadcrash.exp +++ b/gdb/testsuite/gdb.threads/threadcrash.exp @@ -46,52 +46,31 @@ proc thread_apply_all {} { exp_continue } -re "^\r\n${hs}syscall_task .location=3DSIGNAL_ALT_STACK$hs$eol" { - lappend test_list [multi_line ".*sleep.*" \ - ".*do_syscall_task .location=3DSIGNAL_ALT_STACK.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 1 exp_continue } -re "^\r\n${hs}syscall_task .location=3DSIGNAL_HANDLER$hs$eol" { - lappend test_list [multi_line ".*sleep.*" \ - ".*do_syscall_task .location=3DSIGNAL_HANDLER.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 2 exp_continue } -re "^\r\n${hs}syscall_task .location=3DNORMAL$hs$eol" { - lappend test_list [multi_line ".*sleep.*" \ - ".*do_syscall_task .location=3DNORMAL.*" \ - ".*thread_function.*"] + lappend test_list 3 exp_continue } -re "^\r\n${hs}spin_task .location=3DSIGNAL_ALT_STACK$hs$eol" { - lappend test_list [multi_line ".*do_spin_task .location=3DSIGNAL_ALT_= STACK.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 4 exp_continue } -re "^\r\n${hs}spin_task .location=3DSIGNAL_HANDLER$hs$eol" { - lappend test_list [multi_line ".*do_spin_task .location=3DSIGNAL_HAND= LER.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 5 exp_continue } -re "^\r\n${hs}spin_task .location=3DNORMAL$hs$eol" { - lappend test_list [multi_line ".*do_spin_task .location=3DNORMAL..*" \ - ".*thread_function.*"] + lappend test_list 6 exp_continue } -re "^\r\n${hs}main$hs$eol" { - lappend test_list ".*main.*" + lappend test_list 7 exp_continue } -re "^\r\n$hs$eol" { @@ -122,7 +101,59 @@ proc do_full_test {} { for {set i 0} {$i < $thread_count } {incr i} { set thread_num [expr [llength $test_list] - $i] =20 - gdb_test "thread apply $thread_num backtrace" [lindex $test_list $i] + set type [lindex $test_list $i] + if { $type =3D=3D 1 } { + set re \ + [multi_line \ + ".sleep.*" \ + ".*do_syscall_task .location=3DSIGNAL_ALT_STACK.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type =3D=3D 2 } { + set re \ + [multi_line \ + ".*sleep.*" \ + ".*do_syscall_task .location=3DSIGNAL_HANDLER.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type =3D=3D 3 } { + set re \ + [multi_line \ + ".*sleep.*" \ + ".*do_syscall_task .location=3DNORMAL.*" \ + ".*thread_function.*"] + } elseif { $type =3D=3D 4 } { + set re \ + [multi_line \ + ".*do_spin_task .location=3DSIGNAL_ALT_STACK.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type =3D=3D 5 } { + set re \ + [multi_line \ + ".*do_spin_task .location=3DSIGNAL_HANDLER.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type =3D=3D 6 } { + set re \ + [multi_line \ + ".*do_spin_task .location=3DNORMAL..*" \ + ".*thread_function.*"] + } elseif { $type =3D=3D 7 } { + set re ".*main.*" + } else { + error "invalid type: $type" + } + + gdb_test "thread apply $thread_num backtrace" $re } }