Add test cases for command acpid.
PATCH v2 1/1 Add test cases for command acpid.
--- engine/tests/Functional.acpid/acpid_test.sh | 4 ++ engine/tests/Functional.acpid/datas/test_action.sh | 6 ++ engine/tests/Functional.acpid/datas/testfunc.sh | 13 ++++ engine/tests/Functional.acpid/datas/testhkey | 2 + engine/tests/Functional.acpid/fuego_test.sh | 20 +++++++ engine/tests/Functional.acpid/parser.py | 22 +++++++ engine/tests/Functional.acpid/spec.json | 7 +++ engine/tests/Functional.acpid/tests/acpid_help.sh | 13 ++++ .../tests/Functional.acpid/tests/acpid_logfile.sh | 47 +++++++++++++++ engine/tests/Functional.acpid/tests/acpid_ps.sh | 41 +++++++++++++ .../tests/Functional.acpid/tests/acpid_reload.sh | 70 ++++++++++++++++++++++ .../Functional.acpid/tests/acpid_socketfile.sh | 47 +++++++++++++++ 12 files changed, 292 insertions(+) create mode 100644 engine/tests/Functional.acpid/acpid_test.sh create mode 100644 engine/tests/Functional.acpid/datas/test_action.sh create mode 100644 engine/tests/Functional.acpid/datas/testfunc.sh create mode 100644 engine/tests/Functional.acpid/datas/testhkey create mode 100644 engine/tests/Functional.acpid/fuego_test.sh create mode 100644 engine/tests/Functional.acpid/parser.py create mode 100644 engine/tests/Functional.acpid/spec.json create mode 100644 engine/tests/Functional.acpid/tests/acpid_help.sh create mode 100644 engine/tests/Functional.acpid/tests/acpid_logfile.sh create mode 100644 engine/tests/Functional.acpid/tests/acpid_ps.sh create mode 100644 engine/tests/Functional.acpid/tests/acpid_reload.sh create mode 100644 engine/tests/Functional.acpid/tests/acpid_socketfile.sh
engine/tests/Functional.acpid/acpid_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.acpid/datas/test_action.sh new file +6 -0
@@ -0,0 +1,6 @@ +#!/bin/sh + +sync +sync +sleep 2 +echo "acpi test"
engine/tests/Functional.acpid/datas/testfunc.sh new file +13 -0
@@ -0,0 +1,13 @@ +# $1: Used to determine whether the command line execution result is correct or not +function exec_service_on_target { +local service_name="$1" +local action="$2" +if [ "$init_manager" = "sysvinit" ] +then + $service_name $action +elif [ "$init_manager" = "systemd" ] +then + systemctl $action $service_name +fi +return +}
engine/tests/Functional.acpid/datas/testhkey new file +2 -0
@@ -0,0 +1,2 @@ +event=button/sleep * +action=/etc/acpi/actions/test_action.sh
engine/tests/Functional.acpid/fuego_test.sh new file +20 -0
@@ -0,0 +1,20 @@ +function test_pre_check { + is_on_target_path acpid PROGRAM_ACPID + assert_define PROGRAM_ACPID "Missing 'acpid' program on target board" +} + +function test_deploy { + put $TEST_HOME/acpid_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/datas $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + export init_manager=systemd;\ + sh -v acpid_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.acpid/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.acpid/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.acpid", + "specs": { + "default": {} + } +} +
engine/tests/Functional.acpid/tests/acpid_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd acpi_listen. +# To make sure that there is string "Usage" in output. + +test="help" + +if acpi_listen -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.acpid/tests/acpid_logfile.sh new file +47 -0
47 lines not on this page · raw message
engine/tests/Functional.acpid/tests/acpid_ps.sh new file +41 -0
41 lines not on this page · raw message
engine/tests/Functional.acpid/tests/acpid_reload.sh new file +70 -0
70 lines not on this page · raw message
engine/tests/Functional.acpid/tests/acpid_socketfile.sh new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for command dovecot.
--- engine/tests/Functional.dovecot/datas/testfunc.sh | 13 +++++++ engine/tests/Functional.dovecot/dovecot_test.sh | 4 ++ engine/tests/Functional.dovecot/fuego_test.sh | 20 ++++++++++ engine/tests/Functional.dovecot/parser.py | 22 +++++++++++ engine/tests/Functional.dovecot/spec.json | 7 ++++ .../Functional.dovecot/tests/dovecot_listen.sh | 27 +++++++++++++ .../Functional.dovecot/tests/dovecot_logfile.sh | 38 +++++++++++++++++++ .../Functional.dovecot/tests/dovecot_pidfile.sh | 39 +++++++++++++++++++ .../tests/Functional.dovecot/tests/dovecot_ps.sh | 44 ++++++++++++++++++++++ 9 files changed, 214 insertions(+) create mode 100644 engine/tests/Functional.dovecot/datas/testfunc.sh create mode 100644 engine/tests/Functional.dovecot/dovecot_test.sh create mode 100644 engine/tests/Functional.dovecot/fuego_test.sh create mode 100644 engine/tests/Functional.dovecot/parser.py create mode 100644 engine/tests/Functional.dovecot/spec.json create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_listen.sh create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_pidfile.sh create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_ps.sh
engine/tests/Functional.dovecot/datas/testfunc.sh new file +13 -0
@@ -0,0 +1,13 @@ +# $1: Used to determine whether the command line execution result is correct or not +function exec_service_on_target { +local service_name="$1" +local action="$2" +if [ "$init_manager" = "sysvinit" ] +then + $service_name $action +elif [ "$init_manager" = "systemd" ] +then + systemctl $action $service_name +fi +return +}
engine/tests/Functional.dovecot/dovecot_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.dovecot/fuego_test.sh new file +20 -0
@@ -0,0 +1,20 @@ +function test_pre_check { + is_on_target_path dovecot PROGRAM_DOVECOT + assert_define PROGRAM_DOVECOT "Missing 'dovecot' program on target board" +} + +function test_deploy { + put $TEST_HOME/dovecot_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/datas $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + export init_manager=systemd;\ + sh -v dovecot_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.dovecot/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.dovecot/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.dovecot", + "specs": { + "default": {} + } +} +
engine/tests/Functional.dovecot/tests/dovecot_listen.sh new file +27 -0
@@ -0,0 +1,27 @@ +#!/bin/sh + +# In the target to start dovecot dovecot, to confirm the acquisition of the log. +# check the keyword "LISTEN". + +test="listen" + +source "datas/testfunc.sh" + +exec_service_on_target dovecot stop + +if exec_service_on_target dovecot start +then + echo " -> start of dovecot succeeded." +else + echo " -> start of dovecot failed." + echo " -> $test: TEST-FAIL" +fi + +if netstat -a --tcp | grep LISTEN +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +exec_service_on_target dovecot stop
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh new file +38 -0
@@ -0,0 +1,38 @@ +#!/bin/sh + +# In the target to start dovecot dovecot, to confirm the acquisition of the log. +# check the keyword "dovecot". + +test="logfile" +service_name="" + +source "datas/testfunc.sh" + +if [ "$init_manager" = "systemd" ] +then + service_name="syslog-ng" +else + service_name="syslog.syslog-ng" +fi + +exec_service_on_target dovecot stop +rm -f /var/log/mail.log + +exec_service_on_target $service_name restart + +if exec_service_on_target dovecot start +then + echo " -> start of dovecot succeeded." +else + echo " -> start of dovecot failed." + echo " -> $test: TEST-FAIL" +fi + +if tail /var/log/mail.log | grep "dovecot" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +exec_service_on_target dovecot stop
engine/tests/Functional.dovecot/tests/dovecot_pidfile.sh new file +39 -0
@@ -0,0 +1,39 @@ +#!/bin/sh + +# In the target to start dovecot dovecot, to confirm the acquisition of the log. +# check the file master.pid. + +test="pidfile" + +source "datas/testfunc.sh" + +exec_service_on_target dovecot stop + +if exec_service_on_target dovecot start +then + echo " -> start of dovecot succeeded." +else + echo " -> start of dovecot failed." + echo " -> $test: TEST-FAIL" +fi + +sleep 5 + +if ls /var/run/dovecot/master.pid +then + echo " -> ls /var/run/dovecot/master.pid succeeded." +else + echo " -> ls /var/run/dovecot/master.pid failed." + echo " -> $test: TEST-FAIL" + exec_service_on_target dovecot stop + exit +fi + +exec_service_on_target dovecot stop + +if test ! -f /var/run/dovecot/master.pid +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.dovecot/tests/dovecot_ps.sh new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH] Add test cases for command dovecot.
OK. Sorry this took so long.
This was in my patch backlog.
I applied this, but then added a patch on top to use fuego_board_function_lib.sh
Can you please test this at your site to make sure I didn't break anything.
I don't have a system with dovecot on it.
Thanks,
-- Tim
Quoted 323 lines
-----Original Message-----
From: Wang MingyuSigned-off-by Wang Mingyu <[email protected]>--- engine/tests/Functional.dovecot/datas/testfunc.sh | 13 +++++++ engine/tests/Functional.dovecot/dovecot_test.sh | 4 ++ engine/tests/Functional.dovecot/fuego_test.sh | 20 ++++++++++ engine/tests/Functional.dovecot/parser.py | 22 +++++++++++ engine/tests/Functional.dovecot/spec.json | 7 ++++ .../Functional.dovecot/tests/dovecot_listen.sh | 27 +++++++++++++ .../Functional.dovecot/tests/dovecot_logfile.sh | 38 +++++++++++++++++++ .../Functional.dovecot/tests/dovecot_pidfile.sh | 39 +++++++++++++++++++ .../tests/Functional.dovecot/tests/dovecot_ps.sh | 44 ++++++++++++++++++++++ 9 files changed, 214 insertions(+) create mode 100644 engine/tests/Functional.dovecot/datas/testfunc.sh create mode 100644 engine/tests/Functional.dovecot/dovecot_test.sh create mode 100644 engine/tests/Functional.dovecot/fuego_test.sh create mode 100644 engine/tests/Functional.dovecot/parser.py create mode 100644 engine/tests/Functional.dovecot/spec.json create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_listen.sh create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_pidfile.sh create mode 100644 engine/tests/Functional.dovecot/tests/dovecot_ps.shengine/tests/Functional.dovecot/datas/testfunc.sh new file +1
-0@@ -0,0 +1,13 @@ +# $1: Used to determine whether the command line execution result iscorrect or not
engine/tests/Functional.dovecot/datas/testfunc.sh new file +12
-0+function exec_service_on_target { +local service_name="$1" +local action="$2" +if [ "$init_manager" = "sysvinit" ] +then + $service_name $action +elif [ "$init_manager" = "systemd" ] +then + systemctl $action $service_name +fi +return +}engine/tests/Functional.dovecot/dovecot_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.dovecot/fuego_test.sh new file +3
-0@@ -0,0 +1,20 @@ +function test_pre_check { + is_on_target_path dovecot PROGRAM_DOVECOT + assert_define PROGRAM_DOVECOT "Missing 'dovecot' program on targetboard"
engine/tests/Functional.dovecot/fuego_test.sh new file +17
-0+} + +function test_deploy { + put $TEST_HOME/dovecot_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/datas $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + export init_manager=systemd;\ + sh -v dovecot_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}engine/tests/Functional.dovecot/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.dovecot/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.dovecot", + "specs": { + "default": {} + } +} +engine/tests/Functional.dovecot/tests/dovecot_listen.sh new file +3
-0@@ -0,0 +1,27 @@ +#!/bin/sh + +# In the target to start dovecot dovecot, to confirm the acquisition of thelog.
engine/tests/Functional.dovecot/tests/dovecot_listen.sh new file +24
-0+# check the keyword "LISTEN". + +test="listen" + +source "datas/testfunc.sh" + +exec_service_on_target dovecot stop + +if exec_service_on_target dovecot start +then + echo " -> start of dovecot succeeded." +else + echo " -> start of dovecot failed." + echo " -> $test: TEST-FAIL" +fi + +if netstat -a --tcp | grep LISTEN +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +exec_service_on_target dovecot stopengine/tests/Functional.dovecot/tests/dovecot_logfile.sh new file +3
-0@@ -0,0 +1,38 @@ +#!/bin/sh + +# In the target to start dovecot dovecot, to confirm the acquisition of thelog.
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh new file +35
-0+# check the keyword "dovecot". + +test="logfile" +service_name="" + +source "datas/testfunc.sh" + +if [ "$init_manager" = "systemd" ] +then + service_name="syslog-ng" +else + service_name="syslog.syslog-ng" +fi + +exec_service_on_target dovecot stop +rm -f /var/log/mail.log + +exec_service_on_target $service_name restart + +if exec_service_on_target dovecot start +then + echo " -> start of dovecot succeeded." +else + echo " -> start of dovecot failed." + echo " -> $test: TEST-FAIL" +fi + +if tail /var/log/mail.log | grep "dovecot" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +exec_service_on_target dovecot stopengine/tests/Functional.dovecot/tests/dovecot_pidfile.sh new file +3
-0@@ -0,0 +1,39 @@ +#!/bin/sh + +# In the target to start dovecot dovecot, to confirm the acquisition of thelog.
engine/tests/Functional.dovecot/tests/dovecot_pidfile.sh new file +36
-0+# check the file master.pid. + +test="pidfile" + +source "datas/testfunc.sh" + +exec_service_on_target dovecot stop + +if exec_service_on_target dovecot start +then + echo " -> start of dovecot succeeded." +else + echo " -> start of dovecot failed." + echo " -> $test: TEST-FAIL" +fi + +sleep 5 + +if ls /var/run/dovecot/master.pid +then + echo " -> ls /var/run/dovecot/master.pid succeeded." +else + echo " -> ls /var/run/dovecot/master.pid failed." + echo " -> $test: TEST-FAIL" + exec_service_on_target dovecot stop + exit +fi + +exec_service_on_target dovecot stop + +if test ! -f /var/run/dovecot/master.pid +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fiengine/tests/Functional.dovecot/tests/dovecot_ps.sh new file +3
-0@@ -0,0 +1,44 @@ +#!/bin/sh + +# In the target start dovecot, and confirm the process condition bycommand ps.
engine/tests/Functional.dovecot/tests/dovecot_ps.sh new file +41
-1+# check the keyword "dovecot". + +test="ps" + +source "datas/testfunc.sh" + +exec_service_on_target dovecot stop +if exec_service_on_target dovecot start +then + echo " -> start of dovecot succeeded." +else + echo " -> start of dovecot failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if ps -N a | grep dovecot | grep "[/]usr/sbin/dovecot" +then + echo " -> get the pid of dovecot." +else + echo " -> can't get the pid of dovecot." + echo " -> $test: TEST-FAIL" + exec_service_on_target dovecot stop + exit +fi + +if exec_service_on_target dovecot stop +then + echo " -> stop of dovecot succeeded." +else + echo " -> stop of dovecot failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if ps -N a | grep dovecot | grep "[/]usr/sbin/dovecot" +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fi --1.8.3.1
_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego
PATCH 1/1 Add test cases for command comm/id/sort of coreutils.
In reply to Wang Mingyu--- .../tests/Functional.coreutils/coreutils_test.sh | 4 ++++ engine/tests/Functional.coreutils/fuego_test.sh | 22 ++++++++++++++++++++++ engine/tests/Functional.coreutils/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.coreutils/spec.json | 7 +++++++ .../Functional.coreutils/tests/coreutils_comm.sh | 13 +++++++++++++ .../Functional.coreutils/tests/coreutils_id.sh | 13 +++++++++++++ .../Functional.coreutils/tests/coreutils_sort.sh | 13 +++++++++++++ 7 files changed, 94 insertions(+) create mode 100644 engine/tests/Functional.coreutils/coreutils_test.sh create mode 100644 engine/tests/Functional.coreutils/fuego_test.sh create mode 100644 engine/tests/Functional.coreutils/parser.py create mode 100644 engine/tests/Functional.coreutils/spec.json create mode 100644 engine/tests/Functional.coreutils/tests/coreutils_comm.sh create mode 100644 engine/tests/Functional.coreutils/tests/coreutils_id.sh create mode 100644 engine/tests/Functional.coreutils/tests/coreutils_sort.sh
engine/tests/Functional.coreutils/coreutils_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.coreutils/fuego_test.sh new file +22 -0
@@ -0,0 +1,22 @@ +function test_pre_check { + is_on_target_path comm PROGRAM_COMM + assert_define PROGRAM_COMM "Missing 'comm' program on target board" + is_on_target_path id PROGRAM_ID + assert_define PROGRAM_ID "Missing 'id' program on target board" + is_on_target_path sort PROGRAM_SORT + assert_define PROGRAM_SORT "Missing 'sort' program on target board" +} + +function test_deploy { + put $TEST_HOME/coreutils_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 coreutils_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.coreutils/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.coreutils/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.coreutils", + "specs": { + "default": {} + } +} +
engine/tests/Functional.coreutils/tests/coreutils_comm.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd comm. +# option: --version + +test="comm" + +if comm --version | grep "comm (GNU coreutils)" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.coreutils/tests/coreutils_id.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd id. +# option: --version + +test="id" + +if id --version | grep "id (GNU coreutils)" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.coreutils/tests/coreutils_sort.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd sort. +# option: --version + +test="sort" + +if sort --version | grep "sort (GNU coreutils)" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for command dmidecode.
In reply to Wang Mingyu--- .../tests/Functional.dmidecode/dmidecode_test.sh | 4 ++++ engine/tests/Functional.dmidecode/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.dmidecode/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.dmidecode/spec.json | 7 +++++++ .../Functional.dmidecode/tests/dmidecode_help.sh | 13 +++++++++++++ .../Functional.dmidecode/tests/dmidecode_memory.sh | 13 +++++++++++++ 6 files changed, 77 insertions(+) create mode 100644 engine/tests/Functional.dmidecode/dmidecode_test.sh create mode 100644 engine/tests/Functional.dmidecode/fuego_test.sh create mode 100644 engine/tests/Functional.dmidecode/parser.py create mode 100644 engine/tests/Functional.dmidecode/spec.json create mode 100644 engine/tests/Functional.dmidecode/tests/dmidecode_help.sh create mode 100644 engine/tests/Functional.dmidecode/tests/dmidecode_memory.sh
engine/tests/Functional.dmidecode/dmidecode_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.dmidecode/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path dmidecode PROGRAM_DMIDECODE + assert_define PROGRAM_DMIDECODE "Missing 'dmidecode' program on target board" +} + +function test_deploy { + put $TEST_HOME/dmidecode_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 dmidecode_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.dmidecode/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.dmidecode/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.dmidecode", + "specs": { + "default": {} + } +} +
engine/tests/Functional.dmidecode/tests/dmidecode_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd dmidecode. +# option: help + +test="help" + +if dmidecode -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.dmidecode/tests/dmidecode_memory.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd dmidecode. +# To make sure that there is string "Starting Address" in output. + +test="memory" + +if dmidecode | grep "Starting Address" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for command ethtool.
In reply to Wang Mingyu--- engine/tests/Functional.ethtool/ethtool_test.sh | 4 ++++ engine/tests/Functional.ethtool/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.ethtool/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.ethtool/spec.json | 7 +++++++ .../Functional.ethtool/tests/ethtool_driver.sh | 13 +++++++++++++ .../tests/Functional.ethtool/tests/ethtool_help.sh | 13 +++++++++++++ .../tests/Functional.ethtool/tests/ethtool_show.sh | 13 +++++++++++++ 7 files changed, 90 insertions(+) create mode 100644 engine/tests/Functional.ethtool/ethtool_test.sh create mode 100644 engine/tests/Functional.ethtool/fuego_test.sh create mode 100644 engine/tests/Functional.ethtool/parser.py create mode 100644 engine/tests/Functional.ethtool/spec.json create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_driver.sh create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_help.sh create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_show.sh
engine/tests/Functional.ethtool/ethtool_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.ethtool/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path ethtool PROGRAM_ACPID + assert_define PROGRAM_ACPID "Missing 'ethtool' program on target board" +} + +function test_deploy { + put $TEST_HOME/ethtool_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 ethtool_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.ethtool/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.ethtool/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.ethtool", + "specs": { + "default": {} + } +} +
engine/tests/Functional.ethtool/tests/ethtool_driver.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd ethtool. +# option: -i + +test="driver" + +if ethtool -i eth0 | grep driver +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.ethtool/tests/ethtool_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd ethtool. +# option: help + +test="help" + +if ethtool -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.ethtool/tests/ethtool_show.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd ethtool. +# option: none + +test="show" + +if ethtool eth0 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH] Add test cases for command ethtool.
NAK on this one. See below.
Quoted 46 lines
-----Original Message-----
From: Wang MingyuSigned-off-by Wang Mingyu <[email protected]>--- engine/tests/Functional.ethtool/ethtool_test.sh | 4 ++++ engine/tests/Functional.ethtool/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.ethtool/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.ethtool/spec.json | 7 +++++++ .../Functional.ethtool/tests/ethtool_driver.sh | 13 +++++++++++++ .../tests/Functional.ethtool/tests/ethtool_help.sh | 13 +++++++++++++ .../tests/Functional.ethtool/tests/ethtool_show.sh | 13 +++++++++++++ 7 files changed, 90 insertions(+) create mode 100644 engine/tests/Functional.ethtool/ethtool_test.sh create mode 100644 engine/tests/Functional.ethtool/fuego_test.sh create mode 100644 engine/tests/Functional.ethtool/parser.py create mode 100644 engine/tests/Functional.ethtool/spec.json create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_driver.sh create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_help.sh create mode 100644
engine/tests/Functional.ethtool/tests/ethtool_show.shengine/tests/Functional.ethtool/ethtool_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.ethtool/fuego_test.sh new file +3
-0@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path ethtool PROGRAM_ACPID + assert_define PROGRAM_ACPID "Missing 'ethtool' program on target
Quoted 1 line
board"
PROGRAM_ACPID?? This is kind of a sloppy copy-and-paste error. Please fix this and re-submit.
Quoted 119 lines
engine/tests/Functional.ethtool/fuego_test.sh new file +15
-0+} + +function test_deploy { + put $TEST_HOME/ethtool_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 ethtool_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}engine/tests/Functional.ethtool/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.ethtool/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.ethtool", + "specs": { + "default": {} + } +} +engine/tests/Functional.ethtool/tests/ethtool_driver.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd ethtool. +# option: -i + +test="driver" + +if ethtool -i eth0 | grep driver +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.ethtool/tests/ethtool_help.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd ethtool. +# option: help + +test="help" + +if ethtool -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.ethtool/tests/ethtool_show.sh new file +13
-1@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd ethtool. +# option: none + +test="show" + +if ethtool eth0 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; --
Quoted 1 line
1.8.3.1
I did not apply this one. Please fix it and re-submit.
-- Tim
PATCH v2 1/1 Add test cases for command acpid.
In reply to Wang MingyuSee comments inline below.
Quoted 9 lines
-----Original Message-----
From: Wang MingyuSigned-off-by Wang Mingyu <[email protected]>--- engine/tests/Functional.acpid/acpid_test.sh | 4 ++ engine/tests/Functional.acpid/datas/test_action.sh | 6 ++ engine/tests/Functional.acpid/datas/testfunc.sh | 13 ++++ engine/tests/Functional.acpid/datas/testhkey | 2 +
'datas' is not best word here. First, in English 'data' is used for both plural and singular, so the usage should be 'data'. But most of these are helper scripts. I would prefer to call this 'scripts', but leave it to your discretion. (Well, I changed the name to 'data', but you can decide to leave that as is or change it to 'scripts'.
Quoted 56 lines
engine/tests/Functional.acpid/fuego_test.sh | 20 +++++++ engine/tests/Functional.acpid/parser.py | 22 +++++++ engine/tests/Functional.acpid/spec.json | 7 +++ engine/tests/Functional.acpid/tests/acpid_help.sh | 13 ++++ .../tests/Functional.acpid/tests/acpid_logfile.sh | 47 +++++++++++++++ engine/tests/Functional.acpid/tests/acpid_ps.sh | 41 +++++++++++++ .../tests/Functional.acpid/tests/acpid_reload.sh | 70 ++++++++++++++++++++++ .../Functional.acpid/tests/acpid_socketfile.sh | 47 +++++++++++++++ 12 files changed, 292 insertions(+) create mode 100644 engine/tests/Functional.acpid/acpid_test.sh create mode 100644 engine/tests/Functional.acpid/datas/test_action.sh create mode 100644 engine/tests/Functional.acpid/datas/testfunc.sh create mode 100644 engine/tests/Functional.acpid/datas/testhkey create mode 100644 engine/tests/Functional.acpid/fuego_test.sh create mode 100644 engine/tests/Functional.acpid/parser.py create mode 100644 engine/tests/Functional.acpid/spec.json create mode 100644 engine/tests/Functional.acpid/tests/acpid_help.sh create mode 100644 engine/tests/Functional.acpid/tests/acpid_logfile.sh create mode 100644 engine/tests/Functional.acpid/tests/acpid_ps.sh create mode 100644 engine/tests/Functional.acpid/tests/acpid_reload.sh create mode 100644
engine/tests/Functional.acpid/tests/acpid_socketfile.shengine/tests/Functional.acpid/acpid_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.acpid/datas/test_action.sh new file +6
-0@@ -0,0 +1,6 @@ +#!/bin/sh + +sync +sync +sleep 2 +echo "acpi test"engine/tests/Functional.acpid/datas/testfunc.sh new file +1
-0@@ -0,0 +1,13 @@ +# $1: Used to determine whether the command line execution result is
Quoted 2 lines
correct or not
+functionexec_service_on_target{
This function declaration syntax won't work on dash. I changed this to:exec_service_on_target() {
engine/tests/Functional.acpid/datas/testfunc.sh line 4
Quoted 2 lines
engine/tests/Functional.acpid/datas/testfunc.sh new file +2
-0+local service_name="$1" +local action="$2"
'local' is not supported in some POSIX shells.
I converted the function to just use $1 and $2, to avoid local variables completely.
Quoted 30 lines
engine/tests/Functional.acpid/datas/testfunc.sh new file +9
-0+if [ "$init_manager" = "sysvinit" ] +then + $service_name $action +elif [ "$init_manager" = "systemd" ] +then + systemctl $action $service_name +fi +return +}engine/tests/Functional.acpid/datas/testhkey new file +2
-0@@ -0,0 +1,2 @@ +event=button/sleep * +action=/etc/acpi/actions/test_action.shengine/tests/Functional.acpid/fuego_test.sh new file +3
-0@@ -0,0 +1,20 @@ +function test_pre_check { + is_on_target_path acpid PROGRAM_ACPID + assert_define PROGRAM_ACPID "Missing 'acpid' program on targetboard"
engine/tests/Functional.acpid/fuego_test.sh new file +1
-0+}
engine/tests/Functional.acpid/fuego_test.sh line 14
Quoted 10 lines
engine/tests/Functional.acpid/fuego_test.sh new file +10
-0+ +function test_deploy { + put $TEST_HOME/acpid_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/datas $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + export init_manager=systemd;\
init_manager should be put into the spec file, rather than hardcoded here. Even better, would be to automatically determine this, so the user doesn't have to determine it.
Maybe use something like: systemd_flag="$(cmd \"ls -l /proc/1/exe | grep system ; echo $?\")" in test_pre_check?
Or, put a function in your testfuncs.sh helper library to set $init_manager.
Note that I did not change this in my fixes.
This, and your exec_service_on_target routine might be good to generalize.
I have considered building a set of helper shell functions, like you have done here, available for use on the target, for just such things as this. It would be good, IMHO, to collect a set of useful functions for boards, and combine them into a single helper script, and then any test that needed one or more of the helper functions could deploy them
like this:
put $FUEGO_CORE/engine/scripts/fuego_board_helper.sh $BOARD_TESTDIR/fuego.$TESTDIR
Let me know what you think of this.
I'm just getting started looking through the set of patches you submitted on Aug 20, so there may be more of these helper functions that would be useful for other test. Also, a helper function would avoid Fuego having to take a round-trip to get certain pieces of data useful for a test (ie doing the following:
some_var=$(cmd some-command-on-the-board)
then using: $(some_var) later in the test.
Quoted 76 lines
engine/tests/Functional.acpid/fuego_test.sh new file +6
-0+ sh -v acpid_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}engine/tests/Functional.acpid/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.acpid/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.acpid", + "specs": { + "default": {} + } +} +engine/tests/Functional.acpid/tests/acpid_help.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run comannd acpi_listen. +# To make sure that there is string "Usage" in output. + +test="help" + +if acpi_listen -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.acpid/tests/acpid_logfile.sh new file +0
-0
engine/tests/Functional.acpid/tests/acpid_logfile.sh line 9
Quoted 9 lines
engine/tests/Functional.acpid/tests/acpid_logfile.sh new file +9
-0@@ -0,0 +1,47 @@ +#!/bin/sh + +# In the target to start acpid acpid, to confirm the acquisition of the log. +# check the keyword "acpid". + +test="logfile" +service_name="" + +source "datas/testfunc.sh"
'source' is not supported by dash, which is the default shell on some of my boards. I replaced this with '.'
Quoted 21 lines
engine/tests/Functional.acpid/tests/acpid_logfile.sh new file +21
-0+ +if [ "$init_manager" = "systemd" ] +then + service_name="syslog-ng" +else + service_name="syslog.syslog-ng" +fi + +exec_service_on_target $service_name stop +if [ -f /var/log/messages ] +then + rm -f /var/log/messages +fi + +exec_service_on_target acpid stop +if [ -f /var/log/acpid ] +then + rm -f /var/log/acpid +fi + +exec_service_on_target $service_name restart
engine/tests/Functional.acpid/tests/acpid_logfile.sh line 40
Quoted 10 lines
engine/tests/Functional.acpid/tests/acpid_logfile.sh new file +10
-0+if exec_service_on_target acpid start +then + echo " -> start of acpid succeeded." +else + echo " -> start of acpid failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if tail /var/log/messages | grep "starting up"
I get this:
engine/tests/Functional.acpid/tests/acpid_logfile.sh line 47
Quoted 7 lines
engine/tests/Functional.acpid/tests/acpid_logfile.sh new file +7
-0+then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +exec_service_on_target acpid stop
I get this on my MinnowBoard running this testcase:
Failed to stop syslog-ng.service: Unit syslog-ng.service not loaded.
Warning: Stopping acpid.service, but it can still be activated by:
acpid.path
acpid.socket
Failed to restart syslog-ng.service: Unit syslog-ng.service not found.
-> start of acpid succeeded.
tail: cannot open '/var/log/messages' for reading: No such file or directory
-> logfile: TEST-FAIL
Quoted 11 lines
engine/tests/Functional.acpid/tests/acpid_ps.sh new file +3
-0@@ -0,0 +1,41 @@ +#!/bin/sh + +# In the target start acpid, and confirm the process condition by commandps.
engine/tests/Functional.acpid/tests/acpid_ps.sh line 8
Quoted 5 lines
engine/tests/Functional.acpid/tests/acpid_ps.sh new file +5
-0+# check the keyword "acpid". + +test="ps" + +source "datas/testfunc.sh"
'source' is not supported by dash.
Quoted 40 lines
engine/tests/Functional.acpid/tests/acpid_ps.sh new file +33
-0+ +exec_service_on_target acpid stop +if exec_service_on_target acpid start +then + echo " -> start of acpid succeeded." +else + echo " -> start of acpid failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if [ -z "$(ps aux | grep acpid | grep "/usr/sbin/acpid" | grep -v grep)" ] +then + echo " -> can't get the pid of acpid." + echo " -> $test: TEST-FAIL" + exit +fi + +if exec_service_on_target acpid stop +then + echo " -> stop of acpid succeeded." +else + echo " -> stop of acpid failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if ps aux | grep acpid | grep "/usr/sbin/acpid" | grep -v grep +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fiengine/tests/Functional.acpid/tests/acpid_reload.sh new file +0
-0
engine/tests/Functional.acpid/tests/acpid_reload.sh line 10
Quoted 10 lines
engine/tests/Functional.acpid/tests/acpid_reload.sh new file +10
-0@@ -0,0 +1,70 @@ +#!/bin/sh + +# If the target start the acpid. +# Add the action file and event file to /etc/acpid to reload acpid. +# Check the log file. + +test="reload" +service_name="" + +source "datas/testfunc.sh"
ditto
engine/tests/Functional.acpid/tests/acpid_reload.sh line 16
Quoted 6 lines
engine/tests/Functional.acpid/tests/acpid_reload.sh new file +6
-0+ +if [ "$init_manager" = "systemd" ] +then + service_name="syslog-ng" +else + service_name="syslog.syslog-ng"
Is this right? I would have thought that a SysVInit system would just have the service named 'syslog'.
Quoted 20 lines
engine/tests/Functional.acpid/tests/acpid_reload.sh new file +20
-0+fi + +if [ ! -f /etc/acpi/actions ] +then + mkdir -p /etc/acpi/actions +fi + +if [ ! -f /etc/acpi/events/testhkey ] +then + touch /etc/acpi/events/testhkey +fi + +if [ ! -f /etc/acpi/actions/test_action.sh ] +then + touch /etc/acpi/actions/test_action.sh +fi + +cp datas/testhkey /etc/acpi/events/testhkey +cp datas/test_action.sh /etc/acpi/actions/test_action.sh +
engine/tests/Functional.acpid/tests/acpid_reload.sh line 46
Quoted 10 lines
engine/tests/Functional.acpid/tests/acpid_reload.sh new file +10
-0+chmod +x /etc/acpi/actions/test_action.sh +if [ -f /var/log/acpid ] +then + rm -f /var/log/acpid +fi + +exec_service_on_target $service_name stop +if [ -f /var/log/messages ] +then + rm -f /var/log/messages
Do we really want to remove /var/log/messages? This seems very drastic. Will this result in data loss on a production machine?
My machines don't have /var/log/message, but /var/log/syslog. I'm not sure which one is appropriate for this test, but I get an error from the test on this:
Quoted 35 lines
engine/tests/Functional.acpid/tests/acpid_reload.sh new file +24
-0+fi + +sleep 5 + +exec_service_on_target $service_name restart + +if exec_service_on_target acpid restart +then + echo " -> restart of acpid succeeded." +else + echo " -> restart of acpid failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if tail /var/log/messages | grep "starting up" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +exec_service_on_target acpid stop +rm -f /etc/acpi/events/testhkey +rm -f /etc/acpi/actions/test_action.shengine/tests/Functional.acpid/tests/acpid_socketfile.sh new file +3
-0@@ -0,0 +1,47 @@ +#!/bin/sh + +# In target, start the acpid and check if the Unix domain socket is created ornot.
engine/tests/Functional.acpid/tests/acpid_socketfile.sh line 7
Quoted 4 lines
engine/tests/Functional.acpid/tests/acpid_socketfile.sh new file +4
-0+ +test="socketfile" + +source "datas/testfunc.sh"
dash doesn't support 'source'.
Quoted 41 lines
engine/tests/Functional.acpid/tests/acpid_socketfile.sh new file +40
-1+ +exec_service_on_target acpid stop +if [ -f /var/run/acpid.socket ] +then + rm -f /var/run/acpid.socket +fi + +if exec_service_on_target acpid start +then + echo " -> start of acpid succeeded." +else + echo " -> start of acpid failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if ls /var/run/acpid.socket +then + echo " -> ls /var/run/acpid.socket succeeded." +else + echo " -> ls /var/run/acpid.socket failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if exec_service_on_target acpid stop +then + echo " -> stop of acpid succeeded." +else + echo " -> stop of acpid failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if test -f /var/run/acpid.socket +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fi --
Quoted 1 line
1.8.3.1
When I went to apply this, I got:
warning: squelched 20 whitespace errors
warning: 25 lines add whitespace errors.
I applied this, but I fixed the whitespace errors, and changed 'datas' to 'data', changed 'source' to '.', redid the function syntax in testfuncs. Some of the testcases (logfile and reload) don't work due to issues with the logging and logfile usage. But I'm out of time to work on this more tonight.
Please try it out and let me know if I broke something on your board.
-- Tim