Skip to contentSkip to conversation

Add test cases of command ecryptfs-manager.

PATCH New Wang Mingyu 1 participant 4 messages May 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add test cases of command ecryptfs-manager.

This test set is used to ask key modules to generate new keys.

---
 .../ecryptfs_manager_test.sh                       |  4 ++++
 tests/Functional.ecryptfs_manager/fuego_test.sh    | 17 ++++++++++++++++
 tests/Functional.ecryptfs_manager/parser.py        | 20 +++++++++++++++++++
 tests/Functional.ecryptfs_manager/spec.json        |  6 ++++++
 .../tests/ecryptfs-manager01.sh                    | 23 ++++++++++++++++++++++
 .../tests/ecryptfs-manager02.sh                    | 23 ++++++++++++++++++++++
 6 files changed, 93 insertions(+)
 create mode 100644 tests/Functional.ecryptfs_manager/ecryptfs_manager_test.sh
 create mode 100644 tests/Functional.ecryptfs_manager/fuego_test.sh
 create mode 100644 tests/Functional.ecryptfs_manager/parser.py
 create mode 100644 tests/Functional.ecryptfs_manager/spec.json
 create mode 100644 tests/Functional.ecryptfs_manager/tests/ecryptfs-manager01.sh
 create mode 100644 tests/Functional.ecryptfs_manager/tests/ecryptfs-manager02.sh
tests/Functional.ecryptfs_manager/ecryptfs_manager_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.ecryptfs_manager/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..8e34104
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program ecryptfs-manager
+}
+
+function test_deploy {
+    put $TEST_HOME/ecryptfs_manager_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./ecryptfs_manager_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.ecryptfs_manager/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+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.ecryptfs_manager/spec.json new file +6 -0
new file mode 100644
index 0000000..88816ec
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.ecryptfs_manager",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.ecryptfs_manager/tests/ecryptfs-manager01.sh new file +23 -0
new file mode 100644
index 0000000..57bf971
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#  The testscript execute the command ecryptfs-manager and check the passphrase.
+#  option: none
+
+test="ecryptfs-manager01"
+
+expect <<-EOF
+spawn ecryptfs-manager
+expect "Make selection:"
+send "1\r"
+expect "Mount-wide passphrase:"
+send "test123\r"
+expect ".*Confirm passphrase:"
+send "test123\r"
+expect {
+ -re ".*Using the default salt value.*" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+default { send_user " -> $test: TEST-FAIL\n" }  }
+send "4\r"
+expect eof
+EOF
tests/Functional.ecryptfs_manager/tests/ecryptfs-manager02.sh new file +23 -0
new file mode 100644
index 0000000..b6dd802
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#  The testscript execute the command ecryptfs-manager and check the passphrase.
+#  option: none
+
+test="ecryptfs-manager02"
+
+expect <<-EOF
+spawn ecryptfs-manager
+expect "Make selection:"
+send "1\r"
+expect "Mount-wide passphrase:"
+send "test123\r"
+expect ".*Confirm passphrase:"
+send "test123\r"
+expect {
+ -re "That key was already" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+default { send_user " -> $test: TEST-FAIL\n" }  }
+send "4\r"
+expect eof
+EOF
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 Add test cases of service crond.

This test set is used to check the process, pid file of service crond and the command crondtab.

---
 tests/Functional.vixie_cron/data/cronentry         |  1 +
 tests/Functional.vixie_cron/data/crontab           | 11 ++++
 tests/Functional.vixie_cron/data/crontab.logger    | 12 ++++
 tests/Functional.vixie_cron/fuego_test.sh          | 20 ++++++
 tests/Functional.vixie_cron/parser.py              | 20 ++++++
 tests/Functional.vixie_cron/spec.json              |  6 ++
 .../tests/vixie-cron_crond01.sh                    | 60 ++++++++++++++++++
 .../tests/vixie-cron_crond02.sh                    | 52 +++++++++++++++
 .../tests/vixie-cron_crond03.sh                    | 60 ++++++++++++++++++
 .../tests/vixie-cron_crond04.sh                    | 59 +++++++++++++++++
 .../tests/vixie-cron_crontab01.sh                  | 58 +++++++++++++++++
 .../tests/vixie-cron_crontab02.sh                  | 74 ++++++++++++++++++++++
 tests/Functional.vixie_cron/vixie_cron_test.sh     |  7 ++
 13 files changed, 440 insertions(+)
 create mode 100644 tests/Functional.vixie_cron/data/cronentry
 create mode 100644 tests/Functional.vixie_cron/data/crontab
 create mode 100644 tests/Functional.vixie_cron/data/crontab.logger
 create mode 100644 tests/Functional.vixie_cron/fuego_test.sh
 create mode 100644 tests/Functional.vixie_cron/parser.py
 create mode 100644 tests/Functional.vixie_cron/spec.json
 create mode 100644 tests/Functional.vixie_cron/tests/vixie-cron_crond01.sh
 create mode 100644 tests/Functional.vixie_cron/tests/vixie-cron_crond02.sh
 create mode 100644 tests/Functional.vixie_cron/tests/vixie-cron_crond03.sh
 create mode 100644 tests/Functional.vixie_cron/tests/vixie-cron_crond04.sh
 create mode 100644 tests/Functional.vixie_cron/tests/vixie-cron_crontab01.sh
 create mode 100644 tests/Functional.vixie_cron/tests/vixie-cron_crontab02.sh
 create mode 100644 tests/Functional.vixie_cron/vixie_cron_test.sh
tests/Functional.vixie_cron/data/cronentry new file +1 -0
new file mode 100644
index 0000000..247919e
@@ -0,0 +1 @@
+0-59/1 * * * * /usr/bin/logger -i -t TEST -p kern.warning "TEST Message2"
tests/Functional.vixie_cron/data/crontab new file +11 -0
new file mode 100644
index 0000000..1023aa8
@@ -0,0 +1,11 @@
+SHELL=/bin/bash
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+MAILTO=root
+HOME=/
+
+# run-parts
+01 * * * * root run-parts /etc/cron.hourly
+02 4 * * * root run-parts /etc/cron.daily
+22 4 * * 0 root run-parts /etc/cron.weekly
+42 4 1 * * root run-parts /etc/cron.monthly
+
tests/Functional.vixie_cron/data/crontab.logger new file +12 -0
new file mode 100644
index 0000000..4dea00d
@@ -0,0 +1,12 @@
+SHELL=/bin/bash
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+MAILTO=root
+HOME=/
+
+# run-parts
+01 * * * * root run-parts /etc/cron.hourly
+02 4 * * * root run-parts /etc/cron.daily
+22 4 * * 0 root run-parts /etc/cron.weekly
+42 4 1 * * root run-parts /etc/cron.monthly
+0-59/1 * * * * root /usr/bin/logger -i -t TEST -p kern.warning "TEST Message crond"
+
tests/Functional.vixie_cron/fuego_test.sh new file +20 -0
new file mode 100644
index 0000000..828398e
@@ -0,0 +1,20 @@
+function test_pre_check {
+    assert_has_program crond
+    assert_has_program crontab
+}
+
+function test_deploy {
+    put $TEST_HOME/vixie_cron_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/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./vixie_cron_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.vixie_cron/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+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.vixie_cron/spec.json new file +6 -0
new file mode 100644
index 0000000..0e08a2f
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.vixie_cron",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.vixie_cron/tests/vixie-cron_crond01.sh new file +60 -0

60 lines not on this page · raw message

tests/Functional.vixie_cron/tests/vixie-cron_crond02.sh new file +52 -0

52 lines not on this page · raw message

tests/Functional.vixie_cron/tests/vixie-cron_crond03.sh new file +60 -0

60 lines not on this page · raw message

tests/Functional.vixie_cron/tests/vixie-cron_crond04.sh new file +59 -0

59 lines not on this page · raw message

tests/Functional.vixie_cron/tests/vixie-cron_crontab01.sh new file +58 -0

58 lines not on this page · raw message

tests/Functional.vixie_cron/tests/vixie-cron_crontab02.sh new file +74 -0

74 lines not on this page · raw message

tests/Functional.vixie_cron/vixie_cron_test.sh new file +7 -0
new file mode 100644
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
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 1/1 Add test cases of service syslog-ng.

In reply to Wang Mingyu

This test set is used to check the process, log file of service syslog-ng.

---
 tests/Functional.syslog_ng/fuego_test.sh           | 18 ++++++++
 tests/Functional.syslog_ng/parser.py               | 20 +++++++++
 tests/Functional.syslog_ng/spec.json               |  6 +++
 tests/Functional.syslog_ng/syslog_ng_test.sh       |  4 ++
 tests/Functional.syslog_ng/tests/syslog-ng_log.sh  | 15 +++++++
 tests/Functional.syslog_ng/tests/syslog-ng_ps.sh   | 50 ++++++++++++++++++++++
 .../Functional.syslog_ng/tests/syslog-ng_share.sh  | 38 ++++++++++++++++
 .../Functional.syslog_ng/tests/syslog-ng_start.sh  | 18 ++++++++
 8 files changed, 169 insertions(+)
 create mode 100644 tests/Functional.syslog_ng/fuego_test.sh
 create mode 100644 tests/Functional.syslog_ng/parser.py
 create mode 100644 tests/Functional.syslog_ng/spec.json
 create mode 100644 tests/Functional.syslog_ng/syslog_ng_test.sh
 create mode 100644 tests/Functional.syslog_ng/tests/syslog-ng_log.sh
 create mode 100644 tests/Functional.syslog_ng/tests/syslog-ng_ps.sh
 create mode 100644 tests/Functional.syslog_ng/tests/syslog-ng_share.sh
 create mode 100644 tests/Functional.syslog_ng/tests/syslog-ng_start.sh
tests/Functional.syslog_ng/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..45aa953
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program syslog-ng
+}
+
+function test_deploy {
+    put $TEST_HOME/syslog_ng_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;\
+    ./syslog_ng_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.syslog_ng/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+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.syslog_ng/spec.json new file +6 -0
new file mode 100644
index 0000000..e38e5ca
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.syslog_ng",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.syslog_ng/syslog_ng_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.syslog_ng/tests/syslog-ng_log.sh new file +15 -0
new file mode 100644
index 0000000..6407abc
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target, run syslog-ng and check the message file.
+
+test="log"
+
+mgs="This is a test message $(date)"
+logger "$msg"
+if grep "$msg" /var/log/syslog
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo "  Didn't find test string in log"
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.syslog_ng/tests/syslog-ng_ps.sh new file +50 -0

50 lines not on this page · raw message

tests/Functional.syslog_ng/tests/syslog-ng_share.sh new file +38 -0
new file mode 100644
index 0000000..73763e7
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+#  In the target, run syslog-ng
+#  check the process state and keyword "supervising syslog ng".
+
+test="share"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status syslog-ng)
+
+exec_service_on_target syslog-ng stop
+
+if [ -f /usr/share/syslog-ng ]
+then
+    mv /usr/share/syslog-ng /usr/share/syslog-ng_bak
+fi
+
+exec_service_on_target syslog-ng restart
+
+if ps aux | grep "[/]usr/sbin/syslog-ng"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ -f /usr/share/syslog-ng_orig ]
+then
+    mv /usr/share/syslog-ng_bak /usr/share/syslog-ng
+fi
+
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target syslog-ng stop
+fi
tests/Functional.syslog_ng/tests/syslog-ng_start.sh new file +18 -0
new file mode 100644
index 0000000..bab81d2
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  In the target, run syslog-ng and check the status of process.
+
+test="start"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target syslog-ng restart
+
+if ps aux | grep "[/]usr/sbin/syslog-ng"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 1/1 Add a general mechanism to check that a module is available and insertable, for test_precheck.

In reply to Wang Mingyu

eg.
function test_pre_check {
assert_has_module atmtcp
}

---
 scripts/functions.sh | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/functions.sh +7 -0
index 2270f4f..1b7b198 100755
@@ -1045,6 +1045,13 @@ function assert_has_program {
    assert_define ${progVar} "Missing '$1' program on target board"
 }
 
+# check for a module on the target, and send message if the module is not available
+# $1 has the module that is required on the target board
+function assert_has_module {
+    moduleName=$1
+    cmd "modprobe $moduleName" || abort_job "$moduleName is not available. Make sure you use the correct module name for this test/benchmark."
+}
+
 # check if the path is an absolute path or a relative path
 # $1 - the path to check
 function is_abs_path {
Signature · 1 line
1.8.3.1