[Fuego] [PATCH v3] atmtcp: Add test cases for command atmtcp.
Wang Mingyu
wangmy at cn.fujitsu.com
Mon Aug 5 10:41:34 UTC 2019
This test set is used to check option help and subcommand virtual of atmtcp.
Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
tests/Functional.atmtcp/atmtcp_test.sh | 4 +++
tests/Functional.atmtcp/fuego_test.sh | 20 +++++++++++++
tests/Functional.atmtcp/spec.json | 7 +++++
tests/Functional.atmtcp/tests/atmtcp_help.sh | 15 ++++++++++
.../Functional.atmtcp/tests/atmtcp_virtual.sh | 29 +++++++++++++++++++
5 files changed, 75 insertions(+)
create mode 100644 tests/Functional.atmtcp/atmtcp_test.sh
create mode 100644 tests/Functional.atmtcp/fuego_test.sh
create mode 100644 tests/Functional.atmtcp/spec.json
create mode 100644 tests/Functional.atmtcp/tests/atmtcp_help.sh
create mode 100644 tests/Functional.atmtcp/tests/atmtcp_virtual.sh
diff --git a/tests/Functional.atmtcp/atmtcp_test.sh b/tests/Functional.atmtcp/atmtcp_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.atmtcp/atmtcp_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+ sh $i
+done
diff --git a/tests/Functional.atmtcp/fuego_test.sh b/tests/Functional.atmtcp/fuego_test.sh
new file mode 100644
index 0000000..2d42527
--- /dev/null
+++ b/tests/Functional.atmtcp/fuego_test.sh
@@ -0,0 +1,20 @@
+function test_pre_check {
+ assert_has_program atmtcp
+ assert_has_program lsmod
+ assert_has_program modprobe
+ assert_has_module atmtcp
+}
+
+function test_deploy {
+ put $TEST_HOME/atmtcp_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+ put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+ report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+ ./atmtcp_test.sh"
+}
+
+function test_processing {
+ log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.atmtcp/spec.json b/tests/Functional.atmtcp/spec.json
new file mode 100644
index 0000000..aff88cd
--- /dev/null
+++ b/tests/Functional.atmtcp/spec.json
@@ -0,0 +1,7 @@
+{
+ "testName": "Functional.atmtcp",
+ "specs": {
+ "default": {}
+ }
+}
+
diff --git a/tests/Functional.atmtcp/tests/atmtcp_help.sh b/tests/Functional.atmtcp/tests/atmtcp_help.sh
new file mode 100644
index 0000000..327fcdb
--- /dev/null
+++ b/tests/Functional.atmtcp/tests/atmtcp_help.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# In target, run command atmtcp to check the output of help.
+# option: -h
+
+test="help"
+
+atmtcp -h &> atmtcp_log
+if cat atmtcp_log | grep [Uu]sage
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi
+rm atmtcp_log
diff --git a/tests/Functional.atmtcp/tests/atmtcp_virtual.sh b/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
new file mode 100644
index 0000000..4aad2a1
--- /dev/null
+++ b/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# In target, run command atmtcp.
+# option: virtual
+
+test="virtual"
+
+if lsmod | grep atmtcp
+then
+ echo " -> $test: atmtcp is already loaded."
+else
+ if modprobe -v atmtcp
+ then
+ echo " -> $test: load atmtcp succeeded."
+ else
+ echo " -> $test: load atmtcp failed."
+ echo " -> $test: TEST-FAIL"
+ exit
+ fi
+fi
+
+if [ ! -n "$(atmtcp virtual connect 127.0.0.1 | grep "virtual interface 0")" ]
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi
+
+killall atmtcp
--
2.17.1
More information about the Fuego
mailing list