From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679931621; 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=ZhiZtWDwqZIG1gGdCp6Kw1xX2aFYbcumLJcSn87RmHE=; b=O1kOqPTV53gdPzvvDIBcEFO+/UuKEqZK3sQdtHDNL8LWaORnd4XZcU4ZZhtI3f5Qixda7g kv4IvyHkiGHyjiSwwWo7t1VPp6YNIVT3eBiol5KtoOrtDqBcJbfliDJFXB9LzsOAaugE5O IUW0+b+AHvuz99Ox2wvU1iYTgAGFGAc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679931621; 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=ZhiZtWDwqZIG1gGdCp6Kw1xX2aFYbcumLJcSn87RmHE=; b=wF23tE3jhyqK/G3UE4JSC40XK4cj5UJ1MRc01yn2DTTOoIBdz5tyXrwJKSxPkfCt5zOSh7 MPAnRw72cI+9XWCA== 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 From: Tom de Vries 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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} -- 2.35.3