From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: gdb-patches@sourceware.org
Cc: Philippe Waroquiers <philippe.waroquiers@skynet.be>
Subject: [RFAv2 5/6] Test the | (pipe) command.
Date: Fri, 26 Apr 2019 20:11:00 -0000 [thread overview]
Message-ID: <20190426201108.7489-6-philippe.waroquiers@skynet.be> (raw)
In-Reply-To: <20190426201108.7489-1-philippe.waroquiers@skynet.be>
gdb/testsuite/ChangeLog
2019-04-26 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* 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 <http://www.gnu.org/licenses/>.
-# 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"
+
--
2.20.1
next prev parent reply other threads:[~2019-04-26 20:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 20:11 [RFAv2 0/6] Implement " Philippe Waroquiers
2019-04-26 20:11 ` [RFAv2 3/6] Add function execute_command_to_ui_file Philippe Waroquiers
2019-04-26 20:11 ` [RFAv2 2/6] Improve process exit status macros on MinGW Philippe Waroquiers
2019-04-26 20:11 ` [RFAv2 1/6] Add previous_saved_command_line to allow a command to repeat a previous command Philippe Waroquiers
2019-04-26 20:11 ` Philippe Waroquiers [this message]
2019-04-26 20:11 ` [RFAv2 4/6] Implement | (pipe) command Philippe Waroquiers
2019-05-03 18:59 ` Pedro Alves
2019-05-04 6:24 ` Philippe Waroquiers
2019-05-27 13:12 ` Pedro Alves
2019-04-26 20:11 ` [RFAv2 6/6] NEWS and documentation for " Philippe Waroquiers
2019-04-27 7:08 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190426201108.7489-6-philippe.waroquiers@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).