[Fuego] [PATCH] Add test cases of service hostapd.

Wang Mingyu wangmy at cn.fujitsu.com
Tue Nov 6 13:56:22 UTC 2018


Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.hostapd/fuego_test.sh      | 18 ++++++++++++++++++
 engine/tests/Functional.hostapd/hostapd_test.sh    |  4 ++++
 engine/tests/Functional.hostapd/parser.py          | 22 ++++++++++++++++++++++
 engine/tests/Functional.hostapd/spec.json          |  7 +++++++
 .../tests/Functional.hostapd/tests/hostapd_help.sh | 15 +++++++++++++++
 .../Functional.hostapd/tests/hostapd_service.sh    | 19 +++++++++++++++++++
 6 files changed, 85 insertions(+)
 create mode 100644 engine/tests/Functional.hostapd/fuego_test.sh
 create mode 100755 engine/tests/Functional.hostapd/hostapd_test.sh
 create mode 100644 engine/tests/Functional.hostapd/parser.py
 create mode 100644 engine/tests/Functional.hostapd/spec.json
 create mode 100644 engine/tests/Functional.hostapd/tests/hostapd_help.sh
 create mode 100644 engine/tests/Functional.hostapd/tests/hostapd_service.sh

diff --git a/engine/tests/Functional.hostapd/fuego_test.sh b/engine/tests/Functional.hostapd/fuego_test.sh
new file mode 100644
index 0000000..7a25a72
--- /dev/null
+++ b/engine/tests/Functional.hostapd/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program hostapd
+}
+
+function test_deploy {
+    put $TEST_HOME/hostapd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./hostapd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.hostapd/hostapd_test.sh b/engine/tests/Functional.hostapd/hostapd_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.hostapd/hostapd_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.hostapd/parser.py b/engine/tests/Functional.hostapd/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.hostapd/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+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/engine/tests/Functional.hostapd/spec.json b/engine/tests/Functional.hostapd/spec.json
new file mode 100644
index 0000000..db494d6
--- /dev/null
+++ b/engine/tests/Functional.hostapd/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.hostapd",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.hostapd/tests/hostapd_help.sh b/engine/tests/Functional.hostapd/tests/hostapd_help.sh
new file mode 100644
index 0000000..a5b904b
--- /dev/null
+++ b/engine/tests/Functional.hostapd/tests/hostapd_help.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command hostapd.
+#  option: --help.
+
+test="help"
+
+hostapd --help > help_log 2>&1
+if cat help_log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm help_log
diff --git a/engine/tests/Functional.hostapd/tests/hostapd_service.sh b/engine/tests/Functional.hostapd/tests/hostapd_service.sh
new file mode 100644
index 0000000..4ca6114
--- /dev/null
+++ b/engine/tests/Functional.hostapd/tests/hostapd_service.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In the target to start hostapd and confirm the return value of the daemon startup script is "0"..
+#  option: none
+
+test="service"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target hostapd stop
+
+if exec_service_on_target hostapd start
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
-- 
1.8.3.1





More information about the Fuego mailing list