From patchwork Fri Apr 26 20:11:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe Waroquiers X-Patchwork-Id: 32432 Received: (qmail 112810 invoked by alias); 26 Apr 2019 20:11:27 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 112739 invoked by uid 89); 26 Apr 2019 20:11:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=verifications, 22, 3, HContent-Transfer-Encoding:8bit X-HELO: mailsec108.isp.belgacom.be Received: from mailsec108.isp.belgacom.be (HELO mailsec108.isp.belgacom.be) (195.238.20.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 26 Apr 2019 20:11:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1556309485; x=1587845485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NYPVpC70xdpAy1E7fEyPcQX+T3sl+qeKA75JEXpZjDE=; b=hWbOYGknvS34ooPfrYyo1wY+zWPT4MUtokhQvAObzQAF6+sORH+xbhDn VVlp2oHdd13lWkQmv9lGdHQQDjewyA==; Received: from 59.151-129-109.adsl-dyn.isp.belgacom.be (HELO md.home) ([109.129.151.59]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 26 Apr 2019 22:11:14 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Cc: Philippe Waroquiers Subject: [RFAv2 5/6] Test the | (pipe) command. Date: Fri, 26 Apr 2019 22:11:07 +0200 Message-Id: <20190426201108.7489-6-philippe.waroquiers@skynet.be> In-Reply-To: <20190426201108.7489-1-philippe.waroquiers@skynet.be> References: <20190426201108.7489-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 X-IsSubscribed: yes gdb/testsuite/ChangeLog 2019-04-26 Philippe Waroquiers * gdb.base/shell.exp: Test pipe command. --- gdb/testsuite/gdb.base/shell.exp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/shell.exp b/gdb/testsuite/gdb.base/shell.exp index 60d6e31e4f..30516286cf 100644 --- a/gdb/testsuite/gdb.base/shell.exp +++ b/gdb/testsuite/gdb.base/shell.exp @@ -13,7 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Test that the shell and ! commands work. +# Test that the shell and ! and | and pipe commands work. gdb_exit gdb_start @@ -22,3 +22,31 @@ gdb_test "shell echo foo" "foo" gdb_test "! echo foo" "foo" gdb_test "!echo foo" "foo" + +gdb_test "pipe help pipe | wc -l" "10" "check simple pipe" +gdb_test "pipe help pipe | grep Usage: | wc -l" "4" "check double pipe" + +gdb_test "| help pipe | grep Usage: | wc -l" "4" "check double pipe, pipe char" +gdb_test "|help pipe|grep Usage:|wc -l" "4" "no space around pipe char" + +gdb_test "echo coucou\\n" "coucou" "echo coucou" +gdb_test "||wc -l" "1" "Check repeat previous command" + +gdb_test "| -d! echo this contains a | character\\n ! sed -e 's/|/PIPE/'" \ + "this contains a PIPE character" "verify alternate separator" + +gdb_test "|-d! echo this contains a | character\\n!sed -e 's/|/PIPE/'" \ + "this contains a PIPE character" "verify alternate separator, no space" + +# Some error handling verifications. +gdb_test "|" "Missing \\\"\[COMMAND\] | SHELL_COMMAND\\\"" "all missing" +gdb_test "| echo coucou" \ + "Missing | SHELL_COMMAND in \\\"| COMMAND | SHELL_COMMAND\\\"" \ + "pipe SHELL_COMMAND missing" +gdb_test "|-d echo coucou" \ + "Missing separator X after -d in \\\"| -dX COMMAND X SHELL_COMMAND\\\"" \ + "separator missing" +gdb_test "|-d! echo coucou" \ + "Missing ! SHELL_COMMAND in \\\"| -d! COMMAND ! SHELL_COMMAND\\\"" \ + "separator SHELL_COMMAND missing" +