[Fuego] [PATCH v2] atmtcp: Add test cases for command atmtcp.

Wang Mingyu wangmy at cn.fujitsu.com
Mon Mar 25 09:19:19 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           | 17 +++++++++++++++++
 tests/Functional.atmtcp/parser.py               | 20 ++++++++++++++++++++
 tests/Functional.atmtcp/spec.json               |  6 ++++++
 tests/Functional.atmtcp/tests/atmtcp_help.sh    | 16 ++++++++++++++++
 tests/Functional.atmtcp/tests/atmtcp_virtual.sh | 24 ++++++++++++++++++++++++
 6 files changed, 87 insertions(+)
 create mode 100755 tests/Functional.atmtcp/atmtcp_test.sh
 create mode 100644 tests/Functional.atmtcp/fuego_test.sh
 create mode 100644 tests/Functional.atmtcp/parser.py
 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 100755
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..f4fefe9
--- /dev/null
+++ b/tests/Functional.atmtcp/fuego_test.sh
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program 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/parser.py b/tests/Functional.atmtcp/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.atmtcp/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.atmtcp/spec.json b/tests/Functional.atmtcp/spec.json
new file mode 100644
index 0000000..423ae88
--- /dev/null
+++ b/tests/Functional.atmtcp/spec.json
@@ -0,0 +1,6 @@
+{
+    "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..e019355
--- /dev/null
+++ b/tests/Functional.atmtcp/tests/atmtcp_help.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: -h
+
+test="help"
+
+expect <<-EOF
+spawn atmtcp -h
+expect {
+ "usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
diff --git a/tests/Functional.atmtcp/tests/atmtcp_virtual.sh b/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
new file mode 100644
index 0000000..8b7c55d
--- /dev/null
+++ b/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: virtual
+
+test="virtual"
+
+if modprobe -v atmtcp
+then
+    echo " -> $test: modprobe atmtcp execution succeeded."
+else
+    echo " -> $test: modprobe atmtcp execution failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+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
-- 
1.8.3.1





More information about the Fuego mailing list