Skip to contentSkip to conversation

atmtcp: Add test cases for command atmtcp.

PATCH Superseded Wang Mingyu 2 participants 10 messages Mar 25, 2019 – May 20, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 atmtcp: Add test cases for command atmtcp.

This test set is used to check option help and subcommand virtual of atmtcp.

---
 tests/Functional.atmtcp/atmtcp_test.sh          |  4 ++++
 tests/Functional.atmtcp/fuego_test.sh           | 17 +++++++++++++++++
 tests/Functional.atmtcp/parser.py               | 20 ++++++++++++++++++++
 tests/Functional.atmtcp/spec.json               |  6 ++++++
 tests/Functional.atmtcp/tests/atmtcp_help.sh    | 16 ++++++++++++++++
 tests/Functional.atmtcp/tests/atmtcp_virtual.sh | 24 ++++++++++++++++++++++++
 6 files changed, 87 insertions(+)
 create mode 100755 tests/Functional.atmtcp/atmtcp_test.sh
 create mode 100644 tests/Functional.atmtcp/fuego_test.sh
 create mode 100644 tests/Functional.atmtcp/parser.py
 create mode 100644 tests/Functional.atmtcp/spec.json
 create mode 100644 tests/Functional.atmtcp/tests/atmtcp_help.sh
 create mode 100644 tests/Functional.atmtcp/tests/atmtcp_virtual.sh
tests/Functional.atmtcp/atmtcp_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.atmtcp/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..f4fefe9
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program atmtcp
+}
+
+function test_deploy {
+    put $TEST_HOME/atmtcp_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./atmtcp_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.atmtcp/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.atmtcp/spec.json new file +6 -0
new file mode 100644
index 0000000..423ae88
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.atmtcp",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.atmtcp/tests/atmtcp_help.sh new file +16 -0
new file mode 100644
index 0000000..e019355
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: -h
+
+test="help"
+
+expect <<-EOF
+spawn atmtcp -h
+expect {
+ "usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
tests/Functional.atmtcp/tests/atmtcp_virtual.sh new file +24 -0
new file mode 100644
index 0000000..8b7c55d
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: virtual
+
+test="virtual"
+
+if modprobe -v atmtcp
+then
+    echo " -> $test: modprobe atmtcp execution succeeded."
+else
+    echo " -> $test: modprobe atmtcp execution failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if [ ! -n "$(atmtcp virtual connect 127.0.0.1 | grep "virtual interface 0")" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+killall atmtcp
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/1 lm_sensors: Add test cases for commands of lm_sensors.

This test set is used to monitor hardware and check the process of lm_sensors.

---
 tests/Functional.lm_sensors/fuego_test.sh          | 19 ++++++
 tests/Functional.lm_sensors/lm_sensors_test.sh     |  4 ++
 tests/Functional.lm_sensors/parser.py              | 20 ++++++
 tests/Functional.lm_sensors/spec.json              |  6 ++
 .../tests/lm_sensors_detect.sh                     | 51 ++++++++++++++++
 .../Functional.lm_sensors/tests/lm_sensors_help.sh | 13 ++++
 tests/Functional.lm_sensors/tests/lm_sensors_ps.sh | 71 ++++++++++++++++++++++
 7 files changed, 184 insertions(+)
 create mode 100644 tests/Functional.lm_sensors/fuego_test.sh
 create mode 100755 tests/Functional.lm_sensors/lm_sensors_test.sh
 create mode 100644 tests/Functional.lm_sensors/parser.py
 create mode 100644 tests/Functional.lm_sensors/spec.json
 create mode 100644 tests/Functional.lm_sensors/tests/lm_sensors_detect.sh
 create mode 100644 tests/Functional.lm_sensors/tests/lm_sensors_help.sh
 create mode 100644 tests/Functional.lm_sensors/tests/lm_sensors_ps.sh
tests/Functional.lm_sensors/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..b514528
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program sensors
+    assert_has_program sensors-detect
+}
+
+function test_deploy {
+    put $TEST_HOME/lm_sensors_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;\
+    ./lm_sensors_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.lm_sensors/lm_sensors_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.lm_sensors/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.lm_sensors/spec.json new file +6 -0
new file mode 100644
index 0000000..d1afe34
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.lm_sensors",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.lm_sensors/tests/lm_sensors_detect.sh new file +51 -0

51 lines not on this page · raw message

tests/Functional.lm_sensors/tests/lm_sensors_help.sh new file +13 -0
new file mode 100644
index 0000000..7c27cbb
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command sensors.
+#  option: -h
+
+test="help"
+
+if sensors -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.lm_sensors/tests/lm_sensors_ps.sh new file +71 -0

71 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v2 1/1 logrotate: Add test cases for command logrotate.

In reply to Wang Mingyu

This test set is used to check log file is created.

---
 tests/Functional.logrotate/data/test.conf        |   8 +++++
 tests/Functional.logrotate/data/testlog.sh       |   6 ++++
 tests/Functional.logrotate/data/testlog100k      | Bin 0 -> 105984 bytes
 tests/Functional.logrotate/fuego_test.sh         |  18 ++++++++++
 tests/Functional.logrotate/logrotate_test.sh     |   4 +++
 tests/Functional.logrotate/parser.py             |  20 +++++++++++
 tests/Functional.logrotate/spec.json             |   6 ++++
 tests/Functional.logrotate/tests/logrotate_01.sh |  13 +++++++
 tests/Functional.logrotate/tests/logrotate_02.sh |  23 ++++++++++++
 tests/Functional.logrotate/tests/logrotate_03.sh |  19 ++++++++++
 tests/Functional.logrotate/tests/logrotate_04.sh |  43 +++++++++++++++++++++++
 tests/Functional.logrotate/tests/logrotate_05.sh |  30 ++++++++++++++++
 12 files changed, 190 insertions(+)
 create mode 100644 tests/Functional.logrotate/data/test.conf
 create mode 100644 tests/Functional.logrotate/data/testlog.sh
 create mode 100644 tests/Functional.logrotate/data/testlog100k
 create mode 100644 tests/Functional.logrotate/fuego_test.sh
 create mode 100755 tests/Functional.logrotate/logrotate_test.sh
 create mode 100644 tests/Functional.logrotate/parser.py
 create mode 100644 tests/Functional.logrotate/spec.json
 create mode 100644 tests/Functional.logrotate/tests/logrotate_01.sh
 create mode 100644 tests/Functional.logrotate/tests/logrotate_02.sh
 create mode 100644 tests/Functional.logrotate/tests/logrotate_03.sh
 create mode 100644 tests/Functional.logrotate/tests/logrotate_04.sh
 create mode 100644 tests/Functional.logrotate/tests/logrotate_05.sh
tests/Functional.logrotate/data/test.conf new file +8 -0
new file mode 100644
index 0000000..a346adf
@@ -0,0 +1,8 @@
+/var/log/testlog {
+        create 600 root root
+        ifempty
+        daily
+        nocompress
+        missingok
+        rotate 1
+}
tests/Functional.logrotate/data/testlog.sh new file +6 -0
new file mode 100644
index 0000000..e258480
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+ddch=`date --date ' 1 days ago' '+%Y-%m-%d'`
+echo "logrotate state -- version 2" >> /var/lib/logrotate.status
+echo "\"/var/log/testlog\" $ddch" >> /var/lib/logrotate.status
+EOF
tests/Functional.logrotate/data/testlog100k new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1dc679f54731568a9cbda775a663b7ea51595fe3
GIT binary patch
tests/Functional.logrotate/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..8be0eb3
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program logrotate
+}
+
+function test_deploy {
+    put $TEST_HOME/logrotate_test.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;\
+    ./logrotate_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.logrotate/logrotate_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.logrotate/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.logrotate/spec.json new file +6 -0
new file mode 100644
index 0000000..cfd6646
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.logrotate",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.logrotate/tests/logrotate_01.sh new file +13 -0
new file mode 100644
index 0000000..e40647b
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command logrotate and confirm the result.
+#  option : --help
+
+test="logrotate"
+
+if xmlcatalog --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.logrotate/tests/logrotate_02.sh new file +23 -0
new file mode 100644
index 0000000..4e16d0b
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#  In the target to execute command logrotate and confirm the result.
+#  option : -dv
+
+test="logrotate2"
+
+if [ -f /var/lib/logrotate.status ]
+then
+    rm -f /var/lib/logrotate.status
+fi
+
+cp data/test.conf /etc/logrotate.d/test.conf
+
+chown root /etc/logrotate.d/test.conf
+
+if logrotate -dv /etc/logrotate.d/test.conf
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /etc/logrotate.d/test.conf
tests/Functional.logrotate/tests/logrotate_03.sh new file +19 -0
new file mode 100644
index 0000000..98a850d
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In the target to execute command logrotate and confirm the result.
+#  option : -v
+
+test="logrotate3"
+
+cp data/test.conf /etc/logrotate.d/test.conf
+
+logrotate -v /etc/logrotate.d/test.conf
+
+if tail /var/lib/logrotate.status | grep testlog
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /etc/logrotate.d/test.conf
+sed -i '/testlog/d' /var/lib/logrotate.status
tests/Functional.logrotate/tests/logrotate_04.sh new file +43 -0

43 lines not on this page · raw message

tests/Functional.logrotate/tests/logrotate_05.sh new file +30 -0
new file mode 100644
index 0000000..a5f61dc
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  In the target to execute command logrotate.Verify that the rotate file is created in the specified directory(Specify the file size).
+#  option : -v
+
+test="logrotate5"
+
+if [ -f /var/log/testlog* ]
+then
+    rm -f /var/log/testlog*
+fi
+
+cp data/test.conf /etc/logrotate.d/test.conf
+
+cp data/testlog100k /var/log/testlog
+
+chmod +x data/testlog.sh
+data/testlog.sh
+chown root /etc/logrotate.d/test.conf
+logrotate -v /etc/logrotate.d/test.conf
+if ls /var/log/testlog.1
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -f /etc/logrotate.d/test.conf
+rm -f /var/log/testlog*
+sed -i '/testlog/d' /var/lib/logrotate.status
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v2 1/1 m4: Add test cases for command m4.

In reply to Wang Mingyu

This test set is used to process macros by m4.

---
 tests/Functional.m4/fuego_test.sh  | 17 +++++++++++++++++
 tests/Functional.m4/m4_test.sh     |  4 ++++
 tests/Functional.m4/parser.py      | 20 ++++++++++++++++++++
 tests/Functional.m4/spec.json      |  6 ++++++
 tests/Functional.m4/tests/m4_01.sh | 13 +++++++++++++
 tests/Functional.m4/tests/m4_02.sh | 19 +++++++++++++++++++
 6 files changed, 79 insertions(+)
 create mode 100644 tests/Functional.m4/fuego_test.sh
 create mode 100755 tests/Functional.m4/m4_test.sh
 create mode 100644 tests/Functional.m4/parser.py
 create mode 100644 tests/Functional.m4/spec.json
 create mode 100644 tests/Functional.m4/tests/m4_01.sh
 create mode 100644 tests/Functional.m4/tests/m4_02.sh
tests/Functional.m4/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..9e9a556
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program m4
+}
+
+function test_deploy {
+    put $TEST_HOME/m4_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./m4_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.m4/m4_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.m4/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.m4/spec.json new file +6 -0
new file mode 100644
index 0000000..4a3b807
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.m4",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.m4/tests/m4_01.sh new file +13 -0
new file mode 100644
index 0000000..4a553d1
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command m4.
+#  option: --help
+
+test="m4_01"
+
+if m4 --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.m4/tests/m4_02.sh new file +19 -0
new file mode 100644
index 0000000..4bdaf7a
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In target, run command m4.
+#  option: none
+
+test="m4_02"
+
+mkdir m4
+echo "define(\`STR', \`hello world')" > m4/m4.test
+echo "syscmd(\`echo' STR)" >> m4/m4.test
+
+if m4 m4/m4.test | grep "hello world"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+rm -fr m4
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v2 1/1 ntp: Add test cases for commands of ntp.

In reply to Wang Mingyu

This test set is used to check the service ntpd and command ntpdate/ntpdc/ntpq/ntptime/tickadj.

---
 tests/Functional.ntp/data/hosts               |  4 ++
 tests/Functional.ntp/data/ntp.conf            | 82 +++++++++++++++++++++++++++
 tests/Functional.ntp/fuego_test.sh            | 24 ++++++++
 tests/Functional.ntp/ntp_test.sh              |  7 +++
 tests/Functional.ntp/parser.py                | 20 +++++++
 tests/Functional.ntp/spec.json                |  6 ++
 tests/Functional.ntp/test.yaml                | 34 +++++++++++
 tests/Functional.ntp/tests/ntp_ntpdate1.sh    | 13 +++++
 tests/Functional.ntp/tests/ntp_ntpdate2.sh    | 21 +++++++
 tests/Functional.ntp/tests/ntp_ntpdc.sh       | 50 ++++++++++++++++
 tests/Functional.ntp/tests/ntp_ntpq.sh        | 49 ++++++++++++++++
 tests/Functional.ntp/tests/ntp_ntptime.sh_bak | 28 +++++++++
 tests/Functional.ntp/tests/ntp_pid.sh         | 57 +++++++++++++++++++
 tests/Functional.ntp/tests/ntp_ps.sh          | 47 +++++++++++++++
 tests/Functional.ntp/tests/ntp_syslog.sh      | 51 +++++++++++++++++
 tests/Functional.ntp/tests/ntp_tickadj.sh     | 28 +++++++++
 16 files changed, 521 insertions(+)
 create mode 100644 tests/Functional.ntp/data/hosts
 create mode 100644 tests/Functional.ntp/data/ntp.conf
 create mode 100644 tests/Functional.ntp/fuego_test.sh
 create mode 100755 tests/Functional.ntp/ntp_test.sh
 create mode 100644 tests/Functional.ntp/parser.py
 create mode 100644 tests/Functional.ntp/spec.json
 create mode 100644 tests/Functional.ntp/test.yaml
 create mode 100644 tests/Functional.ntp/tests/ntp_ntpdate1.sh
 create mode 100644 tests/Functional.ntp/tests/ntp_ntpdate2.sh
 create mode 100644 tests/Functional.ntp/tests/ntp_ntpdc.sh
 create mode 100644 tests/Functional.ntp/tests/ntp_ntpq.sh
 create mode 100644 tests/Functional.ntp/tests/ntp_ntptime.sh_bak
 create mode 100644 tests/Functional.ntp/tests/ntp_pid.sh
 create mode 100644 tests/Functional.ntp/tests/ntp_ps.sh
 create mode 100644 tests/Functional.ntp/tests/ntp_syslog.sh
 create mode 100644 tests/Functional.ntp/tests/ntp_tickadj.sh
tests/Functional.ntp/data/hosts new file +4 -0
new file mode 100644
index 0000000..3c8d41d
@@ -0,0 +1,4 @@
+#
+#Template of /etc/hosts
+#
+127.0.0.1       localhost
tests/Functional.ntp/data/ntp.conf new file +82 -0

82 lines not on this page · raw message

tests/Functional.ntp/fuego_test.sh new file +24 -0
new file mode 100644
index 0000000..c5ac056
@@ -0,0 +1,24 @@
+function test_pre_check {
+    assert_has_program ntpdate
+    assert_has_program ntpdc
+    assert_has_program ntpq
+    assert_has_program ntptime
+    assert_has_program tickadj
+}
+
+function test_deploy {
+    put $TEST_HOME/ntp_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;\
+    export test_tcpip_host=$SRV_IP;\
+    ./ntp_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.ntp/ntp_test.sh new file +7 -0
new file mode 100755
index 0000000..95c34db
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
+for i in tests/*.sh; do
+    source $i
+done
tests/Functional.ntp/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.ntp/spec.json new file +6 -0
new file mode 100644
index 0000000..c537ede
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.ntp",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.ntp/test.yaml new file +34 -0
new file mode 100644
index 0000000..e331e1e
@@ -0,0 +1,34 @@
+fuego_package_version: 1
+name: Functional.ntp
+description: |
+      The Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer
+      systems over packet-switched, variable-latency data networks.
+      This is a simple test to check the service and commands of ntp.
+license: Unknown
+author: Wang Mingyu <[email protected]>
+maintainer: Tim Bird <[email protected]>
+version: 2.00
+fuego_release: 1
+type: Functional
+tags: ['time']
+params:
+      SRV_IP="The IP address of host" Defined in board file
+data_files:
+ - ntp_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - data
+   hosts
+   ntp.data
+ - tests
+   ntp_ntpdate1.sh
+   ntp_ntpdate2.sh
+   ntp_ntpdc.sh
+   ntp_ntpq.sh
+   ntp_ntptime.sh
+   ntp_pid.sh
+   ntp_ps.sh
+   ntp_syslog.sh
+   ntp_tickadj.sh
tests/Functional.ntp/tests/ntp_ntpdate1.sh new file +13 -0
new file mode 100644
index 0000000..8b0b18a
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command netpdate.
+#  option: -q
+
+test="ntpdate1"
+
+if ntpdate -q $test_tcpip_host | grep "server $test_tcpip_host"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.ntp/tests/ntp_ntpdate2.sh new file +21 -0
new file mode 100644
index 0000000..c6d1b81
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#  In target, run command netpdate.
+#  option: -q.
+
+test="ntpdate2"
+
+service_status=$(get_service_status ntpd)
+
+exec_service_on_target ntpd start
+if ntpdate -q $test_tcpip_host | grep "server $test_tcpip_host"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target ntpd stop
+fi
tests/Functional.ntp/tests/ntp_ntpdc.sh new file +50 -0

50 lines not on this page · raw message

tests/Functional.ntp/tests/ntp_ntpq.sh new file +49 -0

49 lines not on this page · raw message

tests/Functional.ntp/tests/ntp_ntptime.sh_bak new file +28 -0
new file mode 100644
index 0000000..4d5f961
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#  In target, run command ntptime.
+#  option: none
+
+test="ntptime"
+
+service_status=$(get_service_status ntpd)
+
+if exec_service_on_target ntpd restart
+then
+    echo " -> $test: ntpd restart succeeded."
+else
+    echo " -> $test: ntpd restart failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if ntptime | grep OK
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target ntpd stop
+fi
tests/Functional.ntp/tests/ntp_pid.sh new file +57 -0

57 lines not on this page · raw message

tests/Functional.ntp/tests/ntp_ps.sh new file +47 -0

47 lines not on this page · raw message

tests/Functional.ntp/tests/ntp_syslog.sh new file +51 -0

51 lines not on this page · raw message

tests/Functional.ntp/tests/ntp_tickadj.sh new file +28 -0
new file mode 100644
index 0000000..27e6e62
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#  In target, run command tickadj.
+#  option: none
+
+test="tickadj"
+
+service_status=$(get_service_status ntpd )
+if exec_service_on_target ntpd stop
+then
+    echo " -> $test: ntpd stop succeeded."
+else
+    echo " -> $test: ntpd stop failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if tickadj | grep tick
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target ntpd start
+fi
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v2 1/1 openvpn: Add test cases of service openvpn.

In reply to Wang Mingyu

This test set is used to check if the service openvpn can be started. And check the process file, syslog file, tap0 can be created or not.

---
 tests/Functional.openvpn/data/host-target.key      | 22 +++++++++
 tests/Functional.openvpn/data/testcli.conf         |  7 +++
 tests/Functional.openvpn/data/testenv.sh           | 18 +++++++
 tests/Functional.openvpn/data/testsrv.conf         | 16 +++++++
 tests/Functional.openvpn/fuego_test.sh             | 19 ++++++++
 tests/Functional.openvpn/openvpn_test.sh           |  9 ++++
 tests/Functional.openvpn/parser.py                 | 20 ++++++++
 tests/Functional.openvpn/spec.json                 |  6 +++
 tests/Functional.openvpn/tests/openvpn_genkey.sh   | 15 ++++++
 .../tests/openvpn_lport_client.sh                  | 53 +++++++++++++++++++++
 .../tests/openvpn_lport_server.sh                  | 51 ++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_pid_client.sh | 50 ++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_pid_server.sh | 51 ++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_ps_client.sh  | 55 ++++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_ps_server.sh  | 55 ++++++++++++++++++++++
 .../tests/openvpn_syslog-ng_client.sh              | 54 +++++++++++++++++++++
 .../tests/openvpn_syslog-ng_server.sh              | 52 ++++++++++++++++++++
 .../Functional.openvpn/tests/openvpn_tun_client.sh | 44 +++++++++++++++++
 .../Functional.openvpn/tests/openvpn_tun_server.sh | 44 +++++++++++++++++
 19 files changed, 641 insertions(+)
 create mode 100644 tests/Functional.openvpn/data/host-target.key
 create mode 100644 tests/Functional.openvpn/data/testcli.conf
 create mode 100644 tests/Functional.openvpn/data/testenv.sh
 create mode 100644 tests/Functional.openvpn/data/testsrv.conf
 create mode 100644 tests/Functional.openvpn/fuego_test.sh
 create mode 100755 tests/Functional.openvpn/openvpn_test.sh
 create mode 100644 tests/Functional.openvpn/parser.py
 create mode 100644 tests/Functional.openvpn/spec.json
 create mode 100644 tests/Functional.openvpn/tests/openvpn_genkey.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_lport_client.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_lport_server.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_pid_client.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_pid_server.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_ps_client.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_ps_server.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_syslog-ng_client.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_syslog-ng_server.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_tun_client.sh
 create mode 100644 tests/Functional.openvpn/tests/openvpn_tun_server.sh
tests/Functional.openvpn/data/host-target.key new file +22 -0
new file mode 100644
index 0000000..99743bf
@@ -0,0 +1,22 @@
+#
+# 2048 bit OpenVPN static key
+#
+-----BEGIN OpenVPN Static key V1-----
+debe9557c7eb224c5cf4f3369d5211ff
+fb9c375a4784759edf6b0f6eb8f5da31
+bb280394d40382cc8e02d6cbb3e47492
+3509eac6b48965078e3d317b0791dea2
+dbcf0eddcab0fb20780fcf0908ce94cd
+7cb65a913fea73ac6bfe0ab34f085aa3
+a6c8b89a97d189e5145c3199955c4b34
+6d51f864f2b49f3252d1548c3b3510ec
+0ecd4b9f17f2039439a79f41a46f6a54
+c0385b962b2b94fcbe73e0108b224a5b
+2efae27d872f0efef67b244c7eb6f525
+581e4c2b4e6aa193fb1d37798bdb46ff
+7c6727f08e9601c10ac7478d73d731e6
+f4b652252f3e5309cd1d6d30c7a433cc
+134bd6dd50fa6a6fc7a843fdc058d38d
+fb8679b48eb09745badf004fbf4a434c
+-----END OpenVPN Static key V1-----
+
tests/Functional.openvpn/data/testcli.conf new file +7 -0
new file mode 100644
index 0000000..2c252bb
@@ -0,0 +1,7 @@
+remote  192.168.0.1
+port    5000
+dev     tap
+#dev    tun
+verb    3
+ping    60
+
tests/Functional.openvpn/data/testenv.sh new file +18 -0
new file mode 100644
index 0000000..8c01d58
@@ -0,0 +1,18 @@
+#set the variable
+if [ "$init_manager" == "systemd" ]
+then
+        service_name="[email protected]"
+        config_file="/etc/openvpn/loopback-server.conf"
+        pid_file="/var/run/openvpn/loopback-server.pid"
+else
+        service_name="openvpn"
+        if [ "$test_type" == "client" ]
+        then
+                config_file="/etc/openvpn/testcli.conf"
+                pid_file="/var/run/openvpn.testcli.pid"
+        elif [ "$test_type" == "server" ]
+        then
+                config_file="/etc/openvpn/testsrv.conf"
+                pid_file="/var/run/openvpn.testsrv.pid"
+        fi
+fi
tests/Functional.openvpn/data/testsrv.conf new file +16 -0
new file mode 100644
index 0000000..0c18a40
@@ -0,0 +1,16 @@
+#
+proto           udp
+port            5000
+
+dev             tap
+
+secret          /etc/openvpn/host-target.key
+#link-mtu       1200
+
+ping            10
+ping-restart    60
+ping-timer-rem
+persist-key
+persist-tun
+verb            3
+
tests/Functional.openvpn/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..65d2991
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program openvpn
+}
+
+function test_deploy {
+    put $TEST_HOME/openvpn_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;\
+    ./openvpn_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.openvpn/openvpn_test.sh new file +9 -0
new file mode 100755
index 0000000..42f41ea
@@ -0,0 +1,9 @@
+#!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
+. data/testenv.sh
+
+for i in tests/*.sh; do
+    source $i
+done
tests/Functional.openvpn/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.openvpn/spec.json new file +6 -0
new file mode 100644
index 0000000..e9fdc5a
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.openvpn",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.openvpn/tests/openvpn_genkey.sh new file +15 -0
new file mode 100644
index 0000000..d951589
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command openvpn.
+#  option: --genkey
+
+test="genkey"
+
+openvpn --genkey --secret /etc/openvpn/host-target.key
+if ls /etc/openvpn/host-target.key
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f /etc/openvpn/host-target.key
tests/Functional.openvpn/tests/openvpn_lport_client.sh new file +53 -0

53 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_lport_server.sh new file +51 -0

51 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_pid_client.sh new file +50 -0

50 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_pid_server.sh new file +51 -0

51 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_ps_client.sh new file +55 -0

55 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_ps_server.sh new file +55 -0

55 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_syslog-ng_client.sh new file +54 -0

54 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_syslog-ng_server.sh new file +52 -0

52 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_tun_client.sh new file +44 -0

44 lines not on this page · raw message

tests/Functional.openvpn/tests/openvpn_tun_server.sh new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v2 1/1 parted: Add test cases for command parted.

In reply to Wang Mingyu

This test set is used to display machine parseable output, help message and version of command parted.

---
 tests/Functional.parted/fuego_test.sh           | 18 ++++++++++++++++++
 tests/Functional.parted/parser.py               | 20 ++++++++++++++++++++
 tests/Functional.parted/parted_test.sh          |  4 ++++
 tests/Functional.parted/spec.json               |  6 ++++++
 tests/Functional.parted/tests/parted_help.sh    | 13 +++++++++++++
 tests/Functional.parted/tests/parted_machine.sh | 19 +++++++++++++++++++
 tests/Functional.parted/tests/parted_summary.sh | 13 +++++++++++++
 tests/Functional.parted/tests/parted_version.sh | 13 +++++++++++++
 8 files changed, 106 insertions(+)
 create mode 100644 tests/Functional.parted/fuego_test.sh
 create mode 100644 tests/Functional.parted/parser.py
 create mode 100755 tests/Functional.parted/parted_test.sh
 create mode 100644 tests/Functional.parted/spec.json
 create mode 100644 tests/Functional.parted/tests/parted_help.sh
 create mode 100644 tests/Functional.parted/tests/parted_machine.sh
 create mode 100644 tests/Functional.parted/tests/parted_summary.sh
 create mode 100644 tests/Functional.parted/tests/parted_version.sh
tests/Functional.parted/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..3c94d6a
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program parted
+    assert_has_program partprobe
+}
+
+function test_deploy {
+    put $TEST_HOME/parted_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./parted_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.parted/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.parted/parted_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.parted/spec.json new file +6 -0
new file mode 100644
index 0000000..f44c21e
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.parted",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.parted/tests/parted_help.sh new file +13 -0
new file mode 100644
index 0000000..1460cfe
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command parted.
+#  option: --help.
+
+test="help"
+
+if parted --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.parted/tests/parted_machine.sh new file +19 -0
new file mode 100644
index 0000000..6cdca7e
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In target, run command parted to displays machine parseable output.
+#  option: --machine.
+
+test="machine"
+
+expect <<-EOF
+spawn parted --machine
+expect {
+ -re ".*GNU Parted.*" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default {
+            send_user " -> can't displays machine parseable output.\n"
+            send_user " -> $test: TEST-FAIL\n"}  }
+send "q\n"
+expect eof
+EOF
tests/Functional.parted/tests/parted_summary.sh new file +13 -0
new file mode 100644
index 0000000..2df576a
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command partprobe.
+#  option: -s
+
+test="summary"
+
+if partprobe -s
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.parted/tests/parted_version.sh new file +13 -0
new file mode 100644
index 0000000..5fb7136
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command partprobe.
+#  option: -v
+
+test="version"
+
+if partprobe -v | grep Copyright
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v2 1/1 powertop: Add test cases for command powertop.

In reply to Wang Mingyu

This test set is used to analyze power consumption and show help message of command powertop.

---
 tests/Functional.powertop/fuego_test.sh          | 17 +++++++++++++++++
 tests/Functional.powertop/parser.py              | 20 ++++++++++++++++++++
 tests/Functional.powertop/powertop_test.sh       |  4 ++++
 tests/Functional.powertop/spec.json              |  6 ++++++
 tests/Functional.powertop/tests/powertop_csv.sh  | 13 +++++++++++++
 tests/Functional.powertop/tests/powertop_help.sh | 13 +++++++++++++
 6 files changed, 73 insertions(+)
 create mode 100644 tests/Functional.powertop/fuego_test.sh
 create mode 100644 tests/Functional.powertop/parser.py
 create mode 100755 tests/Functional.powertop/powertop_test.sh
 create mode 100644 tests/Functional.powertop/spec.json
 create mode 100644 tests/Functional.powertop/tests/powertop_csv.sh
 create mode 100644 tests/Functional.powertop/tests/powertop_help.sh
tests/Functional.powertop/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..377fc62
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program powertop
+}
+
+function test_deploy {
+    put $TEST_HOME/powertop_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./powertop_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.powertop/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.powertop/powertop_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.powertop/spec.json new file +6 -0
new file mode 100644
index 0000000..3c5e680
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.powertop",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.powertop/tests/powertop_csv.sh new file +13 -0
new file mode 100644
index 0000000..9199a89
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command powertop.
+#  option: --csv
+
+test="csv"
+
+if powertop --csv --time=1 | grep powertop
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.powertop/tests/powertop_help.sh new file +13 -0
new file mode 100644
index 0000000..5128289
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command powertop.
+#  option: --help
+
+test="help"
+
+if powertop --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH v2 1/1 quota: Add test cases of quota.

In reply to Wang Mingyu

This test case is used to display disk usage and limits.

---
 tests/Functional.quota/fuego_test.sh             | 18 ++++++++++++++++++
 tests/Functional.quota/parser.py                 | 20 ++++++++++++++++++++
 tests/Functional.quota/quota_test.sh             |  4 ++++
 tests/Functional.quota/spec.json                 |  6 ++++++
 tests/Functional.quota/tests/quota_help.sh       | 13 +++++++++++++
 tests/Functional.quota/tests/quota_quotastats.sh | 13 +++++++++++++
 6 files changed, 74 insertions(+)
 create mode 100644 tests/Functional.quota/fuego_test.sh
 create mode 100644 tests/Functional.quota/parser.py
 create mode 100755 tests/Functional.quota/quota_test.sh
 create mode 100644 tests/Functional.quota/spec.json
 create mode 100644 tests/Functional.quota/tests/quota_help.sh
 create mode 100644 tests/Functional.quota/tests/quota_quotastats.sh
tests/Functional.quota/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..1bdf334
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program quota
+    assert_has_program quotastats
+}
+
+function test_deploy {
+    put $TEST_HOME/quota_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./quota_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.quota/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.quota/quota_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.quota/spec.json new file +6 -0
new file mode 100644
index 0000000..c5b371f
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.quota",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.quota/tests/quota_help.sh new file +13 -0
new file mode 100644
index 0000000..b775421
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command quota.
+#  option: --help
+
+test="help"
+
+if quota --help 2>&1| grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.quota/tests/quota_quotastats.sh new file +13 -0
new file mode 100644
index 0000000..aae4655
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command quotastats.
+#  option: --help
+
+test="quotastats"
+
+if quotastats | grep "Kernel quota version"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
Signature · 1 line
1.8.3.1
#9 lore raw
In reply to Wang Mingyu

Sorry this response is so late. See inline below for a review of this patch.

Quoted 110 lines

-----Original Message-----
From: Wang Mingyu

This test set is used to check option help and subcommand virtual of atmtcp.

---
 tests/Functional.atmtcp/atmtcp_test.sh          |  4 ++++
 tests/Functional.atmtcp/fuego_test.sh           | 17 +++++++++++++++++
 tests/Functional.atmtcp/parser.py               | 20 ++++++++++++++++++++
 tests/Functional.atmtcp/spec.json               |  6 ++++++
 tests/Functional.atmtcp/tests/atmtcp_help.sh    | 16 ++++++++++++++++
 tests/Functional.atmtcp/tests/atmtcp_virtual.sh | 24
++++++++++++++++++++++++
 6 files changed, 87 insertions(+)
 create mode 100755 tests/Functional.atmtcp/atmtcp_test.sh
 create mode 100644 tests/Functional.atmtcp/fuego_test.sh
 create mode 100644 tests/Functional.atmtcp/parser.py
 create mode 100644 tests/Functional.atmtcp/spec.json
 create mode 100644 tests/Functional.atmtcp/tests/atmtcp_help.sh
 create mode 100644 tests/Functional.atmtcp/tests/atmtcp_virtual.sh
tests/Functional.atmtcp/atmtcp_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.atmtcp/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..f4fefe9
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program atmtcp
+}
+
+function test_deploy {
+    put $TEST_HOME/atmtcp_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./atmtcp_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.atmtcp/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.atmtcp/spec.json new file +6 -0
new file mode 100644
index 0000000..423ae88
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.atmtcp",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.atmtcp/tests/atmtcp_help.sh new file +6 -0
new file mode 100644
index 0000000..e019355
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: -h
+
+test="help"

tests/Functional.atmtcp/tests/atmtcp_help.sh line 16

Quoted 10 lines
tests/Functional.atmtcp/tests/atmtcp_help.sh new file +10 -0
+
+expect <<-EOF
+spawn atmtcp -h
+expect {
+ "usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

Please change this to not require 'expect'. I think the same thing could be accomplished with:
if atmtcp -h | grep "usage:" ; then
echo "$test: TEST-PASS"
else
echo "$test: TEST-FAIL"

Quoted 7 lines
tests/Functional.atmtcp/tests/atmtcp_virtual.sh new file +0 -0
new file mode 100644
index 0000000..8b7c55d

tests/Functional.atmtcp/tests/atmtcp_virtual.sh line 8

Quoted 8 lines
tests/Functional.atmtcp/tests/atmtcp_virtual.sh new file +8 -0
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: virtual
+
+test="virtual"
+
+if modprobe -v atmtcp

This is interesting. We may want a general mechanism in Fuego to check that a module is available and insertable, for test_precheck.

maybe something like:
assert_has_module atmtcp
However, that would essentially duplicate the functionality performed here.

Quoted 17 lines
tests/Functional.atmtcp/tests/atmtcp_virtual.sh new file +16 -1
+then
+    echo " -> $test: modprobe atmtcp execution succeeded."
+else
+    echo " -> $test: modprobe atmtcp execution failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if [ ! -n "$(atmtcp virtual connect 127.0.0.1 | grep "virtual interface 0")" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+killall atmtcp
--
Quoted 1 line

1.8.3.1

OK - looks mostly good. Please remove the use of 'expect' and re-submit.
-- Tim