From patchwork Mon Mar 27 15:40:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66962 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 E27163858C3A for ; Mon, 27 Mar 2023 15:41:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E27163858C3A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679931676; bh=ZhiZtWDwqZIG1gGdCp6Kw1xX2aFYbcumLJcSn87RmHE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HQ3PvI4W6qoZMsRFZwDokdhZC88LpMf3HLeobAAdaO5A9rfewmNC4tnI851p56nsF DHTPv7U/dNfq9XGL03x8Taj1likvB7cCQG5f3M29zduFlyxibBSVvv97pw0pT+BUkG PJg4Cn5uG4sd5PHhI6Q5OZoCA05O111VT1/2+Wd4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id DD2DB3858C5E for ; Mon, 27 Mar 2023 15:40:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD2DB3858C5E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 241E521E68 for ; Mon, 27 Mar 2023 15:40:21 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0FE1A13329 for ; Mon, 27 Mar 2023 15:40:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MO3aAuW4IWRZPgAAMHmgww (envelope-from ) for ; Mon, 27 Mar 2023 15:40:21 +0000 To: gdb-patches@sourceware.org Subject: [pushed 2/2] [gdb/testsuite] Fix gdb.gdb/unittest.exp for remote host Date: Mon, 27 Mar 2023 17:40:20 +0200 Message-Id: <20230327154020.26151-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230327154020.26151-1-tdevries@suse.de> References: <20230327154020.26151-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 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 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.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Fix test-case gdb.gdb/unittest.exp for remote host, by: - disabling the completion tests if readline is not used, and - not using with_gdb_cwd $dir for remote host (because it does not support changing to "."). Tested on x86_64-linux. --- gdb/testsuite/gdb.gdb/unittest.exp | 75 ++++++++++++++++++------------ 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp index a0e918c36f6..5434a1a0941 100644 --- a/gdb/testsuite/gdb.gdb/unittest.exp +++ b/gdb/testsuite/gdb.gdb/unittest.exp @@ -27,9 +27,38 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} { return -1 } -proc run_selftests { binfile } { +proc run_selftests_1 {} { global decimal gdb_prompt + set enabled 1 + set num_ran 0 + + set test "maintenance selftest" + gdb_test_multiple $test $test { + -re ".*Running selftest \[^\n\r\]+\." { + # The selftests can take some time to complete. To prevent + # timeout spot the 'Running ...' lines going past, so long as + # these are produced quickly enough then the overall test will + # not timeout. + exp_continue + } + -re "Ran ($decimal) unit tests, ($decimal) failed\r\n$gdb_prompt $" { + set num_ran $expect_out(1,string) + set num_failed $expect_out(2,string) + gdb_assert "$num_ran > 0" "$test, ran some tests" + gdb_assert "$num_failed == 0" "$test, failed none" + } + -re "Selftests have been disabled for this build.\r\n$gdb_prompt $" { + unsupported $test + set num_ran 0 + set enabled 0 + } + } + + return [list $enabled $num_ran] +} + +proc run_selftests { binfile } { if { $binfile == "" } { gdb_exit gdb_start @@ -37,38 +66,18 @@ proc run_selftests { binfile } { clean_restart ${binfile} } - # Some of the selftests create temporary files in GDB's current - # directory. So, while running the selftests, switch to the - # test's output directory to avoid leaving clutter in the - # gdb/testsuite root directory. - set dir [standard_output_file ""] - set enabled 1 - set num_ran 0 - with_gdb_cwd $dir { - set test "maintenance selftest" - gdb_test_multiple $test $test { - -re ".*Running selftest \[^\n\r\]+\." { - # The selftests can take some time to complete. To prevent - # timeout spot the 'Running ...' lines going past, so long as - # these are produced quickly enough then the overall test will - # not timeout. - exp_continue - } - -re "Ran ($decimal) unit tests, ($decimal) failed\r\n$gdb_prompt $" { - set num_ran $expect_out(1,string) - set num_failed $expect_out(2,string) - gdb_assert "$num_ran > 0" "$test, ran some tests" - gdb_assert "$num_failed == 0" "$test, failed none" - } - -re "Selftests have been disabled for this build.\r\n$gdb_prompt $" { - unsupported $test - set num_ran 0 - set enabled 0 - } + if { [is_remote host] } { + return [run_selftests_1] + } else { + # Some of the selftests create temporary files in GDB's current + # directory. So, while running the selftests, switch to the + # test's output directory to avoid leaving clutter in the + # gdb/testsuite root directory. + set dir [standard_output_file ""] + with_gdb_cwd $dir { + return [run_selftests_1] } } - - return [list $enabled $num_ran] } # Test completion of command "maintenance selftest". @@ -78,6 +87,10 @@ proc_with_prefix test_completion {} { clean_restart + if { ![readline_is_used] } { + return + } + if { $self_tests_enabled } { test_gdb_complete_tab_multiple "maintenance selftest copy" "_" \ {copy_bitwise copy_integer_to_size}