All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH v2] Add test case of service openct.
@ 2019-03-06 10:07 Wang Mingyu
  2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test case of service openhpid Wang Mingyu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Wang Mingyu @ 2019-03-06 10:07 UTC (permalink / raw)
  To: fuego

OpenCT implements drivers for several smart card readers.
This test set is used to check the command openct-tool and openct-control of service openct.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.openct/fuego_test.sh          | 19 +++++++++++
 tests/Functional.openct/openct_test.sh         |  4 +++
 tests/Functional.openct/parser.py              | 22 +++++++++++++
 tests/Functional.openct/spec.json              |  7 ++++
 tests/Functional.openct/tests/openct_help.sh   | 12 +++++++
 tests/Functional.openct/tests/openct_status.sh | 44 ++++++++++++++++++++++++++
 6 files changed, 108 insertions(+)
 create mode 100644 tests/Functional.openct/fuego_test.sh
 create mode 100755 tests/Functional.openct/openct_test.sh
 create mode 100644 tests/Functional.openct/parser.py
 create mode 100644 tests/Functional.openct/spec.json
 create mode 100644 tests/Functional.openct/tests/openct_help.sh
 create mode 100644 tests/Functional.openct/tests/openct_status.sh

diff --git a/tests/Functional.openct/fuego_test.sh b/tests/Functional.openct/fuego_test.sh
new file mode 100644
index 0000000..55881e3
--- /dev/null
+++ b/tests/Functional.openct/fuego_test.sh
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program openct-control
+    assert_has_program openct-tool
+}
+
+function test_deploy {
+    put $TEST_HOME/openct_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/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;\
+    ./openct_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.openct/openct_test.sh b/tests/Functional.openct/openct_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.openct/openct_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.openct/parser.py b/tests/Functional.openct/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/tests/Functional.openct/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/tests/Functional.openct/spec.json b/tests/Functional.openct/spec.json
new file mode 100644
index 0000000..e758b687
--- /dev/null
+++ b/tests/Functional.openct/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.openct",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/tests/Functional.openct/tests/openct_help.sh b/tests/Functional.openct/tests/openct_help.sh
new file mode 100644
index 0000000..e7f6c9f
--- /dev/null
+++ b/tests/Functional.openct/tests/openct_help.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  Check the help message of command openct-control.
+
+test="help"
+
+if openct-control -h | grep "usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.openct/tests/openct_status.sh b/tests/Functional.openct/tests/openct_status.sh
new file mode 100644
index 0000000..ce59cb7
--- /dev/null
+++ b/tests/Functional.openct/tests/openct_status.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#  In the target start openct, and confirm the status.
+
+test="status"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status openct)
+
+exec_service_on_target openct stop
+
+if exec_service_on_target openct start
+then
+    echo " -> start of openct succeeded."
+else
+    echo " -> start of openct failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if [ "$init_manager" = "systemd" ]
+then
+    if systemctl is-active openct
+    then
+        echo " -> $test: TEST-PASS"
+    else
+        echo " -> $test: TEST-FAIL"
+    fi
+else
+    if service openct status | grep "Waiting for reader attach/detach events"
+    then
+        echo " -> $test: TEST-PASS"
+    else
+        echo " -> $test: TEST-FAIL"
+    fi
+fi
+
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target openct stop
+fi
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Fuego] [PATCH v2] Add test case of service openhpid.
  2019-03-06 10:07 [Fuego] [PATCH v2] Add test case of service openct Wang Mingyu
@ 2019-03-06 10:07 ` Wang Mingyu
  2019-03-13 22:14   ` Tim.Bird
  2019-03-06 10:07 ` [Fuego] [PATCH] Add test cases for command brctl Wang Mingyu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Wang Mingyu @ 2019-03-06 10:07 UTC (permalink / raw)
  To: fuego

The openhpid is HPI instance to which multiple clients can connect.
This test set is used to check if the ps of service can be generated successfully.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.openhpid/fuego_test.sh        | 18 ++++++++++++++++++
 tests/Functional.openhpid/openhpid_test.sh     |  4 ++++
 tests/Functional.openhpid/parser.py            | 22 ++++++++++++++++++++++
 tests/Functional.openhpid/spec.json            |  7 +++++++
 tests/Functional.openhpid/tests/openhpid_ps.sh | 26 ++++++++++++++++++++++++++
 5 files changed, 77 insertions(+)
 create mode 100644 tests/Functional.openhpid/fuego_test.sh
 create mode 100755 tests/Functional.openhpid/openhpid_test.sh
 create mode 100644 tests/Functional.openhpid/parser.py
 create mode 100644 tests/Functional.openhpid/spec.json
 create mode 100644 tests/Functional.openhpid/tests/openhpid_ps.sh

diff --git a/tests/Functional.openhpid/fuego_test.sh b/tests/Functional.openhpid/fuego_test.sh
new file mode 100644
index 0000000..f90897a
--- /dev/null
+++ b/tests/Functional.openhpid/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program openhpid
+}
+
+function test_deploy {
+    put $TEST_HOME/openhpid_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/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;\
+    ./openhpid_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.openhpid/openhpid_test.sh b/tests/Functional.openhpid/openhpid_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.openhpid/openhpid_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.openhpid/parser.py b/tests/Functional.openhpid/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/tests/Functional.openhpid/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/tests/Functional.openhpid/spec.json b/tests/Functional.openhpid/spec.json
new file mode 100644
index 0000000..9004c0d
--- /dev/null
+++ b/tests/Functional.openhpid/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.openhpid",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/tests/Functional.openhpid/tests/openhpid_ps.sh b/tests/Functional.openhpid/tests/openhpid_ps.sh
new file mode 100644
index 0000000..f812827
--- /dev/null
+++ b/tests/Functional.openhpid/tests/openhpid_ps.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#  In the target start openhpid, and confirm the process condition by command ps.
+
+test="ps"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status openhpid)
+
+exec_service_on_target openhpid stop
+
+if exec_service_on_target openhpid start
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> start of openhpid failed."
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target openhpid stop
+fi
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Fuego] [PATCH] Add test cases for command brctl.
  2019-03-06 10:07 [Fuego] [PATCH v2] Add test case of service openct Wang Mingyu
  2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test case of service openhpid Wang Mingyu
@ 2019-03-06 10:07 ` Wang Mingyu
  2019-03-13 22:23   ` Tim.Bird
  2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test cases of service multipathd Wang Mingyu
  2019-03-13 22:19 ` [Fuego] [PATCH v2] Add test case of service openct Tim.Bird
  3 siblings, 1 reply; 9+ messages in thread
From: Wang Mingyu @ 2019-03-06 10:07 UTC (permalink / raw)
  To: fuego

brctl is used to set up, maintain, and inspect the ethernet bridge configuration in the linux kernel.
This test set is used to check if brctl can creat/delete/show the bridge.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.brctl/brctl_test.sh            |  4 ++++
 tests/Functional.brctl/fuego_test.sh            | 17 +++++++++++++++++
 tests/Functional.brctl/parser.py                | 22 ++++++++++++++++++++++
 tests/Functional.brctl/spec.json                |  7 +++++++
 tests/Functional.brctl/tests/brctl_addbr.sh     | 15 +++++++++++++++
 tests/Functional.brctl/tests/brctl_delbr.sh     | 14 ++++++++++++++
 tests/Functional.brctl/tests/brctl_setageing.sh | 16 ++++++++++++++++
 tests/Functional.brctl/tests/brctl_sethello.sh  | 16 ++++++++++++++++
 tests/Functional.brctl/tests/brctl_show.sh      | 15 +++++++++++++++
 tests/Functional.brctl/tests/brctl_showstp.sh   | 15 +++++++++++++++
 10 files changed, 141 insertions(+)
 create mode 100755 tests/Functional.brctl/brctl_test.sh
 create mode 100644 tests/Functional.brctl/fuego_test.sh
 create mode 100644 tests/Functional.brctl/parser.py
 create mode 100644 tests/Functional.brctl/spec.json
 create mode 100644 tests/Functional.brctl/tests/brctl_addbr.sh
 create mode 100644 tests/Functional.brctl/tests/brctl_delbr.sh
 create mode 100644 tests/Functional.brctl/tests/brctl_setageing.sh
 create mode 100644 tests/Functional.brctl/tests/brctl_sethello.sh
 create mode 100644 tests/Functional.brctl/tests/brctl_show.sh
 create mode 100644 tests/Functional.brctl/tests/brctl_showstp.sh

diff --git a/tests/Functional.brctl/brctl_test.sh b/tests/Functional.brctl/brctl_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.brctl/brctl_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.brctl/fuego_test.sh b/tests/Functional.brctl/fuego_test.sh
new file mode 100644
index 0000000..f857ff7
--- /dev/null
+++ b/tests/Functional.brctl/fuego_test.sh
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program brctl
+}
+
+function test_deploy {
+    put $TEST_HOME/brctl_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./brctl_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.brctl/parser.py b/tests/Functional.brctl/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/tests/Functional.brctl/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/tests/Functional.brctl/spec.json b/tests/Functional.brctl/spec.json
new file mode 100644
index 0000000..f0dcc8e
--- /dev/null
+++ b/tests/Functional.brctl/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.brctl",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/tests/Functional.brctl/tests/brctl_addbr.sh b/tests/Functional.brctl/tests/brctl_addbr.sh
new file mode 100644
index 0000000..78678c3
--- /dev/null
+++ b/tests/Functional.brctl/tests/brctl_addbr.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : addbr
+
+test="brctl->addbr"
+
+brctl addbr br0
+if ifconfig br0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/tests/Functional.brctl/tests/brctl_delbr.sh b/tests/Functional.brctl/tests/brctl_delbr.sh
new file mode 100644
index 0000000..bafe33f
--- /dev/null
+++ b/tests/Functional.brctl/tests/brctl_delbr.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : delbr
+
+test="brctl->delbr"
+
+brctl addbr br0
+if brctl delbr br0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.brctl/tests/brctl_setageing.sh b/tests/Functional.brctl/tests/brctl_setageing.sh
new file mode 100644
index 0000000..20d1e68
--- /dev/null
+++ b/tests/Functional.brctl/tests/brctl_setageing.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : setageing
+
+test="brctl->setageing"
+
+brctl addbr br0
+brctl setageing br0 200.00
+if brctl showstp br0 | grep "ageing time.*200.00"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/tests/Functional.brctl/tests/brctl_sethello.sh b/tests/Functional.brctl/tests/brctl_sethello.sh
new file mode 100644
index 0000000..4e351b7
--- /dev/null
+++ b/tests/Functional.brctl/tests/brctl_sethello.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : sethello
+
+test="brctl->sethello"
+
+brctl addbr br0
+brctl sethello br0 5.00
+if brctl showstp br0 | grep "hello time.*5.00"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/tests/Functional.brctl/tests/brctl_show.sh b/tests/Functional.brctl/tests/brctl_show.sh
new file mode 100644
index 0000000..68d9c02
--- /dev/null
+++ b/tests/Functional.brctl/tests/brctl_show.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : show
+
+test="brctl->show"
+
+brctl addbr br0
+if brctl show | grep br0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/tests/Functional.brctl/tests/brctl_showstp.sh b/tests/Functional.brctl/tests/brctl_showstp.sh
new file mode 100644
index 0000000..9ce687b
--- /dev/null
+++ b/tests/Functional.brctl/tests/brctl_showstp.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : showstp
+
+test="brctl->showstp"
+
+brctl addbr br0
+if brctl showstp br0 | grep "bridge id"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Fuego] [PATCH v2] Add test cases of service multipathd.
  2019-03-06 10:07 [Fuego] [PATCH v2] Add test case of service openct Wang Mingyu
  2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test case of service openhpid Wang Mingyu
  2019-03-06 10:07 ` [Fuego] [PATCH] Add test cases for command brctl Wang Mingyu
@ 2019-03-06 10:07 ` Wang Mingyu
  2019-03-13 22:26   ` Tim.Bird
  2019-03-13 22:19 ` [Fuego] [PATCH v2] Add test case of service openct Tim.Bird
  3 siblings, 1 reply; 9+ messages in thread
From: Wang Mingyu @ 2019-03-06 10:07 UTC (permalink / raw)
  To: fuego

The multipathd daemon is in charge of checking for failed paths.
This test set is used to check if the ps, pidfile and syslog of the service can be generated successfully.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.multipathd/fuego_test.sh          | 18 ++++++
 tests/Functional.multipathd/multipathd_test.sh     |  7 +++
 tests/Functional.multipathd/parser.py              | 22 +++++++
 tests/Functional.multipathd/spec.json              |  7 +++
 .../tests/multipathd_pidfile.sh                    | 71 ++++++++++++++++++++++
 tests/Functional.multipathd/tests/multipathd_ps.sh | 69 +++++++++++++++++++++
 .../Functional.multipathd/tests/multipathd_show.sh | 51 ++++++++++++++++
 .../tests/multipathd_syslog.sh                     | 70 +++++++++++++++++++++
 8 files changed, 315 insertions(+)
 create mode 100644 tests/Functional.multipathd/fuego_test.sh
 create mode 100755 tests/Functional.multipathd/multipathd_test.sh
 create mode 100644 tests/Functional.multipathd/parser.py
 create mode 100644 tests/Functional.multipathd/spec.json
 create mode 100644 tests/Functional.multipathd/tests/multipathd_pidfile.sh
 create mode 100644 tests/Functional.multipathd/tests/multipathd_ps.sh
 create mode 100644 tests/Functional.multipathd/tests/multipathd_show.sh
 create mode 100644 tests/Functional.multipathd/tests/multipathd_syslog.sh

diff --git a/tests/Functional.multipathd/fuego_test.sh b/tests/Functional.multipathd/fuego_test.sh
new file mode 100644
index 0000000..81454fa
--- /dev/null
+++ b/tests/Functional.multipathd/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program multipathd
+}
+
+function test_deploy {
+    put $TEST_HOME/multipathd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/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;\
+    ./multipathd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.multipathd/multipathd_test.sh b/tests/Functional.multipathd/multipathd_test.sh
new file mode 100755
index 0000000..95c34db
--- /dev/null
+++ b/tests/Functional.multipathd/multipathd_test.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
+for i in tests/*.sh; do
+    source $i
+done
diff --git a/tests/Functional.multipathd/parser.py b/tests/Functional.multipathd/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/tests/Functional.multipathd/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/tests/Functional.multipathd/spec.json b/tests/Functional.multipathd/spec.json
new file mode 100644
index 0000000..e444db0
--- /dev/null
+++ b/tests/Functional.multipathd/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.multipathd",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/tests/Functional.multipathd/tests/multipathd_pidfile.sh b/tests/Functional.multipathd/tests/multipathd_pidfile.sh
new file mode 100644
index 0000000..6240f87
--- /dev/null
+++ b/tests/Functional.multipathd/tests/multipathd_pidfile.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+#  In the target start multipathd, and check if the /var/run/multipathd.pid is exist
+#  check the keyword "multipathd".
+
+test="pidfile"
+
+service_status=$(get_service_status multipathd)
+
+exec_service_on_target multipathd stop
+
+if [ -f /etc/multipath.conf ]
+then
+    cp /etc/multipath.conf /etc/multipath.conf_bak
+fi
+
+if [ -f /etc/multipath.conf.example ]
+then
+    cp /etc/multipath.conf.example /etc/multipath.conf
+fi
+
+restore_target() {
+    if [ -f /etc/multipath.conf_bak ]
+    then
+        mv /etc/multipath.conf_bak /etc/multipath.conf
+    else
+        rm -f /etc/multipath.conf
+    fi
+}
+
+if exec_service_on_target multipathd start
+then
+    echo " -> start of multipathd succeeded."
+else
+    echo " -> start of multipathd failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 10
+
+if test -f /var/run/multipathd.pid
+then
+    echo " -> get the pidfile of multipathd."
+else
+    echo " -> can't get the pidfile of multipathd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target multipathd stop
+    restore_target
+    if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+    then
+        exec_service_on_target multipathd start
+    fi
+    exit
+fi
+
+exec_service_on_target multipathd stop
+
+if test ! -f /var/run/multipathd.pid
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+restore_target
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target multipathd start
+fi
diff --git a/tests/Functional.multipathd/tests/multipathd_ps.sh b/tests/Functional.multipathd/tests/multipathd_ps.sh
new file mode 100644
index 0000000..86c4352
--- /dev/null
+++ b/tests/Functional.multipathd/tests/multipathd_ps.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+#  In the target start multipathd, and confirm the process condition by command ps.
+
+test="ps"
+
+service_status=$(get_service_status multipathd)
+
+exec_service_on_target multipathd stop
+
+if [ -f /etc/multipath.conf ]
+then
+    cp /etc/multipath.conf /etc/multipath.conf_bak
+fi
+
+if [ -f /etc/multipath.conf.example ]
+then
+    cp /etc/multipath.conf.example /etc/multipath.conf
+fi
+
+restore_target() {
+    if [ -f /etc/multipath.conf_bak ]
+    then
+        mv /etc/multipath.conf_bak /etc/multipath.conf
+    else
+        rm -f /etc/multipath.conf
+    fi
+}
+
+if exec_service_on_target multipathd start
+then
+    echo " -> start of multipathd succeeded."
+else
+    echo " -> start of multipathd failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]sbin/multipathd"
+then
+    echo " -> get the process of multipathd."
+else
+    echo " -> can't get the process of multipathd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target multipathd stop
+    restore_target
+    if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+    then
+        exec_service_on_target multipathd start
+    fi
+    exit
+fi
+
+exec_service_on_target multipathd stop
+
+if ps aux | grep "[/]sbin/multipathd"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
+restore_target
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target multipathd start
+fi
diff --git a/tests/Functional.multipathd/tests/multipathd_show.sh b/tests/Functional.multipathd/tests/multipathd_show.sh
new file mode 100644
index 0000000..73ac45a
--- /dev/null
+++ b/tests/Functional.multipathd/tests/multipathd_show.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+#  In the target start multipathd, and show the format wildcards used in interactive commands taking $format.
+
+test="show"
+
+service_status=$(get_service_status multipathd)
+
+exec_service_on_target multipathd stop
+
+if [ -f /etc/multipath.conf ]
+then
+    cp /etc/multipath.conf /etc/multipath.conf_bak
+fi
+
+if [ -f /etc/multipath.conf.example ]
+then
+    cp /etc/multipath.conf.example /etc/multipath.conf
+fi
+
+restore_target() {
+    if [ -f /etc/multipath.conf_bak ]
+    then
+        mv /etc/multipath.conf_bak /etc/multipath.conf
+    else
+        rm -f /etc/multipath.conf
+    fi
+}
+
+if exec_service_on_target multipathd start
+then
+    echo " -> start of multipathd succeeded."
+else
+    echo " -> start of multipathd failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+if multipathd show wildcards | grep "multipath format wildcards:"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+restore_target
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target multipathd start
+fi
diff --git a/tests/Functional.multipathd/tests/multipathd_syslog.sh b/tests/Functional.multipathd/tests/multipathd_syslog.sh
new file mode 100644
index 0000000..dbfcd55
--- /dev/null
+++ b/tests/Functional.multipathd/tests/multipathd_syslog.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+#  In the target start multipathd, and check the messages of /var/log/syslog.
+#  check the keyword "multipathd".
+
+test="syslog"
+
+logger_service=$(detect_logger_service)
+
+service_status=$(get_service_status multipathd)
+
+exec_service_on_target multipathd stop
+exec_service_on_target $logger_service stop
+
+if [ -f /etc/multipath.conf ]
+then
+    cp /etc/multipath.conf /etc/multipath.conf_bak
+fi
+
+if [ -f /etc/multipath.conf.example ]
+then
+    cp /etc/multipath.conf.example /etc/multipath.conf
+fi
+
+if [ -f /var/log/syslog ]
+then
+    mv /var/log/syslog /var/log/syslog_bak
+fi
+
+restore_target() {
+    if [ -f /etc/multipath.conf_bak ]
+    then
+        mv /etc/multipath.conf_bak /etc/multipath.conf
+    else
+        rm -f /etc/multipath.conf
+    fi
+
+    if [ -f /var/log/syslog_bak ]
+    then
+        mv /var/log/syslog_bak /var/log/syslog
+    fi
+}
+
+exec_service_on_target $logger_service restart
+
+if exec_service_on_target multipathd start
+then
+    echo " -> start of multipathd succeeded."
+else
+    echo " -> start of multipathd failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 10
+
+if cat /var/log/syslog | grep "multipath"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target multipathd stop
+restore_target
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target multipathd start
+fi
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Fuego] [PATCH v2] Add test case of service openhpid.
  2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test case of service openhpid Wang Mingyu
@ 2019-03-13 22:14   ` Tim.Bird
  0 siblings, 0 replies; 9+ messages in thread
From: Tim.Bird @ 2019-03-13 22:14 UTC (permalink / raw)
  To: wangmy, fuego

I have the same comments for this test as for the ipmi test.
But still - Applied.  Thanks,
 -- Tim


> -----Original Message-----
> From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> bounces@lists.linuxfoundation.org] On Behalf Of Wang Mingyu
> Sent: Wednesday, March 06, 2019 2:08 AM
> To: fuego@lists.linuxfoundation.org
> Subject: [Fuego] [PATCH v2] Add test case of service openhpid.
> 
> The openhpid is HPI instance to which multiple clients can connect.
> This test set is used to check if the ps of service can be generated
> successfully.
> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.openhpid/fuego_test.sh        | 18 ++++++++++++++++++
>  tests/Functional.openhpid/openhpid_test.sh     |  4 ++++
>  tests/Functional.openhpid/parser.py            | 22 ++++++++++++++++++++++
>  tests/Functional.openhpid/spec.json            |  7 +++++++
>  tests/Functional.openhpid/tests/openhpid_ps.sh | 26
> ++++++++++++++++++++++++++
>  5 files changed, 77 insertions(+)
>  create mode 100644 tests/Functional.openhpid/fuego_test.sh
>  create mode 100755 tests/Functional.openhpid/openhpid_test.sh
>  create mode 100644 tests/Functional.openhpid/parser.py
>  create mode 100644 tests/Functional.openhpid/spec.json
>  create mode 100644 tests/Functional.openhpid/tests/openhpid_ps.sh
> 
> diff --git a/tests/Functional.openhpid/fuego_test.sh
> b/tests/Functional.openhpid/fuego_test.sh
> new file mode 100644
> index 0000000..f90897a
> --- /dev/null
> +++ b/tests/Functional.openhpid/fuego_test.sh
> @@ -0,0 +1,18 @@
> +function test_pre_check {
> +    assert_has_program openhpid
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/openhpid_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put $FUEGO_CORE/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;\
> +    ./openhpid_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/tests/Functional.openhpid/openhpid_test.sh
> b/tests/Functional.openhpid/openhpid_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/tests/Functional.openhpid/openhpid_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/tests/Functional.openhpid/parser.py
> b/tests/Functional.openhpid/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/tests/Functional.openhpid/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/tests/Functional.openhpid/spec.json
> b/tests/Functional.openhpid/spec.json
> new file mode 100644
> index 0000000..9004c0d
> --- /dev/null
> +++ b/tests/Functional.openhpid/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.openhpid",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
> diff --git a/tests/Functional.openhpid/tests/openhpid_ps.sh
> b/tests/Functional.openhpid/tests/openhpid_ps.sh
> new file mode 100644
> index 0000000..f812827
> --- /dev/null
> +++ b/tests/Functional.openhpid/tests/openhpid_ps.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +
> +#  In the target start openhpid, and confirm the process condition by
> command ps.
> +
> +test="ps"
> +
> +. ./fuego_board_function_lib.sh
> +
> +set_init_manager
> +
> +service_status=$(get_service_status openhpid)
> +
> +exec_service_on_target openhpid stop
> +
> +if exec_service_on_target openhpid start
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> start of openhpid failed."
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +if [ "$service_status" = "inactive" ]
> +then
> +    exec_service_on_target openhpid stop
> +fi
> --
> 1.8.3.1
> 
> 
> 
> _______________________________________________
> Fuego mailing list
> Fuego@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Fuego] [PATCH v2] Add test case of service openct.
  2019-03-06 10:07 [Fuego] [PATCH v2] Add test case of service openct Wang Mingyu
                   ` (2 preceding siblings ...)
  2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test cases of service multipathd Wang Mingyu
@ 2019-03-13 22:19 ` Tim.Bird
  3 siblings, 0 replies; 9+ messages in thread
From: Tim.Bird @ 2019-03-13 22:19 UTC (permalink / raw)
  To: wangmy, fuego

See comments inline below.

> -----Original Message-----
> From: Wang Mingyu
> 
> OpenCT implements drivers for several smart card readers.
> This test set is used to check the command openct-tool and openct-control
> of service openct.
This line was too long.  Please keep lines in commit messages to 80-characters.

> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.openct/fuego_test.sh          | 19 +++++++++++
>  tests/Functional.openct/openct_test.sh         |  4 +++
>  tests/Functional.openct/parser.py              | 22 +++++++++++++
>  tests/Functional.openct/spec.json              |  7 ++++
>  tests/Functional.openct/tests/openct_help.sh   | 12 +++++++
>  tests/Functional.openct/tests/openct_status.sh | 44
> ++++++++++++++++++++++++++
>  6 files changed, 108 insertions(+)
>  create mode 100644 tests/Functional.openct/fuego_test.sh
>  create mode 100755 tests/Functional.openct/openct_test.sh
>  create mode 100644 tests/Functional.openct/parser.py
>  create mode 100644 tests/Functional.openct/spec.json
>  create mode 100644 tests/Functional.openct/tests/openct_help.sh
>  create mode 100644 tests/Functional.openct/tests/openct_status.sh
> 
> diff --git a/tests/Functional.openct/fuego_test.sh
> b/tests/Functional.openct/fuego_test.sh
> new file mode 100644
> index 0000000..55881e3
> --- /dev/null
> +++ b/tests/Functional.openct/fuego_test.sh
> @@ -0,0 +1,19 @@
> +function test_pre_check {
> +    assert_has_program openct-control
> +    assert_has_program openct-tool
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/openct_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put $FUEGO_CORE/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;\
> +    ./openct_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/tests/Functional.openct/openct_test.sh
> b/tests/Functional.openct/openct_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/tests/Functional.openct/openct_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/tests/Functional.openct/parser.py
> b/tests/Functional.openct/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/tests/Functional.openct/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')
This line is not needed.  I removed it.

> +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.openct/spec.json
> b/tests/Functional.openct/spec.json
> new file mode 100644
> index 0000000..e758b687
> --- /dev/null
> +++ b/tests/Functional.openct/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.openct",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
There's an extra trailing line in the spec.json file.
I removed it, but please check this in the future.

> diff --git a/tests/Functional.openct/tests/openct_help.sh
> b/tests/Functional.openct/tests/openct_help.sh
> new file mode 100644
> index 0000000..e7f6c9f
> --- /dev/null
> +++ b/tests/Functional.openct/tests/openct_help.sh
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +#  Check the help message of command openct-control.
> +
> +test="help"
> +
> +if openct-control -h | grep "usage"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> diff --git a/tests/Functional.openct/tests/openct_status.sh
> b/tests/Functional.openct/tests/openct_status.sh
> new file mode 100644
> index 0000000..ce59cb7
> --- /dev/null
> +++ b/tests/Functional.openct/tests/openct_status.sh
> @@ -0,0 +1,44 @@
> +#!/bin/sh
> +
> +#  In the target start openct, and confirm the status.
> +
> +test="status"
> +
> +. ./fuego_board_function_lib.sh
> +
> +set_init_manager
> +
> +service_status=$(get_service_status openct)
> +
> +exec_service_on_target openct stop
> +
> +if exec_service_on_target openct start
> +then
> +    echo " -> start of openct succeeded."
> +else
> +    echo " -> start of openct failed."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi
> +
> +if [ "$init_manager" = "systemd" ]
> +then
> +    if systemctl is-active openct
> +    then
> +        echo " -> $test: TEST-PASS"
> +    else
> +        echo " -> $test: TEST-FAIL"
> +    fi
> +else
> +    if service openct status | grep "Waiting for reader attach/detach events"
> +    then
> +        echo " -> $test: TEST-PASS"
> +    else
> +        echo " -> $test: TEST-FAIL"
> +    fi
> +fi
> +
> +if [ "$service_status" = "inactive" ]
> +then
> +    exec_service_on_target openct stop
> +fi
> --
> 1.8.3.1

Applied with fixes to the fuegotest next branch.
 -- Tim


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Fuego] [PATCH] Add test cases for command brctl.
  2019-03-06 10:07 ` [Fuego] [PATCH] Add test cases for command brctl Wang Mingyu
@ 2019-03-13 22:23   ` Tim.Bird
  0 siblings, 0 replies; 9+ messages in thread
From: Tim.Bird @ 2019-03-13 22:23 UTC (permalink / raw)
  To: wangmy, fuego

Same issues as other tests:
 - extra blank line in spec.json
 - python system path append is not needed
 - longer-than-80-character line in commit message

> -----Original Message-----
> From Wang Mingyu
> Sent: Wednesday, March 06, 2019 2:08 AM
> To: fuego@lists.linuxfoundation.org
> Subject: [Fuego] [PATCH] Add test cases for command brctl.
> 
> brctl is used to set up, maintain, and inspect the ethernet bridge
> configuration in the linux kernel.
> This test set is used to check if brctl can creat/delete/show the bridge.
> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.brctl/brctl_test.sh            |  4 ++++
>  tests/Functional.brctl/fuego_test.sh            | 17 +++++++++++++++++
>  tests/Functional.brctl/parser.py                | 22 ++++++++++++++++++++++
>  tests/Functional.brctl/spec.json                |  7 +++++++
>  tests/Functional.brctl/tests/brctl_addbr.sh     | 15 +++++++++++++++
>  tests/Functional.brctl/tests/brctl_delbr.sh     | 14 ++++++++++++++
>  tests/Functional.brctl/tests/brctl_setageing.sh | 16 ++++++++++++++++
>  tests/Functional.brctl/tests/brctl_sethello.sh  | 16 ++++++++++++++++
>  tests/Functional.brctl/tests/brctl_show.sh      | 15 +++++++++++++++
>  tests/Functional.brctl/tests/brctl_showstp.sh   | 15 +++++++++++++++
>  10 files changed, 141 insertions(+)
>  create mode 100755 tests/Functional.brctl/brctl_test.sh
>  create mode 100644 tests/Functional.brctl/fuego_test.sh
>  create mode 100644 tests/Functional.brctl/parser.py
>  create mode 100644 tests/Functional.brctl/spec.json
>  create mode 100644 tests/Functional.brctl/tests/brctl_addbr.sh
>  create mode 100644 tests/Functional.brctl/tests/brctl_delbr.sh
>  create mode 100644 tests/Functional.brctl/tests/brctl_setageing.sh
>  create mode 100644 tests/Functional.brctl/tests/brctl_sethello.sh
>  create mode 100644 tests/Functional.brctl/tests/brctl_show.sh
>  create mode 100644 tests/Functional.brctl/tests/brctl_showstp.sh
> 
> diff --git a/tests/Functional.brctl/brctl_test.sh
> b/tests/Functional.brctl/brctl_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/tests/Functional.brctl/brctl_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/tests/Functional.brctl/fuego_test.sh
> b/tests/Functional.brctl/fuego_test.sh
> new file mode 100644
> index 0000000..f857ff7
> --- /dev/null
> +++ b/tests/Functional.brctl/fuego_test.sh
> @@ -0,0 +1,17 @@
> +function test_pre_check {
> +    assert_has_program brctl
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/brctl_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
> +}
> +
> +function test_run {
> +    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
> +    ./brctl_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/tests/Functional.brctl/parser.py b/tests/Functional.brctl/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/tests/Functional.brctl/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/tests/Functional.brctl/spec.json b/tests/Functional.brctl/spec.json
> new file mode 100644
> index 0000000..f0dcc8e
> --- /dev/null
> +++ b/tests/Functional.brctl/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.brctl",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
> diff --git a/tests/Functional.brctl/tests/brctl_addbr.sh
> b/tests/Functional.brctl/tests/brctl_addbr.sh
> new file mode 100644
> index 0000000..78678c3
> --- /dev/null
> +++ b/tests/Functional.brctl/tests/brctl_addbr.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +#  In the target to execute command brct; and confirm the result.
> +#  option : addbr
> +
> +test="brctl->addbr"
> +
> +brctl addbr br0
> +if ifconfig br0
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +brctl delbr br0
> diff --git a/tests/Functional.brctl/tests/brctl_delbr.sh
> b/tests/Functional.brctl/tests/brctl_delbr.sh
> new file mode 100644
> index 0000000..bafe33f
> --- /dev/null
> +++ b/tests/Functional.brctl/tests/brctl_delbr.sh
> @@ -0,0 +1,14 @@
> +#!/bin/sh
> +
> +#  In the target to execute command brct; and confirm the result.
> +#  option : delbr
> +
> +test="brctl->delbr"
> +
> +brctl addbr br0
> +if brctl delbr br0
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> diff --git a/tests/Functional.brctl/tests/brctl_setageing.sh
> b/tests/Functional.brctl/tests/brctl_setageing.sh
> new file mode 100644
> index 0000000..20d1e68
> --- /dev/null
> +++ b/tests/Functional.brctl/tests/brctl_setageing.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +
> +#  In the target to execute command brct; and confirm the result.
> +#  option : setageing
> +
> +test="brctl->setageing"
> +
> +brctl addbr br0
> +brctl setageing br0 200.00
> +if brctl showstp br0 | grep "ageing time.*200.00"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +brctl delbr br0
> diff --git a/tests/Functional.brctl/tests/brctl_sethello.sh
> b/tests/Functional.brctl/tests/brctl_sethello.sh
> new file mode 100644
> index 0000000..4e351b7
> --- /dev/null
> +++ b/tests/Functional.brctl/tests/brctl_sethello.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +
> +#  In the target to execute command brct; and confirm the result.
> +#  option : sethello
> +
> +test="brctl->sethello"
> +
> +brctl addbr br0
> +brctl sethello br0 5.00
> +if brctl showstp br0 | grep "hello time.*5.00"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +brctl delbr br0
> diff --git a/tests/Functional.brctl/tests/brctl_show.sh
> b/tests/Functional.brctl/tests/brctl_show.sh
> new file mode 100644
> index 0000000..68d9c02
> --- /dev/null
> +++ b/tests/Functional.brctl/tests/brctl_show.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +#  In the target to execute command brct; and confirm the result.
> +#  option : show
> +
> +test="brctl->show"
> +
> +brctl addbr br0
> +if brctl show | grep br0
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +brctl delbr br0
> diff --git a/tests/Functional.brctl/tests/brctl_showstp.sh
> b/tests/Functional.brctl/tests/brctl_showstp.sh
> new file mode 100644
> index 0000000..9ce687b
> --- /dev/null
> +++ b/tests/Functional.brctl/tests/brctl_showstp.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +#  In the target to execute command brct; and confirm the result.
> +#  option : showstp
> +
> +test="brctl->showstp"
> +
> +brctl addbr br0
> +if brctl showstp br0 | grep "bridge id"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +brctl delbr br0
> --
> 1.8.3.1

Applied.  Thanks.
 -- Tim


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Fuego] [PATCH v2] Add test cases of service multipathd.
  2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test cases of service multipathd Wang Mingyu
@ 2019-03-13 22:26   ` Tim.Bird
  0 siblings, 0 replies; 9+ messages in thread
From: Tim.Bird @ 2019-03-13 22:26 UTC (permalink / raw)
  To: wangmy, fuego

Same issues as other tests.

I fixed up the issues in these test, but I plan to reject patches
if they still have these issues, after the 1.5 release.
 -- Tim


> -----Original Message-----
> From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> bounces@lists.linuxfoundation.org] On Behalf Of Wang Mingyu
> Sent: Wednesday, March 06, 2019 2:08 AM
> To: fuego@lists.linuxfoundation.org
> Subject: [Fuego] [PATCH v2] Add test cases of service multipathd.
> 
> The multipathd daemon is in charge of checking for failed paths.
> This test set is used to check if the ps, pidfile and syslog of the service can be
> generated successfully.
> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.multipathd/fuego_test.sh          | 18 ++++++
>  tests/Functional.multipathd/multipathd_test.sh     |  7 +++
>  tests/Functional.multipathd/parser.py              | 22 +++++++
>  tests/Functional.multipathd/spec.json              |  7 +++
>  .../tests/multipathd_pidfile.sh                    | 71 ++++++++++++++++++++++
>  tests/Functional.multipathd/tests/multipathd_ps.sh | 69
> +++++++++++++++++++++
>  .../Functional.multipathd/tests/multipathd_show.sh | 51
> ++++++++++++++++
>  .../tests/multipathd_syslog.sh                     | 70 +++++++++++++++++++++
>  8 files changed, 315 insertions(+)
>  create mode 100644 tests/Functional.multipathd/fuego_test.sh
>  create mode 100755 tests/Functional.multipathd/multipathd_test.sh
>  create mode 100644 tests/Functional.multipathd/parser.py
>  create mode 100644 tests/Functional.multipathd/spec.json
>  create mode 100644
> tests/Functional.multipathd/tests/multipathd_pidfile.sh
>  create mode 100644 tests/Functional.multipathd/tests/multipathd_ps.sh
>  create mode 100644 tests/Functional.multipathd/tests/multipathd_show.sh
>  create mode 100644
> tests/Functional.multipathd/tests/multipathd_syslog.sh
> 
> diff --git a/tests/Functional.multipathd/fuego_test.sh
> b/tests/Functional.multipathd/fuego_test.sh
> new file mode 100644
> index 0000000..81454fa
> --- /dev/null
> +++ b/tests/Functional.multipathd/fuego_test.sh
> @@ -0,0 +1,18 @@
> +function test_pre_check {
> +    assert_has_program multipathd
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/multipathd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put $FUEGO_CORE/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;\
> +    ./multipathd_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/tests/Functional.multipathd/multipathd_test.sh
> b/tests/Functional.multipathd/multipathd_test.sh
> new file mode 100755
> index 0000000..95c34db
> --- /dev/null
> +++ b/tests/Functional.multipathd/multipathd_test.sh
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +. ./fuego_board_function_lib.sh
> +set_init_manager
> +
> +for i in tests/*.sh; do
> +    source $i
> +done
> diff --git a/tests/Functional.multipathd/parser.py
> b/tests/Functional.multipathd/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/tests/Functional.multipathd/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/tests/Functional.multipathd/spec.json
> b/tests/Functional.multipathd/spec.json
> new file mode 100644
> index 0000000..e444db0
> --- /dev/null
> +++ b/tests/Functional.multipathd/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.multipathd",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
> diff --git a/tests/Functional.multipathd/tests/multipathd_pidfile.sh
> b/tests/Functional.multipathd/tests/multipathd_pidfile.sh
> new file mode 100644
> index 0000000..6240f87
> --- /dev/null
> +++ b/tests/Functional.multipathd/tests/multipathd_pidfile.sh
> @@ -0,0 +1,71 @@
> +#!/bin/sh
> +
> +#  In the target start multipathd, and check if the /var/run/multipathd.pid is
> exist
> +#  check the keyword "multipathd".
> +
> +test="pidfile"
> +
> +service_status=$(get_service_status multipathd)
> +
> +exec_service_on_target multipathd stop
> +
> +if [ -f /etc/multipath.conf ]
> +then
> +    cp /etc/multipath.conf /etc/multipath.conf_bak
> +fi
> +
> +if [ -f /etc/multipath.conf.example ]
> +then
> +    cp /etc/multipath.conf.example /etc/multipath.conf
> +fi
> +
> +restore_target() {
> +    if [ -f /etc/multipath.conf_bak ]
> +    then
> +        mv /etc/multipath.conf_bak /etc/multipath.conf
> +    else
> +        rm -f /etc/multipath.conf
> +    fi
> +}
> +
> +if exec_service_on_target multipathd start
> +then
> +    echo " -> start of multipathd succeeded."
> +else
> +    echo " -> start of multipathd failed."
> +    echo " -> $test: TEST-FAIL"
> +    restore_target
> +    exit
> +fi
> +
> +sleep 10
> +
> +if test -f /var/run/multipathd.pid
> +then
> +    echo " -> get the pidfile of multipathd."
> +else
> +    echo " -> can't get the pidfile of multipathd."
> +    echo " -> $test: TEST-FAIL"
> +    exec_service_on_target multipathd stop
> +    restore_target
> +    if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
> +    then
> +        exec_service_on_target multipathd start
> +    fi
> +    exit
> +fi
> +
> +exec_service_on_target multipathd stop
> +
> +if test ! -f /var/run/multipathd.pid
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +restore_target
> +if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
> +then
> +    exec_service_on_target multipathd start
> +fi
> diff --git a/tests/Functional.multipathd/tests/multipathd_ps.sh
> b/tests/Functional.multipathd/tests/multipathd_ps.sh
> new file mode 100644
> index 0000000..86c4352
> --- /dev/null
> +++ b/tests/Functional.multipathd/tests/multipathd_ps.sh
> @@ -0,0 +1,69 @@
> +#!/bin/sh
> +
> +#  In the target start multipathd, and confirm the process condition by
> command ps.
> +
> +test="ps"
> +
> +service_status=$(get_service_status multipathd)
> +
> +exec_service_on_target multipathd stop
> +
> +if [ -f /etc/multipath.conf ]
> +then
> +    cp /etc/multipath.conf /etc/multipath.conf_bak
> +fi
> +
> +if [ -f /etc/multipath.conf.example ]
> +then
> +    cp /etc/multipath.conf.example /etc/multipath.conf
> +fi
> +
> +restore_target() {
> +    if [ -f /etc/multipath.conf_bak ]
> +    then
> +        mv /etc/multipath.conf_bak /etc/multipath.conf
> +    else
> +        rm -f /etc/multipath.conf
> +    fi
> +}
> +
> +if exec_service_on_target multipathd start
> +then
> +    echo " -> start of multipathd succeeded."
> +else
> +    echo " -> start of multipathd failed."
> +    echo " -> $test: TEST-FAIL"
> +    restore_target
> +    exit
> +fi
> +
> +sleep 5
> +
> +if ps aux | grep "[/]sbin/multipathd"
> +then
> +    echo " -> get the process of multipathd."
> +else
> +    echo " -> can't get the process of multipathd."
> +    echo " -> $test: TEST-FAIL"
> +    exec_service_on_target multipathd stop
> +    restore_target
> +    if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
> +    then
> +        exec_service_on_target multipathd start
> +    fi
> +    exit
> +fi
> +
> +exec_service_on_target multipathd stop
> +
> +if ps aux | grep "[/]sbin/multipathd"
> +then
> +    echo " -> $test: TEST-FAIL"
> +else
> +    echo " -> $test: TEST-PASS"
> +fi
> +restore_target
> +if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
> +then
> +    exec_service_on_target multipathd start
> +fi
> diff --git a/tests/Functional.multipathd/tests/multipathd_show.sh
> b/tests/Functional.multipathd/tests/multipathd_show.sh
> new file mode 100644
> index 0000000..73ac45a
> --- /dev/null
> +++ b/tests/Functional.multipathd/tests/multipathd_show.sh
> @@ -0,0 +1,51 @@
> +#!/bin/sh
> +
> +#  In the target start multipathd, and show the format wildcards used in
> interactive commands taking $format.
> +
> +test="show"
> +
> +service_status=$(get_service_status multipathd)
> +
> +exec_service_on_target multipathd stop
> +
> +if [ -f /etc/multipath.conf ]
> +then
> +    cp /etc/multipath.conf /etc/multipath.conf_bak
> +fi
> +
> +if [ -f /etc/multipath.conf.example ]
> +then
> +    cp /etc/multipath.conf.example /etc/multipath.conf
> +fi
> +
> +restore_target() {
> +    if [ -f /etc/multipath.conf_bak ]
> +    then
> +        mv /etc/multipath.conf_bak /etc/multipath.conf
> +    else
> +        rm -f /etc/multipath.conf
> +    fi
> +}
> +
> +if exec_service_on_target multipathd start
> +then
> +    echo " -> start of multipathd succeeded."
> +else
> +    echo " -> start of multipathd failed."
> +    echo " -> $test: TEST-FAIL"
> +    restore_target
> +    exit
> +fi
> +
> +if multipathd show wildcards | grep "multipath format wildcards:"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +restore_target
> +if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
> +then
> +    exec_service_on_target multipathd start
> +fi
> diff --git a/tests/Functional.multipathd/tests/multipathd_syslog.sh
> b/tests/Functional.multipathd/tests/multipathd_syslog.sh
> new file mode 100644
> index 0000000..dbfcd55
> --- /dev/null
> +++ b/tests/Functional.multipathd/tests/multipathd_syslog.sh
> @@ -0,0 +1,70 @@
> +#!/bin/sh
> +
> +#  In the target start multipathd, and check the messages of /var/log/syslog.
> +#  check the keyword "multipathd".
> +
> +test="syslog"
> +
> +logger_service=$(detect_logger_service)
> +
> +service_status=$(get_service_status multipathd)
> +
> +exec_service_on_target multipathd stop
> +exec_service_on_target $logger_service stop
> +
> +if [ -f /etc/multipath.conf ]
> +then
> +    cp /etc/multipath.conf /etc/multipath.conf_bak
> +fi
> +
> +if [ -f /etc/multipath.conf.example ]
> +then
> +    cp /etc/multipath.conf.example /etc/multipath.conf
> +fi
> +
> +if [ -f /var/log/syslog ]
> +then
> +    mv /var/log/syslog /var/log/syslog_bak
> +fi
> +
> +restore_target() {
> +    if [ -f /etc/multipath.conf_bak ]
> +    then
> +        mv /etc/multipath.conf_bak /etc/multipath.conf
> +    else
> +        rm -f /etc/multipath.conf
> +    fi
> +
> +    if [ -f /var/log/syslog_bak ]
> +    then
> +        mv /var/log/syslog_bak /var/log/syslog
> +    fi
> +}
> +
> +exec_service_on_target $logger_service restart
> +
> +if exec_service_on_target multipathd start
> +then
> +    echo " -> start of multipathd succeeded."
> +else
> +    echo " -> start of multipathd failed."
> +    echo " -> $test: TEST-FAIL"
> +    restore_target
> +    exit
> +fi
> +
> +sleep 10
> +
> +if cat /var/log/syslog | grep "multipath"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +exec_service_on_target multipathd stop
> +restore_target
> +if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
> +then
> +    exec_service_on_target multipathd start
> +fi
> --
> 1.8.3.1
> 
> 
> 
> _______________________________________________
> Fuego mailing list
> Fuego@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Fuego] [PATCH] Add test cases for command brctl.
  2018-08-10  9:04 [Fuego] [PATCH] Add test cases for command acpid Wang Mingyu
@ 2018-08-10  9:04 ` Wang Mingyu
  0 siblings, 0 replies; 9+ messages in thread
From: Wang Mingyu @ 2018-08-10  9:04 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 engine/tests/Functional.brctl/brctl_test.sh        |  4 ++++
 engine/tests/Functional.brctl/fuego_test.sh        | 18 ++++++++++++++++++
 engine/tests/Functional.brctl/parser.py            | 22 ++++++++++++++++++++++
 engine/tests/Functional.brctl/spec.json            |  7 +++++++
 engine/tests/Functional.brctl/tests/brctl_addbr.sh | 15 +++++++++++++++
 engine/tests/Functional.brctl/tests/brctl_delbr.sh | 14 ++++++++++++++
 .../Functional.brctl/tests/brctl_setageing.sh      | 16 ++++++++++++++++
 .../tests/Functional.brctl/tests/brctl_sethello.sh | 16 ++++++++++++++++
 engine/tests/Functional.brctl/tests/brctl_show.sh  | 15 +++++++++++++++
 .../tests/Functional.brctl/tests/brctl_showstp.sh  | 15 +++++++++++++++
 10 files changed, 142 insertions(+)
 create mode 100644 engine/tests/Functional.brctl/brctl_test.sh
 create mode 100644 engine/tests/Functional.brctl/fuego_test.sh
 create mode 100644 engine/tests/Functional.brctl/parser.py
 create mode 100644 engine/tests/Functional.brctl/spec.json
 create mode 100644 engine/tests/Functional.brctl/tests/brctl_addbr.sh
 create mode 100644 engine/tests/Functional.brctl/tests/brctl_delbr.sh
 create mode 100644 engine/tests/Functional.brctl/tests/brctl_setageing.sh
 create mode 100644 engine/tests/Functional.brctl/tests/brctl_sethello.sh
 create mode 100644 engine/tests/Functional.brctl/tests/brctl_show.sh
 create mode 100644 engine/tests/Functional.brctl/tests/brctl_showstp.sh

diff --git a/engine/tests/Functional.brctl/brctl_test.sh b/engine/tests/Functional.brctl/brctl_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.brctl/brctl_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.brctl/fuego_test.sh b/engine/tests/Functional.brctl/fuego_test.sh
new file mode 100644
index 0000000..fb52758
--- /dev/null
+++ b/engine/tests/Functional.brctl/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path brctl PROGRAM_BRCTL
+    assert_define PROGRAM_BRCTL "Missing 'brctl' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/brctl_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    sh -v brctl_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.brctl/parser.py b/engine/tests/Functional.brctl/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.brctl/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.brctl/spec.json b/engine/tests/Functional.brctl/spec.json
new file mode 100644
index 0000000..f0dcc8e
--- /dev/null
+++ b/engine/tests/Functional.brctl/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.brctl",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.brctl/tests/brctl_addbr.sh b/engine/tests/Functional.brctl/tests/brctl_addbr.sh
new file mode 100644
index 0000000..78678c3
--- /dev/null
+++ b/engine/tests/Functional.brctl/tests/brctl_addbr.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : addbr
+
+test="brctl->addbr"
+
+brctl addbr br0
+if ifconfig br0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/engine/tests/Functional.brctl/tests/brctl_delbr.sh b/engine/tests/Functional.brctl/tests/brctl_delbr.sh
new file mode 100644
index 0000000..bafe33f
--- /dev/null
+++ b/engine/tests/Functional.brctl/tests/brctl_delbr.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : delbr
+
+test="brctl->delbr"
+
+brctl addbr br0
+if brctl delbr br0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.brctl/tests/brctl_setageing.sh b/engine/tests/Functional.brctl/tests/brctl_setageing.sh
new file mode 100644
index 0000000..20d1e68
--- /dev/null
+++ b/engine/tests/Functional.brctl/tests/brctl_setageing.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : setageing
+
+test="brctl->setageing"
+
+brctl addbr br0
+brctl setageing br0 200.00
+if brctl showstp br0 | grep "ageing time.*200.00"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/engine/tests/Functional.brctl/tests/brctl_sethello.sh b/engine/tests/Functional.brctl/tests/brctl_sethello.sh
new file mode 100644
index 0000000..4e351b7
--- /dev/null
+++ b/engine/tests/Functional.brctl/tests/brctl_sethello.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : sethello
+
+test="brctl->sethello"
+
+brctl addbr br0
+brctl sethello br0 5.00
+if brctl showstp br0 | grep "hello time.*5.00"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/engine/tests/Functional.brctl/tests/brctl_show.sh b/engine/tests/Functional.brctl/tests/brctl_show.sh
new file mode 100644
index 0000000..68d9c02
--- /dev/null
+++ b/engine/tests/Functional.brctl/tests/brctl_show.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : show
+
+test="brctl->show"
+
+brctl addbr br0
+if brctl show | grep br0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
diff --git a/engine/tests/Functional.brctl/tests/brctl_showstp.sh b/engine/tests/Functional.brctl/tests/brctl_showstp.sh
new file mode 100644
index 0000000..9ce687b
--- /dev/null
+++ b/engine/tests/Functional.brctl/tests/brctl_showstp.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command brct; and confirm the result.
+#  option : showstp
+
+test="brctl->showstp"
+
+brctl addbr br0
+if brctl showstp br0 | grep "bridge id"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+brctl delbr br0
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-13 22:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 10:07 [Fuego] [PATCH v2] Add test case of service openct Wang Mingyu
2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test case of service openhpid Wang Mingyu
2019-03-13 22:14   ` Tim.Bird
2019-03-06 10:07 ` [Fuego] [PATCH] Add test cases for command brctl Wang Mingyu
2019-03-13 22:23   ` Tim.Bird
2019-03-06 10:07 ` [Fuego] [PATCH v2] Add test cases of service multipathd Wang Mingyu
2019-03-13 22:26   ` Tim.Bird
2019-03-13 22:19 ` [Fuego] [PATCH v2] Add test case of service openct Tim.Bird
  -- strict thread matches above, loose matches on Subject: below --
2018-08-10  9:04 [Fuego] [PATCH] Add test cases for command acpid Wang Mingyu
2018-08-10  9:04 ` [Fuego] [PATCH] Add test cases for command brctl Wang Mingyu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.