Skip to contentSkip to conversation

Add test case of service openct.

PATCH Superseded Wang Mingyu 2 participants 8 messages Mar 6, 2019 – Mar 13, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add test case of service openct.

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.

---
 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
tests/Functional.openct/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..55881e3
@@ -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"
+}
tests/Functional.openct/openct_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.openct/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -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))
tests/Functional.openct/spec.json new file +7 -0
new file mode 100644
index 0000000..e758b687
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.openct",
+    "specs": {
+        "default": {}
+    }
+}
+
tests/Functional.openct/tests/openct_help.sh new file +12 -0
new file mode 100644
index 0000000..e7f6c9f
@@ -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
tests/Functional.openct/tests/openct_status.sh new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/1 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.

---
 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
tests/Functional.openhpid/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..f90897a
@@ -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"
+}
tests/Functional.openhpid/openhpid_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.openhpid/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -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))
tests/Functional.openhpid/spec.json new file +7 -0
new file mode 100644
index 0000000..9004c0d
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.openhpid",
+    "specs": {
+        "default": {}
+    }
+}
+
tests/Functional.openhpid/tests/openhpid_ps.sh new file +26 -0
new file mode 100644
index 0000000..f812827
@@ -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
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [Fuego] [PATCH v2] Add test case of service openhpid.

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

Quoted 149 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Wednesday, March 06, 2019 2:08 AM
To: [email protected]
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.

---
 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
tests/Functional.openhpid/fuego_test.sh new file +7 -0
new file mode 100644
index 0000000..f90897a
@@ -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

tests/Functional.openhpid/fuego_test.sh new file +11 -0
+    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"
+}
tests/Functional.openhpid/openhpid_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.openhpid/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -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))
tests/Functional.openhpid/spec.json new file +7 -0
new file mode 100644
index 0000000..9004c0d
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.openhpid",
+    "specs": {
+        "default": {}
+    }
+}
+
tests/Functional.openhpid/tests/openhpid_ps.sh new file +3 -0
new file mode 100644
index 0000000..f812827
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#  In the target start openhpid, and confirm the process condition by

command ps.

tests/Functional.openhpid/tests/openhpid_ps.sh new file +23 -1
+
+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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego

#3 lore raw

PATCH 1/1 Add test cases for command brctl.

In reply to Wang Mingyu

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.

---
 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
tests/Functional.brctl/brctl_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.brctl/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..f857ff7
@@ -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"
+}
tests/Functional.brctl/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -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))
tests/Functional.brctl/spec.json new file +7 -0
new file mode 100644
index 0000000..f0dcc8e
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.brctl",
+    "specs": {
+        "default": {}
+    }
+}
+
tests/Functional.brctl/tests/brctl_addbr.sh new file +15 -0
new file mode 100644
index 0000000..78678c3
@@ -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
tests/Functional.brctl/tests/brctl_delbr.sh new file +14 -0
new file mode 100644
index 0000000..bafe33f
@@ -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
tests/Functional.brctl/tests/brctl_setageing.sh new file +16 -0
new file mode 100644
index 0000000..20d1e68
@@ -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
tests/Functional.brctl/tests/brctl_sethello.sh new file +16 -0
new file mode 100644
index 0000000..4e351b7
@@ -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
tests/Functional.brctl/tests/brctl_show.sh new file +15 -0
new file mode 100644
index 0000000..68d9c02
@@ -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
tests/Functional.brctl/tests/brctl_showstp.sh new file +15 -0
new file mode 100644
index 0000000..9ce687b
@@ -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
Signature · 1 line
1.8.3.1
#4 lore raw

Re: [Fuego] [PATCH] Add test cases for command brctl.

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

Quoted 244 lines

-----Original Message-----
From Wang Mingyu
Sent: Wednesday, March 06, 2019 2:08 AM
To: [email protected]
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.

---
 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
tests/Functional.brctl/brctl_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.brctl/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..f857ff7
@@ -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"
+}
tests/Functional.brctl/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -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))
tests/Functional.brctl/spec.json new file +7 -0
new file mode 100644
index 0000000..f0dcc8e
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.brctl",
+    "specs": {
+        "default": {}
+    }
+}
+
tests/Functional.brctl/tests/brctl_addbr.sh new file +15 -0
new file mode 100644
index 0000000..78678c3
@@ -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
tests/Functional.brctl/tests/brctl_delbr.sh new file +14 -0
new file mode 100644
index 0000000..bafe33f
@@ -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
tests/Functional.brctl/tests/brctl_setageing.sh new file +16 -0
new file mode 100644
index 0000000..20d1e68
@@ -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
tests/Functional.brctl/tests/brctl_sethello.sh new file +16 -0
new file mode 100644
index 0000000..4e351b7
@@ -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
tests/Functional.brctl/tests/brctl_show.sh new file +15 -0
new file mode 100644
index 0000000..68d9c02
@@ -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
tests/Functional.brctl/tests/brctl_showstp.sh new file +15 -1
new file mode 100644
index 0000000..9ce687b
@@ -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
--
Quoted 1 line

1.8.3.1

Applied. Thanks.
-- Tim

#5 lore raw

PATCH v2 1/1 Add test cases of service multipathd.

In reply to Wang Mingyu

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.

---
 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
tests/Functional.multipathd/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..81454fa
@@ -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"
+}
tests/Functional.multipathd/multipathd_test.sh new file +7 -0
new file mode 100755
index 0000000..95c34db
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
+for i in tests/*.sh; do
+    source $i
+done
tests/Functional.multipathd/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -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))
tests/Functional.multipathd/spec.json new file +7 -0
new file mode 100644
index 0000000..e444db0
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.multipathd",
+    "specs": {
+        "default": {}
+    }
+}
+
tests/Functional.multipathd/tests/multipathd_pidfile.sh new file +71 -0

71 lines not on this page · raw message

tests/Functional.multipathd/tests/multipathd_ps.sh new file +69 -0

69 lines not on this page · raw message

tests/Functional.multipathd/tests/multipathd_show.sh new file +51 -0

51 lines not on this page · raw message

tests/Functional.multipathd/tests/multipathd_syslog.sh new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

Re: [Fuego] [PATCH v2] Add test cases of service multipathd.

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

Quoted 419 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Wednesday, March 06, 2019 2:08 AM
To: [email protected]
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.

---
 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

tests/Functional.multipathd/fuego_test.sh new file +7 -0
new file mode 100644
index 0000000..81454fa
@@ -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

tests/Functional.multipathd/fuego_test.sh new file +11 -0
+    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"
+}
tests/Functional.multipathd/multipathd_test.sh new file +7 -0
new file mode 100755
index 0000000..95c34db
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
+for i in tests/*.sh; do
+    source $i
+done
tests/Functional.multipathd/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -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))
tests/Functional.multipathd/spec.json new file +7 -0
new file mode 100644
index 0000000..e444db0
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.multipathd",
+    "specs": {
+        "default": {}
+    }
+}
+
tests/Functional.multipathd/tests/multipathd_pidfile.sh new file +3 -0
new file mode 100644
index 0000000..6240f87
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+#  In the target start multipathd, and check if the /var/run/multipathd.pid is

exist

tests/Functional.multipathd/tests/multipathd_pidfile.sh new file +68 -0
+#  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
tests/Functional.multipathd/tests/multipathd_ps.sh new file +3 -0
new file mode 100644
index 0000000..86c4352
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+#  In the target start multipathd, and confirm the process condition by

command ps.

tests/Functional.multipathd/tests/multipathd_ps.sh new file +66 -0
+
+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
tests/Functional.multipathd/tests/multipathd_show.sh new file +3 -0
new file mode 100644
index 0000000..73ac45a
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+#  In the target start multipathd, and show the format wildcards used in

interactive commands taking $format.

tests/Functional.multipathd/tests/multipathd_show.sh new file +48 -0
+
+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
tests/Functional.multipathd/tests/multipathd_syslog.sh new file +70 -1
new file mode 100644
index 0000000..dbfcd55
@@ -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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego

#7 lore raw
In reply to Wang Mingyu

See comments inline below.

Quoted 6 lines

-----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.

Quoted 63 lines
---
 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
tests/Functional.openct/fuego_test.sh new file +8 -0
new file mode 100644
index 0000000..55881e3
@@ -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

tests/Functional.openct/fuego_test.sh new file +11 -0
+    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"
+}
tests/Functional.openct/openct_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.openct/parser.py new file +0 -0
new file mode 100644
index 0000000..d85abd7

tests/Functional.openct/parser.py line 6

Quoted 6 lines
tests/Functional.openct/parser.py new file +6 -0
@@ -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.

Quoted 23 lines
tests/Functional.openct/parser.py new file +16 -0
+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))
tests/Functional.openct/spec.json new file +0 -0
new file mode 100644
index 0000000..e758b687

tests/Functional.openct/spec.json line 7

Quoted 7 lines
tests/Functional.openct/spec.json new file +7 -0
@@ -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.

Quoted 71 lines
tests/Functional.openct/tests/openct_help.sh new file +12 -0
new file mode 100644
index 0000000..e7f6c9f
@@ -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
tests/Functional.openct/tests/openct_status.sh new file +44 -1
new file mode 100644
index 0000000..ce59cb7
@@ -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
--
Quoted 1 line

1.8.3.1

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