diff mbox series

[2/2] commands: Add shell pipe test

Message ID 20210408184503.28414-2-pvorel@suse.cz
State Changes Requested
Headers show
Series [1/2] splice02: Generate input in C | expand

Commit Message

Petr Vorel April 8, 2021, 6:45 p.m. UTC
This adds basic shell pipe testing, which was removed from splice02
in 85cebe238 ("splice02: Generate input in C").

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v2.
Maybe there should be new runtest runtest/shell and test added into new
directory testcases/shell/ or testcases/misc/shell/.
But I didn't want to create new directory for single simple test
and certainly not new runtest file for a single test.

Kind regards,
Petr

 runtest/commands                         |  1 +
 runtest/smoketest                        |  1 +
 testcases/commands/shell/shell_pipe01.sh | 17 +++++++++++++++++
 3 files changed, 19 insertions(+)
 create mode 100755 testcases/commands/shell/shell_pipe01.sh

Comments

Cyril Hrubis April 9, 2021, 11 a.m. UTC | #1
Hi!
Maybe we do not need that in commands, but I guess that it does not harm
at least.

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
diff mbox series

Patch

diff --git a/runtest/commands b/runtest/commands
index 058266b54..8cfad0449 100644
--- a/runtest/commands
+++ b/runtest/commands
@@ -41,3 +41,4 @@  gdb01_sh gdb01.sh
 unshare01_sh unshare01.sh
 sysctl01_sh sysctl01.sh
 sysctl02_sh sysctl02.sh
+shell_test01 echo "SUCCESS" | shell_pipe01.sh
diff --git a/runtest/smoketest b/runtest/smoketest
index ec0c088cb..85f377192 100644
--- a/runtest/smoketest
+++ b/runtest/smoketest
@@ -13,3 +13,4 @@  utime01A symlink01 -T utime01
 rename01A symlink01 -T rename01
 splice02 splice02 -n 20
 route4-change-dst route-change-dst.sh
+shell_test01 echo "SUCCESS" | shell_pipe01.sh
diff --git a/testcases/commands/shell/shell_pipe01.sh b/testcases/commands/shell/shell_pipe01.sh
new file mode 100755
index 000000000..3c8ef49fb
--- /dev/null
+++ b/testcases/commands/shell/shell_pipe01.sh
@@ -0,0 +1,17 @@ 
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>
+
+TST_TESTFUNC=do_test
+
+. tst_test.sh
+
+do_test()
+{
+	tst_res TINFO "expecting SUCCESS string passed from stdin"
+
+	read line
+	EXPECT_PASS [ "$line" = "SUCCESS" ]
+}
+
+tst_run