Add test cases of service openct.
PATCH 1/1 Add test cases 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.
--- engine/tests/Functional.openct/fuego_test.sh | 19 ++++++++++ engine/tests/Functional.openct/openct_test.sh | 4 ++ engine/tests/Functional.openct/parser.py | 22 +++++++++++ engine/tests/Functional.openct/spec.json | 7 ++++ .../tests/Functional.openct/tests/openct_help.sh | 12 ++++++ engine/tests/Functional.openct/tests/openct_ps.sh | 44 ++++++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 engine/tests/Functional.openct/fuego_test.sh create mode 100755 engine/tests/Functional.openct/openct_test.sh create mode 100644 engine/tests/Functional.openct/parser.py create mode 100644 engine/tests/Functional.openct/spec.json create mode 100644 engine/tests/Functional.openct/tests/openct_help.sh create mode 100644 engine/tests/Functional.openct/tests/openct_ps.sh
engine/tests/Functional.openct/fuego_test.sh new file +19 -0
@@ -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/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./openct_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.openct/openct_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.openct/parser.py new file +22 -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') +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))
engine/tests/Functional.openct/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.openct", + "specs": { + "default": {} + } +} +
engine/tests/Functional.openct/tests/openct_help.sh new file +12 -0
@@ -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
engine/tests/Functional.openct/tests/openct_ps.sh new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 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.
--- engine/tests/Functional.openhpid/fuego_test.sh | 18 +++++++++++++++ engine/tests/Functional.openhpid/openhpid_test.sh | 4 ++++ engine/tests/Functional.openhpid/parser.py | 22 ++++++++++++++++++ engine/tests/Functional.openhpid/spec.json | 7 ++++++ .../tests/Functional.openhpid/tests/openhpid_ps.sh | 26 ++++++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 engine/tests/Functional.openhpid/fuego_test.sh create mode 100755 engine/tests/Functional.openhpid/openhpid_test.sh create mode 100644 engine/tests/Functional.openhpid/parser.py create mode 100644 engine/tests/Functional.openhpid/spec.json create mode 100644 engine/tests/Functional.openhpid/tests/openhpid_ps.sh
engine/tests/Functional.openhpid/fuego_test.sh new file +18 -0
@@ -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/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./openhpid_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.openhpid/openhpid_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.openhpid/parser.py new file +22 -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') +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))
engine/tests/Functional.openhpid/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.openhpid", + "specs": { + "default": {} + } +} +
engine/tests/Functional.openhpid/tests/openhpid_ps.sh new file +26 -0
@@ -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=$(exec_service_on_target openhpid is-active) + +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 != "active" ] +then + exec_service_on_target openhpid stop +fi
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH] Add test case of service openhpid.
This has the same problem as the openct patch.
exec_service_on_target doesn't support the 'is-active' method, unless you're using systemd as your initmanager.
Another approach to fix this is to add special handling in the function 'exec_service_on_target' to check for 'is-active' and translate it to either 'systemctl is-active <service_name>' or 'service <service_name> status', or, if 'service' is not available, to '/etc/init.d/<service_name> status'.
However, many old-style sysvinit services did not support the 'status' operation. Many only support 'start' and 'stop'. This might be OK for modern systems, operating on modern service processes.
Please let me know what you think.
Quoted 115 lines
-----Original Message-----
From Wang MingyuThe 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 <[email protected]>--- engine/tests/Functional.openhpid/fuego_test.sh | 18 +++++++++++++++ engine/tests/Functional.openhpid/openhpid_test.sh | 4 ++++ engine/tests/Functional.openhpid/parser.py | 22 ++++++++++++++++++ engine/tests/Functional.openhpid/spec.json | 7 ++++++ .../tests/Functional.openhpid/tests/openhpid_ps.sh | 26 ++++++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 engine/tests/Functional.openhpid/fuego_test.sh create mode 100755 engine/tests/Functional.openhpid/openhpid_test.sh create mode 100644 engine/tests/Functional.openhpid/parser.py create mode 100644 engine/tests/Functional.openhpid/spec.json create mode 100644
engine/tests/Functional.openhpid/tests/openhpid_ps.shengine/tests/Functional.openhpid/fuego_test.sh new file +7
-0@@ -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/engine/scripts/fuego_board_function_lib.sh$BOARD_TESTDIR/fuego.$TESTDIR
engine/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" +}engine/tests/Functional.openhpid/openhpid_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.openhpid/parser.py new file +22
-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') +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))engine/tests/Functional.openhpid/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.openhpid", + "specs": { + "default": {} + } +} +engine/tests/Functional.openhpid/tests/openhpid_ps.sh new file +3
-0@@ -0,0 +1,26 @@ +#!/bin/sh + +# In the target start openhpid, and confirm the process condition bycommand ps.
engine/tests/Functional.openhpid/tests/openhpid_ps.sh line 11
Quoted 8 lines
engine/tests/Functional.openhpid/tests/openhpid_ps.sh new file +8
-0+ +test="ps" + +. ./fuego_board_function_lib.sh + +set_init_manager + +service_status=$(exec_service_on_target openhpid is-active)
This only works if init_manager is systemd.
Quoted 16 lines
engine/tests/Functional.openhpid/tests/openhpid_ps.sh new file +15
-1+ +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 != "active" ] +then + exec_service_on_target openhpid stop +fi --
Quoted 1 line
1.8.3.1
I do appreciate that you're trying to restore openhpid to the state it was previously running in.
Thanks,
-- Tim
PATCH 1/1 Add test cases of service multipathd.
In reply to Wang MingyuThe 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.
--- engine/tests/Functional.multipathd/fuego_test.sh | 18 ++++++ .../tests/Functional.multipathd/multipathd_test.sh | 4 ++ engine/tests/Functional.multipathd/parser.py | 22 +++++++ engine/tests/Functional.multipathd/spec.json | 7 ++ .../tests/multipathd_pidfile.sh | 75 ++++++++++++++++++++++ .../Functional.multipathd/tests/multipathd_ps.sh | 73 +++++++++++++++++++++ .../Functional.multipathd/tests/multipathd_show.sh | 55 ++++++++++++++++ .../tests/multipathd_syslog.sh | 73 +++++++++++++++++++++ 8 files changed, 327 insertions(+) create mode 100644 engine/tests/Functional.multipathd/fuego_test.sh create mode 100755 engine/tests/Functional.multipathd/multipathd_test.sh create mode 100644 engine/tests/Functional.multipathd/parser.py create mode 100644 engine/tests/Functional.multipathd/spec.json create mode 100644 engine/tests/Functional.multipathd/tests/multipathd_pidfile.sh create mode 100644 engine/tests/Functional.multipathd/tests/multipathd_ps.sh create mode 100644 engine/tests/Functional.multipathd/tests/multipathd_show.sh create mode 100644 engine/tests/Functional.multipathd/tests/multipathd_syslog.sh
engine/tests/Functional.multipathd/fuego_test.sh new file +18 -0
@@ -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/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./multipathd_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.multipathd/multipathd_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.multipathd/parser.py new file +22 -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') +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))
engine/tests/Functional.multipathd/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.multipathd", + "specs": { + "default": {} + } +} +
engine/tests/Functional.multipathd/tests/multipathd_pidfile.sh new file +75 -0
75 lines not on this page · raw message
engine/tests/Functional.multipathd/tests/multipathd_ps.sh new file +73 -0
73 lines not on this page · raw message
engine/tests/Functional.multipathd/tests/multipathd_show.sh new file +55 -0
55 lines not on this page · raw message
engine/tests/Functional.multipathd/tests/multipathd_syslog.sh new file +73 -0
73 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH] Add test cases of service multipathd.
Same comments as other patches.
'is-active' is only supported by systemctl (when init_manager is 'systemd')
Let's fix that issue, and rework these patches with the solution we decide upon.
-- Tim
Quoted 429 lines
-----Original Message-----
From: Wang MingyuThe 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 <[email protected]>--- engine/tests/Functional.multipathd/fuego_test.sh | 18 ++++++ .../tests/Functional.multipathd/multipathd_test.sh | 4 ++ engine/tests/Functional.multipathd/parser.py | 22 +++++++ engine/tests/Functional.multipathd/spec.json | 7 ++ .../tests/multipathd_pidfile.sh | 75 ++++++++++++++++++++++ .../Functional.multipathd/tests/multipathd_ps.sh | 73 +++++++++++++++++++++ .../Functional.multipathd/tests/multipathd_show.sh | 55 ++++++++++++++++ .../tests/multipathd_syslog.sh | 73 +++++++++++++++++++++ 8 files changed, 327 insertions(+) create mode 100644 engine/tests/Functional.multipathd/fuego_test.sh create mode 100755 engine/tests/Functional.multipathd/multipathd_test.sh create mode 100644 engine/tests/Functional.multipathd/parser.py create mode 100644 engine/tests/Functional.multipathd/spec.json create mode 100644 engine/tests/Functional.multipathd/tests/multipathd_pidfile.sh create mode 100644 engine/tests/Functional.multipathd/tests/multipathd_ps.sh create mode 100644 engine/tests/Functional.multipathd/tests/multipathd_show.sh create mode 100644
engine/tests/Functional.multipathd/tests/multipathd_syslog.shengine/tests/Functional.multipathd/fuego_test.sh new file +7
-0@@ -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/engine/scripts/fuego_board_function_lib.sh$BOARD_TESTDIR/fuego.$TESTDIR
engine/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" +}engine/tests/Functional.multipathd/multipathd_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.multipathd/parser.py new file +22
-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') +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))engine/tests/Functional.multipathd/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.multipathd", + "specs": { + "default": {} + } +} +engine/tests/Functional.multipathd/tests/multipathd_pidfile.sh new file +3
-0@@ -0,0 +1,75 @@ +#!/bin/sh + +# In the target start multipathd, and check if the /var/run/multipathd.pid isexist
engine/tests/Functional.multipathd/tests/multipathd_pidfile.sh new file +72
-0+# check the keyword "multipathd". + +test="pidfile" + +. ./fuego_board_function_lib.sh + +set_init_manager + +service_status=$(exec_service_on_target multipathd is-active) + +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 [ $multipathd_status = "active" ] + 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 [ $multipathd_status = "active" ] +then + exec_service_on_target multipathd start +fiengine/tests/Functional.multipathd/tests/multipathd_ps.sh new file +3
-0@@ -0,0 +1,73 @@ +#!/bin/sh + +# In the target start multipathd, and confirm the process condition bycommand ps.
engine/tests/Functional.multipathd/tests/multipathd_ps.sh new file +70
-0+ +test="ps" + +. ./fuego_board_function_lib.sh + +set_init_manager + +service_status=$(exec_service_on_target multipathd is-active) + +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" ] + 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" ] +then + exec_service_on_target multipathd start +fiengine/tests/Functional.multipathd/tests/multipathd_show.sh new file +3
-0@@ -0,0 +1,55 @@ +#!/bin/sh + +# In the target start multipathd, and show the format wildcards used ininteractive commands taking $format.
engine/tests/Functional.multipathd/tests/multipathd_show.sh new file +52
-0+ +test="show" + +. ./fuego_board_function_lib.sh + +set_init_manager + +service_status=$(exec_service_on_target multipathd is-active) + +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" ] +then + exec_service_on_target multipathd stop +fiengine/tests/Functional.multipathd/tests/multipathd_syslog.sh new file +73
-1@@ -0,0 +1,73 @@ +#!/bin/sh + +# In the target start multipathd, and check the messages of /var/log/syslog. +# check the keyword "multipathd". + +test="syslog" + +. ./fuego_board_function_lib.sh + +set_init_manager +logger_service=$(detect_logger_service) + +service_status=$(exec_service_on_target multipathd is-active) + +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 [ $multipathd_status = "active" ] +then + exec_service_on_target multipathd start +fi --1.8.3.1
_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego
Re: [Fuego] [PATCH] Add test cases of service multipathd.
Quoted 11 lines
-----Original Message-----
From: [email protected]Same comments as other patches.
'is-active' is only supported by systemctl (when
init_manageris 'systemd')Let's fix that issue, and rework these patches with the solution we decide upon.
I was just looking at fuego_board_function_lib.sh and saw this:
exec_service_on_target() {
if [ "$init_manager" = "systemd" ]
then
systemctl $2 $1
else
$1 $2
fi
}This doesn't seem right. Has this library been used for testing on a non-systemd platform?
I'm pretty sure that the command after the 'else' should be one of the following:
service $1 $2
or
/etc/init.d/$1 $2
For example, on a system I have here built with Yocto Project:
$ dropbear status
(no result)
$ /etc/init.d/dropbear status
Usage: /etc/init.d/dropbear {start|stop|restart|force-reload}
$Which shows that the dropbear binary executed by itself doesn't perform the start/start operations. It's the init script in /etc/init.d that does this. Also, that init script (the one for dropbear) doesn't support the 'status' operation.
So, I think that 'status' is not a well-supported operation for embedded Linux services (at least on systems that are using sysvinit as the init manager). So maybe this whole is_active thing needs to be re-thought.
Maybe it's acceptable to just say that these tests are dependent on the system-under-test using 'systemd'. Or, maybe the legacy init scripts for these particular services do all support the 'status' operation.
I think it was Fujitsu that introduced this concept of providing an abstraction for service management into Fuego. Is Fujitsu using systems without systemd? It doesn't look like this exec_service_on_target would work on non-systemd systems.
Let me know your thoughts.
-- Tim
Re: [Fuego] [PATCH] Add test cases of service multipathd.
Hi Tim
Quoted 8 lines
exec_service_on_target(){
if [ "$init_manager" = "systemd" ]
thensystemctl $2 $1 else $1 $2fi
}
There is a problem with this code, which has been fixed in [PATCH] Bugfix: modify the command to start the service of sysvinit. Actually 'is-active' is only supported by systemctl.
I will fully consider the various situations and then add the function to fuego_board_function_lib.
After that I will resubmmit the patch, thanks for pointing out the problem.
wangmy
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, January 11, 2019 7:04 AM
To: [email protected]; Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] Add test cases of service multipathd.
Quoted 10 lines
-----Original Message-----
From: [email protected]Same comments as other patches.
'is-active' is only supported by systemctl (when
init_manageris 'systemd')Let's fix that issue, and rework these patches with the solution we decide upon.
I was just looking at fuego_board_function_lib.sh and saw this:
exec_service_on_target() {
if [ "$init_manager" = "systemd" ]
then
systemctl $2 $1
else
$1 $2
fi
}This doesn't seem right. Has this library been used for testing on a non-systemd platform?
I'm pretty sure that the command after the 'else' should be one of the following:
service $1 $2
or
/etc/init.d/$1 $2
For example, on a system I have here built with Yocto Project:
$ dropbear status
(no result)
$ /etc/init.d/dropbear status
Usage: /etc/init.d/dropbear {start|stop|restart|force-reload} $Which shows that the dropbear binary executed by itself doesn't perform the start/start operations. It's the init script in /etc/init.d that does this. Also, that init script (the one for dropbear) doesn't support the 'status' operation.
So, I think that 'status' is not a well-supported operation for embedded Linux services (at least on systems that are using sysvinit as the init manager). So maybe this whole is_active thing needs to be re-thought.
Maybe it's acceptable to just say that these tests are dependent on the system-under-test using 'systemd'. Or, maybe the legacy init scripts for these particular services do all support the 'status' operation.
I think it was Fujitsu that introduced this concept of providing an abstraction for service management into Fuego. Is Fujitsu using systems without systemd? It doesn't look like this exec_service_on_target would work on non-systemd systems.
Let me know your thoughts.
-- Tim
Re: [Fuego] [PATCH] Add test cases of service multipathd.
In reply to [email protected]Hi Tim,
I tried the system using sysvinit and found that there is a problem that the status option of the service cannot obtain the return value correctly. There are two cases:
1. There is no status option defined in service files, so the service status XX cannot get the status of the service (such as acpid).
2. Even if the status option is defined in the service file, the service will not generate a pid file, so the correct status of the status will not be obtained (such as openct).
For the above two cases, the status of the service cannot be judged before the test is executed, so the status of the service cannot be restored after the test is completed. Is it need to skip the test of above two cases in the sysvinit environment?
If you have any good suggestions, please let me know.
In addition, not all environments have the command service, maybe it’s better to use /etc/init.d.
by Wangmy.
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, January 11, 2019 7:04 AM
To: [email protected]; Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] Add test cases of service multipathd.
Quoted 10 lines
-----Original Message-----
From: [email protected]Same comments as other patches.
'is-active' is only supported by systemctl (when
init_manageris 'systemd')Let's fix that issue, and rework these patches with the solution we decide upon.
I was just looking at fuego_board_function_lib.sh and saw this:
exec_service_on_target() {
if [ "$init_manager" = "systemd" ]
then
systemctl $2 $1
else
$1 $2
fi
}This doesn't seem right. Has this library been used for testing on a non-systemd platform?
I'm pretty sure that the command after the 'else' should be one of the following:
service $1 $2
or
/etc/init.d/$1 $2
For example, on a system I have here built with Yocto Project:
$ dropbear status
(no result)
$ /etc/init.d/dropbear status
Usage: /etc/init.d/dropbear {start|stop|restart|force-reload} $Which shows that the dropbear binary executed by itself doesn't perform the start/start operations. It's the init script in /etc/init.d that does this. Also, that init script (the one for dropbear) doesn't support the 'status' operation.
So, I think that 'status' is not a well-supported operation for embedded Linux services (at least on systems that are using sysvinit as the init manager). So maybe this whole is_active thing needs to be re-thought.
Maybe it's acceptable to just say that these tests are dependent on the system-under-test using 'systemd'. Or, maybe the legacy init scripts for these particular services do all support the 'status' operation.
I think it was Fujitsu that introduced this concept of providing an abstraction for service management into Fuego. Is Fujitsu using systems without systemd? It doesn't look like this exec_service_on_target would work on non-systemd systems.
Let me know your thoughts.
-- Tim
Re: [Fuego] [PATCH] Add test cases of service multipathd.
Quoted 16 lines
-----Original Message-----
From: Wang, MingyuHi Tim,
I tried the system using sysvinit and found that there is a problem that the status option of the service cannot obtain the return value correctly. There are two cases:
1. There is no status option defined in service files, so the service status XX cannot get the status of the service (such as acpid).
2. Even if the status option is defined in the service file, the service will not generate a pid file, so the correct status of the status will not be obtained (such as openct).
Quoted 5 lines
For the above two cases, the status of the service cannot be judged before the test is executed, so the status of the service cannot be restored after the test is completed.
Is it need to skip the test of above two cases in the sysvinit environment? If you have any good suggestions, please let me know.
Hopefully, we can detect the cases you mention. If we don't see the expected string from "/etc/init.d/<service> status", then we should assume that the 'status' operation is not supported, and return "unknown", and let the test decide what to do. See my comments
on the patch to fuego_board_function_lib.sh.
In those tests that try to save the status and restore it, I'm OK with leaving the service running if the test cannot determine the correct pre-test state of the service. It might be worth reporting that in the test log, so users can be advised that the board might not be in the same state as when the test started.
Quoted 3 lines
In addition, not all environments have the command service, maybe it’s better to use
/etc/init.d.
See my comment in patch.
Modern systems have system. Old systems support direct script execution. The main reason for supporting 'service' is for systems that are "in between" the two extremes. 'service' was introduced specifically to allow rc scripts to be managed independent of the distribution (e.g. all of RedHat, SUSE and Debian supported it, unifying the service management CLI)
I don't know if there are enough old systems still around to justify supporting all three mechanisms or not. I think I'm OK for now leaving support for 'service' out (only supporting the systemctl and /etc/init.d/<service> methods of managing the services) and just making a note somewhere so that if this problems crop up someone will have some clues to follow.
-- Tim
Quoted 77 lines
by Wangmy.
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, January 11, 2019 7:04 AM
To: [email protected]; Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] Add test cases of service multipathd.Quoted 10 lines
-----Original Message-----
From: [email protected]Same comments as other patches.
'is-active' is only supported by systemctl (when
init_manageris 'systemd')Let's fix that issue, and rework these patches with the solution we decide upon.
I was just looking at
fuego_board_function_lib.shand saw this:exec_service_on_target() { if [ "$init_manager" = "systemd" ] then systemctl $2 $1 else $1 $2 fi }This doesn't seem right. Has this library been used for testing on a non- systemd platform?
I'm pretty sure that the command after the 'else' should be one of the following:
service $1 $2
or
/etc/init.d/$1$2For example, on a system I have here built with Yocto Project:
$ dropbear status (no result) $ /etc/init.d/dropbear status Usage: /etc/init.d/dropbear {start|stop|restart|force-reload} $Which shows that the dropbear binary executed by itself doesn't perform the start/start operations. It's the init script in
/etc/init.dthat does this. Also, that init script (the one for dropbear) doesn't support the 'status' operation.So, I think that 'status' is not a well-supported operation for embedded Linux services (at least on systems that are using sysvinit as the init manager). So maybe this whole
is_activething needs to be re-thought.Maybe it's acceptable to just say that these tests are dependent on the system-under-test using 'systemd'. Or, maybe the legacy init scripts for these particular services do all support the 'status' operation.
I think it was Fujitsu that introduced this concept of providing an abstraction for service management into Fuego. Is Fujitsu using systems without systemd?
It doesn't look like thisexec_service_on_targetwould work on non-systemd systems.Let me know your thoughts.
-- Tim_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego
See comments inline below.
Quoted 135 lines
-----Original Message-----
From: Wang MingyuOpenCT 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 <[email protected]>--- engine/tests/Functional.openct/fuego_test.sh | 19 ++++++++++ engine/tests/Functional.openct/openct_test.sh | 4 ++ engine/tests/Functional.openct/parser.py | 22 +++++++++++ engine/tests/Functional.openct/spec.json | 7 ++++ .../tests/Functional.openct/tests/openct_help.sh | 12 ++++++ engine/tests/Functional.openct/tests/openct_ps.sh | 44 ++++++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 engine/tests/Functional.openct/fuego_test.sh create mode 100755 engine/tests/Functional.openct/openct_test.sh create mode 100644 engine/tests/Functional.openct/parser.py create mode 100644 engine/tests/Functional.openct/spec.json create mode 100644 engine/tests/Functional.openct/tests/openct_help.sh create mode 100644 engine/tests/Functional.openct/tests/openct_ps.shengine/tests/Functional.openct/fuego_test.sh new file +8
-0@@ -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/engine/scripts/fuego_board_function_lib.sh$BOARD_TESTDIR/fuego.$TESTDIR
engine/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" +}engine/tests/Functional.openct/openct_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.openct/parser.py new file +22
-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') +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))engine/tests/Functional.openct/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.openct", + "specs": { + "default": {} + } +} +engine/tests/Functional.openct/tests/openct_help.sh new file +12
-0@@ -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" +fiengine/tests/Functional.openct/tests/openct_ps.sh new file +3
-0@@ -0,0 +1,44 @@ +#!/bin/sh + +# In the target start openct, and confirm the process condition bycommand ps.
engine/tests/Functional.openct/tests/openct_ps.sh line 11
Quoted 8 lines
engine/tests/Functional.openct/tests/openct_ps.sh new file +8
-0+ +test="ps" + +. ./fuego_board_function_lib.sh + +set_init_manager + +service_status=$(exec_service_on_target openct is-active)
This only works if init_manager is systemd. That is, systemctl supports is-active, but sysvinit doesn't. It uses '<servicename> status'
Unfortunately, you don't get a standardized output from each service, so you'll probably have to specialize examining the response, like you've done below.
engine/tests/Functional.openct/tests/openct_ps.sh line 24
Quoted 13 lines
engine/tests/Functional.openct/tests/openct_ps.sh new file +13
-0+ +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" ]
The test has too much knowledge of fuego_board_function_lib internals here.
It might be good to make a new function for getting service status in the library, and hide these details inside it.
Something like:
target_service_status openct
And have it return success or failure depending on whether the service is running or not.
Or maybe you'll have do some something like:
target_service_status openct <regex-to-check-for>
to make it work with non-systemd services.
Quoted 22 lines
engine/tests/Functional.openct/tests/openct_ps.sh new file +9
-0+then + if exec_service_on_target openct is-active + then + echo " -> $test: TEST-PASS" + else + echo " -> $test: TEST-FAIL" + fi +else + if exec_service_on_target openct status | grep "Waiting for readerattach/detach events"
engine/tests/Functional.openct/tests/openct_ps.sh new file +11
-1+ then + echo " -> $test: TEST-PASS" + else + echo " -> $test: TEST-FAIL" + fi +fi + +if [ $service_status != "active" ] +then + exec_service_on_target openct stop +fi --
Quoted 1 line
1.8.3.1
Please let me know if you can address my comments. If not, I'll take it as is. But architecturally it's not pretty.
-- Tim