From patchwork Fri Mar 8 09:33:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 86969 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ECE9E3860006 for ; Fri, 8 Mar 2024 12:00:28 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 2D8573858415 for ; Fri, 8 Mar 2024 11:59:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2D8573858415 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2D8573858415 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709899200; cv=none; b=ERvctlrQQklT4Vft3qbHEhYfFEDbQhjvGBdVBmugTuFwVUKfZ0mQZKElgymtTbXe+4s+gZOtbPV0q7iKDVEmzVibDEYZhSH56jBicjuTIXkhuXKQ8qF/66zdUY+84kJflnvCtY6RLjT2VLhpK6W9lNGjhwTqcRNUF/staciLQzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709899200; c=relaxed/simple; bh=A7I9xAjus1WidNkwBCm0SU5F2fzLW7Eyr5zbPa+vh/I=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=az7TUsSMFDknXympKH8v+bRjpDkiwSdm/oRLVzkpLuuWuh2oz/co68/sMXMdvc9OWO/pjmzhtAwpC35zf7sKnGUFauqClqey9himPB+uuSgDyAXlGM7cOoH2GzW0LSvrRG+5qDwlJsZnmRh0mcNrKZpzMNSbEUhbdmTlhij2/ck= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 822AE1715E for ; Fri, 8 Mar 2024 09:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YCv4q0qj8HyLqA2DWYVepJ3d47RgSLc9r2cxlnTxCug=; b=c47KGVbIj2upGGosr/NOaA/xBG4PF/5hSX5LNrFFmDfeVPfWL46R/3fg3Ry3Hi9gC31e/d Jv6xMO18eGZ4l+YTO2R8lE8aZ205eOW8SrIJZrVbNM4EfSmLTaHlO2afuYvMqf9ictCvz3 /on15OOOkW4AKtcii1JAa7RHCGJMJjw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YCv4q0qj8HyLqA2DWYVepJ3d47RgSLc9r2cxlnTxCug=; b=gLOnuxiSam4EvI0nIPCwL53vqfMCK8Np4I7ytxXE7SujGNGmB4hbvnHn4nFqx3tXsAnxt/ GKHEiRi+N4tbw3DA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YCv4q0qj8HyLqA2DWYVepJ3d47RgSLc9r2cxlnTxCug=; b=c47KGVbIj2upGGosr/NOaA/xBG4PF/5hSX5LNrFFmDfeVPfWL46R/3fg3Ry3Hi9gC31e/d Jv6xMO18eGZ4l+YTO2R8lE8aZ205eOW8SrIJZrVbNM4EfSmLTaHlO2afuYvMqf9ictCvz3 /on15OOOkW4AKtcii1JAa7RHCGJMJjw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709890386; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YCv4q0qj8HyLqA2DWYVepJ3d47RgSLc9r2cxlnTxCug=; b=gLOnuxiSam4EvI0nIPCwL53vqfMCK8Np4I7ytxXE7SujGNGmB4hbvnHn4nFqx3tXsAnxt/ GKHEiRi+N4tbw3DA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 653571379A for ; Fri, 8 Mar 2024 09:33:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EOV6F1Hb6mWLYAAAD6G6ig (envelope-from ) for ; Fri, 08 Mar 2024 09:33:05 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v4 4/6] gdb/testsuite: Simplify gdb.threads/threadcrash.exp Date: Fri, 8 Mar 2024 10:33:40 +0100 Message-Id: <20240308093342.26745-5-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240308093342.26745-1-tdevries@suse.de> References: <20240308093342.26745-1-tdevries@suse.de> MIME-Version: 1.0 X-Spamd-Bar: +++ Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=c47KGVbI; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=gLOnuxiS X-Spamd-Result: default: False [3.77 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; URIBL_BLOCKED(0.00)[suse.de:dkim]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.92)[86.21%] X-Spam-Score: 3.77 X-Rspamd-Queue-Id: 822AE1715E X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org I noticed in gdb.threads/threadcrash.exp that the usage of test_list is somewhat convoluted. Simplify the test-case by storing a classification instead of a pattern in test_list. Tested on arm-linux and x86_64-linux. --- 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=SIGNAL_ALT_STACK$hs$eol" { - lappend test_list [multi_line ".*sleep.*" \ - ".*do_syscall_task .location=SIGNAL_ALT_STACK.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 1 exp_continue } -re "^\r\n${hs}syscall_task .location=SIGNAL_HANDLER$hs$eol" { - lappend test_list [multi_line ".*sleep.*" \ - ".*do_syscall_task .location=SIGNAL_HANDLER.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 2 exp_continue } -re "^\r\n${hs}syscall_task .location=NORMAL$hs$eol" { - lappend test_list [multi_line ".*sleep.*" \ - ".*do_syscall_task .location=NORMAL.*" \ - ".*thread_function.*"] + lappend test_list 3 exp_continue } -re "^\r\n${hs}spin_task .location=SIGNAL_ALT_STACK$hs$eol" { - lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_ALT_STACK.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 4 exp_continue } -re "^\r\n${hs}spin_task .location=SIGNAL_HANDLER$hs$eol" { - lappend test_list [multi_line ".*do_spin_task .location=SIGNAL_HANDLER.*" \ - ".*signal_handler.*" \ - ".*signal handler called.*" \ - ".*pthread_kill.*" \ - ".*thread_function.*"] + lappend test_list 5 exp_continue } -re "^\r\n${hs}spin_task .location=NORMAL$hs$eol" { - lappend test_list [multi_line ".*do_spin_task .location=NORMAL..*" \ - ".*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] - gdb_test "thread apply $thread_num backtrace" [lindex $test_list $i] + set type [lindex $test_list $i] + if { $type == 1 } { + set re \ + [multi_line \ + ".sleep.*" \ + ".*do_syscall_task .location=SIGNAL_ALT_STACK.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type == 2 } { + set re \ + [multi_line \ + ".*sleep.*" \ + ".*do_syscall_task .location=SIGNAL_HANDLER.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type == 3 } { + set re \ + [multi_line \ + ".*sleep.*" \ + ".*do_syscall_task .location=NORMAL.*" \ + ".*thread_function.*"] + } elseif { $type == 4 } { + set re \ + [multi_line \ + ".*do_spin_task .location=SIGNAL_ALT_STACK.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type == 5 } { + set re \ + [multi_line \ + ".*do_spin_task .location=SIGNAL_HANDLER.*" \ + ".*signal_handler.*" \ + ".*signal handler called.*" \ + ".*pthread_kill.*" \ + ".*thread_function.*"] + } elseif { $type == 6 } { + set re \ + [multi_line \ + ".*do_spin_task .location=NORMAL..*" \ + ".*thread_function.*"] + } elseif { $type == 7 } { + set re ".*main.*" + } else { + error "invalid type: $type" + } + + gdb_test "thread apply $thread_num backtrace" $re } }