aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2023-03-27 17:40:06 +0200
committerTom de Vries <tdevries@suse.de>2023-03-27 17:40:06 +0200
commit8ee5cc9fc03d4edbdc316c0a0e0bc46b99616c61 (patch)
treef4018fe6db22b03ee549d95c8724b9c5a4f97ae2 /gdb/testsuite/gdb.gdb
parentb0af93ad2ba7db505e5967aeebe37f88b17e44cf (diff)
downloadfsf-binutils-gdb-8ee5cc9fc03d4edbdc316c0a0e0bc46b99616c61.zip
fsf-binutils-gdb-8ee5cc9fc03d4edbdc316c0a0e0bc46b99616c61.tar.gz
fsf-binutils-gdb-8ee5cc9fc03d4edbdc316c0a0e0bc46b99616c61.tar.bz2
[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.
Diffstat (limited to 'gdb/testsuite/gdb.gdb')
-rw-r--r--gdb/testsuite/gdb.gdb/unittest.exp75
1 files changed, 44 insertions, 31 deletions
diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp
index a0e918c..5434a1a 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}