public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix gdb.gdb/unittest.exp for remote host
@ 2023-03-27 15:40 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-03-27 15:40 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8ee5cc9fc03d4edbdc316c0a0e0bc46b99616c61
commit 8ee5cc9fc03d4edbdc316c0a0e0bc46b99616c61
Author: Tom de Vries <tdevries@suse.de>
Date: Mon Mar 27 17:40:06 2023 +0200
[gdb/testsuite] Fix gdb.gdb/unittest.exp for remote host
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.
Diff:
---
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}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-27 15:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 15:40 [binutils-gdb] [gdb/testsuite] Fix gdb.gdb/unittest.exp for remote host Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).