From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id C0AAF3892440 for ; Thu, 25 Jun 2020 01:35:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C0AAF3892440 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Sandra_Loosemore@mentor.com IronPort-SDR: md7qVsvwmENebPn8G3j/ej39b5lmvNpN1NrJoQwtzHh9duLMDaWB1GfNI+pjuHYJbEgEF67HVN Ogftdq4v2CHIYPuHtyIZ0RF2JQF64a6V1l0Zn9XxpEEDBjXoXPr8zQ/h8yTTyTuPzDYRUCC0Z+ wY7xCmtTYAfS8gN5OvTad4FSgzP2pKgviww9MexlvdCZhvLKBultAQrUpqwdTDQ4zRShtnqsfS /h9rA1ESDjjL+EsfTi7lPTIUVf9MuHR25NXazvsrGRmmhqvNuAtJm3xMjAaO3gN2h8znzyaOdw 3qE= X-IronPort-AV: E=Sophos;i="5.75,277,1589270400"; d="scan'208";a="50162016" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 24 Jun 2020 17:35:50 -0800 IronPort-SDR: HV49f5R7XDtnPlBZhbL9IUU/Nc2Yuu7DFj4FSbuB6GpYT2Iq8SbP3A9iQgXXuJ73zhS4U8H+Q2 Y4BauCLt6QkjM+YO6xJM9FZVHkCemsdelJYv07lgB94DUrZbmeG6obRJx+KZsAwRNzanGdXA19 fxjYNcniuJbevhDPGfHjA0WyTbW1kxNZE4PlPqS0HUoXYKCbspmlcC9zHuXoTGYH2SQllysOQT pzfmcQJstg8zanJUnDh8Yw3uKVO4ssTQT8isQa2hL3qqs2i1CG9Rkcrq306JPDXKZlqEBzUpGs 4BQ= To: "gdb-patches@sourceware.org" From: Sandra Loosemore Subject: [patch] gdb/testsuite: Fix POSIX-isms in gdb.base/shell.exp Message-ID: <6bc2b01e-3807-77b9-7d1e-d7f6a7875e49@codesourcery.com> Date: Wed, 24 Jun 2020 19:35:43 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------4FF4F63CDDB099BBABDDC9C8" Content-Language: en-US X-ClientProxiedBy: svr-orw-mbx-04.mgc.mentorg.com (147.34.90.204) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Thu, 25 Jun 2020 01:35:53 -0000 --------------4FF4F63CDDB099BBABDDC9C8 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit This patch fixes a group of failures in gdb.base/shell.exp on Windows host due to assumptions that GDB is launching a POSIX-like shell. On Windows, we get CMD.EXE instead. There is a potential second group of failures on Windows host not addressed by this patch, due to the dependence of some of these tests on utilities like wc, sed, and grep. These tests happen to work for me because the test harness connects to the remote host using Cygwin ssh and both GDB and CMD.EXE inherit the PATH setting from the parent Cygwin shell. I don't know if disabling those tests on Windows host too is appropriate, or again if this is an instance of badly-designed tests that could be rewritten to avoid those dependencies. WDYT? -Sandra --------------4FF4F63CDDB099BBABDDC9C8 Content-Type: text/x-patch; charset="UTF-8"; name="windows-shell.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="windows-shell.patch" commit 6d3377fd7e040e1c6001af12f8d8b2dfa8b7b0c6 Author: Sandra Loosemore Date: Wed Jun 24 17:32:16 2020 -0700 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-06-24 Sandra Loosemore * gdb.base/shell.exp: Skip pipe tests dependent on sh on Windows host. Use double quotes instead of single quotes. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1b77459..aebfe8d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-06-24 Sandra Loosemore + + * gdb.base/shell.exp: Skip pipe tests dependent on sh on Windows host. + Use double quotes instead of single quotes. + 2020-06-24 Pedro Alves * gdb.arch/amd64-entry-value-paramref.exp: Use 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" --------------4FF4F63CDDB099BBABDDC9C8--