diff options
author | Sandra Loosemore <sandra@codesourcery.com> | 2020-07-16 14:03:09 -0700 |
---|---|---|
committer | Sandra Loosemore <sandra@codesourcery.com> | 2020-07-16 14:03:09 -0700 |
commit | 5597c9402d49a623e3fabecd7dfc0d2f9e0ff983 (patch) | |
tree | 7fc3cee457f75ebe3716552189144928c3de85bc | |
parent | d0ce17d8537fb51583891073abe18d5bb60c0c24 (diff) | |
download | gdb-5597c9402d49a623e3fabecd7dfc0d2f9e0ff983.zip gdb-5597c9402d49a623e3fabecd7dfc0d2f9e0ff983.tar.gz gdb-5597c9402d49a623e3fabecd7dfc0d2f9e0ff983.tar.bz2 |
Fix POSIX-isms in gdb.base/shell.exp
Some recent tests added to gdb.base/shell.exp have been failing on
Windows host due to assumptions that the shell is a POSIX variant. On
Windows, GDB uses CMD.EXE via the system() call to run shell commands
instead.
There seems to be no obvious CMD.EXE equivalent for "kill -2 $$" to
signal the shell process, so this patch skips those tests on Windows
host. The second problem addressed here is that CMD.EXE only
recognizes double quotes, not single quotes; that change can be made
unconditionally since POSIX shells recognize double quotes as well.
2020-07-16 Sandra Loosemore <sandra@codesourcery.com>
gdb/testsuite/
* gdb.base/shell.exp: Skip pipe tests dependent on sh on Windows host.
Use double quotes instead of single quotes.
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/shell.exp | 26 |
2 files changed, 21 insertions, 10 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5eb9847..e20e026 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-07-16 Sandra Loosemore <sandra@codesourcery.com> + + * gdb.base/shell.exp: Skip pipe tests dependent on sh on Windows host. + Use double quotes instead of single quotes. + 2020-07-16 Caroline Tice <cmtice@google.com> * gdb.dwarf2/dw5-rnglist-test.cc: New file. diff --git a/gdb/testsuite/gdb.base/shell.exp b/gdb/testsuite/gdb.base/shell.exp index f656077..ad36f6b 100644 --- a/gdb/testsuite/gdb.base/shell.exp +++ b/gdb/testsuite/gdb.base/shell.exp @@ -34,9 +34,12 @@ gdb_test_no_output "! exit 1" gdb_test "p \$_shell_exitcode" " = 1" "shell fail exitcode" gdb_test "p \$_shell_exitsignal" " = void" "shell fail exitsignal" -gdb_test_no_output "! kill -2 $$" -gdb_test "p \$_shell_exitcode" " = void" "shell interrupt exitcode" -gdb_test "p \$_shell_exitsignal" " = 2" "shell interrupt exitsignal" +# This test will not work when the shell is CMD.EXE. +if { ! [ishost *-*-mingw*] } { + gdb_test_no_output "! kill -2 $$" + gdb_test "p \$_shell_exitcode" " = void" "shell interrupt exitcode" + gdb_test "p \$_shell_exitsignal" " = 2" "shell interrupt exitsignal" +} # Define the user command "foo", used to test "pipe" command. gdb_test_multiple "define foo" "define foo" { @@ -67,16 +70,16 @@ gdb_test "|foo|grep truc|wc -l" "1" "no space around pipe char" gdb_test "echo coucou\\n" "coucou" "echo coucou" gdb_test "||wc -l" "1" "repeat previous command" -gdb_test "| -d ! echo this contains a | character\\n ! sed -e 's/|/PIPE/'" \ +gdb_test "| -d ! echo this contains a | character\\n ! sed -e \"s/|/PIPE/\"" \ "this contains a PIPE character" "alternate 1char delim" -gdb_test "|-d ! echo this contains a | character\\n!sed -e 's/|/PIPE/'" \ +gdb_test "|-d ! echo this contains a | character\\n!sed -e \"s/|/PIPE/\"" \ "this contains a PIPE character" "alternate 1char delim, no space" -gdb_test "| -d !!! echo this contains a | character\\n !!! sed -e 's/|/PIPE/'" \ +gdb_test "| -d !!! echo this contains a | character\\n !!! sed -e \"s/|/PIPE/\"" \ "this contains a PIPE character" "alternate 3char delim" -gdb_test "|-d !!! echo this contains a | character\\n!!!sed -e 's/|/PIPE/'" \ +gdb_test "|-d !!! echo this contains a | character\\n!!!sed -e \"s/|/PIPE/\"" \ "this contains a PIPE character" "alternate 3char delim, no space" # Convenience variables with pipe command. @@ -88,9 +91,12 @@ gdb_test "|p 123| exit 1" "" gdb_test "p \$_shell_exitcode" " = 1" "pipe fail exitcode" gdb_test "p \$_shell_exitsignal" " = void" "pipe fail exitsignal" -gdb_test "|p 123| kill -2 $$" "" -gdb_test "p \$_shell_exitcode" " = void" "pipe interrupt exitcode" -gdb_test "p \$_shell_exitsignal" " = 2" "pipe interrupt exitsignal" +# This test will not work when the shell is CMD.EXE. +if { ! [ishost *-*-mingw*] } { + gdb_test "|p 123| kill -2 $$" "" + gdb_test "p \$_shell_exitcode" " = void" "pipe interrupt exitcode" + gdb_test "p \$_shell_exitsignal" " = 2" "pipe interrupt exitsignal" +} # Error handling verifications. gdb_test "|" "Missing COMMAND" "all missing" |