[LTP] [COMMITTED][PATCH 1/6] lib/test_net.sh: add EXPECT_RHOST_PASS/FAIL functions

Alexey Kodanev alexey.kodanev@oracle.com
Tue Jun 6 13:21:56 CEST 2017


Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test_net.sh |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 753a061..9d6e6cb 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -113,6 +113,26 @@ tst_rhost_run()
 	return $ret
 }
 
+EXPECT_RHOST_PASS()
+{
+	tst_rhost_run -c "$*" > /dev/null
+	if [ $? -eq 0 ]; then
+		tst_resm TPASS "$* passed as expected"
+	else
+		tst_resm TFAIL "$* failed unexpectedly"
+	fi
+}
+
+EXPECT_RHOST_FAIL()
+{
+	tst_rhost_run -c "$* 2> /dev/null"
+	if [ $? -ne 0 ]; then
+		tst_resm TPASS "$* failed as expected"
+	else
+		tst_resm TFAIL "$* passed unexpectedly"
+	fi
+}
+
 # Get test interface names for local/remote host.
 # tst_get_ifaces [TYPE]
 # TYPE: { lhost | rhost }; Default value is 'lhost'.
-- 
1.7.1



More information about the ltp mailing list