Skip to contentSkip to conversation

dmidecode:Add test cases for command dmidecode.

PATCH Applied Wang Mingyu 2 participants 19 messages Mar 15, 2019 – Apr 17, 2019

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

This test set is used to show the computer's DMI (some say SMBIOS ) table contents.

---
 tests/Functional.dmidecode/dmidecode_test.sh         |  4 ++++
 tests/Functional.dmidecode/fuego_test.sh             | 17 +++++++++++++++++
 tests/Functional.dmidecode/parser.py                 | 20 ++++++++++++++++++++
 tests/Functional.dmidecode/spec.json                 |  6 ++++++
 tests/Functional.dmidecode/tests/dmidecode_help.sh   | 13 +++++++++++++
 tests/Functional.dmidecode/tests/dmidecode_memory.sh | 13 +++++++++++++
 6 files changed, 73 insertions(+)
 create mode 100755 tests/Functional.dmidecode/dmidecode_test.sh
 create mode 100644 tests/Functional.dmidecode/fuego_test.sh
 create mode 100644 tests/Functional.dmidecode/parser.py
 create mode 100644 tests/Functional.dmidecode/spec.json
 create mode 100644 tests/Functional.dmidecode/tests/dmidecode_help.sh
 create mode 100644 tests/Functional.dmidecode/tests/dmidecode_memory.sh
tests/Functional.dmidecode/dmidecode_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.dmidecode/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..7aff3a9
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program dmidecode
+}
+
+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;\
+    ./dmidecode_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.dmidecode/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.dmidecode/spec.json new file +6 -0
new file mode 100644
index 0000000..99d5ae1
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dmidecode",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.dmidecode/tests/dmidecode_help.sh new file +13 -0
new file mode 100644
index 0000000..b8ed1d1
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command dmidecode.
+#  option: help
+
+test="help"
+
+if dmidecode -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.dmidecode/tests/dmidecode_memory.sh new file +13 -0
new file mode 100644
index 0000000..ce2cd1c
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command 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
#1 lore raw

PATCH v2 1/1 coreutils:Add test cases for command comm/id/sort of coreutils.

---
 tests/Functional.coreutils/coreutils_test.sh       |  4 ++++
 tests/Functional.coreutils/fuego_test.sh           | 19 +++++++++++++++++++
 tests/Functional.coreutils/parser.py               | 20 ++++++++++++++++++++
 tests/Functional.coreutils/spec.json               |  6 ++++++
 tests/Functional.coreutils/tests/coreutils_comm.sh | 13 +++++++++++++
 tests/Functional.coreutils/tests/coreutils_id.sh   | 13 +++++++++++++
 tests/Functional.coreutils/tests/coreutils_sort.sh | 13 +++++++++++++
 7 files changed, 88 insertions(+)
 create mode 100755 tests/Functional.coreutils/coreutils_test.sh
 create mode 100644 tests/Functional.coreutils/fuego_test.sh
 create mode 100644 tests/Functional.coreutils/parser.py
 create mode 100644 tests/Functional.coreutils/spec.json
 create mode 100644 tests/Functional.coreutils/tests/coreutils_comm.sh
 create mode 100644 tests/Functional.coreutils/tests/coreutils_id.sh
 create mode 100644 tests/Functional.coreutils/tests/coreutils_sort.sh
tests/Functional.coreutils/coreutils_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.coreutils/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..c5259f3
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program comm
+    assert_has_program id
+    assert_has_program sort
+}
+
+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;\
+    ./coreutils_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.coreutils/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.coreutils/spec.json new file +6 -0
new file mode 100644
index 0000000..5967f4c
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.coreutils",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.coreutils/tests/coreutils_comm.sh new file +13 -0
new file mode 100644
index 0000000..b08ba89
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command comm.
+#  option: --version
+
+test="comm"
+
+if comm --version | grep "comm (GNU coreutils)"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.coreutils/tests/coreutils_id.sh new file +13 -0
new file mode 100644
index 0000000..a625cc7
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command id.
+#  option: --version
+
+test="id"
+
+if id --version | grep "id (GNU coreutils)"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.coreutils/tests/coreutils_sort.sh new file +13 -0
new file mode 100644
index 0000000..a0b7fdb
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command 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
#2 lore raw

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

In reply to Wang Mingyu

This test set is used to check the information of specified device and target.

---
 tests/Functional.dmsetup/dmsetup_test.sh          |  4 ++++
 tests/Functional.dmsetup/fuego_test.sh            | 17 +++++++++++++++++
 tests/Functional.dmsetup/parser.py                | 20 ++++++++++++++++++++
 tests/Functional.dmsetup/spec.json                |  6 ++++++
 tests/Functional.dmsetup/tests/dmsetup_deps.sh    | 13 +++++++++++++
 tests/Functional.dmsetup/tests/dmsetup_info.sh    | 13 +++++++++++++
 tests/Functional.dmsetup/tests/dmsetup_ls.sh      | 13 +++++++++++++
 tests/Functional.dmsetup/tests/dmsetup_targets.sh | 13 +++++++++++++
 tests/Functional.dmsetup/tests/dmsetup_version.sh | 13 +++++++++++++
 9 files changed, 112 insertions(+)
 create mode 100755 tests/Functional.dmsetup/dmsetup_test.sh
 create mode 100644 tests/Functional.dmsetup/fuego_test.sh
 create mode 100644 tests/Functional.dmsetup/parser.py
 create mode 100644 tests/Functional.dmsetup/spec.json
 create mode 100644 tests/Functional.dmsetup/tests/dmsetup_deps.sh
 create mode 100644 tests/Functional.dmsetup/tests/dmsetup_info.sh
 create mode 100644 tests/Functional.dmsetup/tests/dmsetup_ls.sh
 create mode 100644 tests/Functional.dmsetup/tests/dmsetup_targets.sh
 create mode 100644 tests/Functional.dmsetup/tests/dmsetup_version.sh
tests/Functional.dmsetup/dmsetup_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.dmsetup/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..2516ac8
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program dmsetup
+}
+
+function test_deploy {
+    put $TEST_HOME/dmsetup_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./dmsetup_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.dmsetup/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.dmsetup/spec.json new file +6 -0
new file mode 100644
index 0000000..69f6298
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dmsetup",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.dmsetup/tests/dmsetup_deps.sh new file +13 -0
new file mode 100644
index 0000000..9a48eec
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command dmsetup on target.
+#  Opiton : deps
+
+test="deps"
+
+if dmsetup deps
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.dmsetup/tests/dmsetup_info.sh new file +13 -0
new file mode 100644
index 0000000..2dae662
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command dmsetup on target.
+#  Opiton : info
+
+test="info"
+
+if dmsetup info
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.dmsetup/tests/dmsetup_ls.sh new file +13 -0
new file mode 100644
index 0000000..826c1b5
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command dmsetup on target.
+#  Opiton : ls
+
+test="ls"
+
+if dmsetup ls
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.dmsetup/tests/dmsetup_targets.sh new file +13 -0
new file mode 100644
index 0000000..3ca4caa
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command dmsetup on target.
+#  Opiton : targets
+
+test="targets"
+
+if dmsetup targets | grep linear
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.dmsetup/tests/dmsetup_version.sh new file +13 -0
new file mode 100644
index 0000000..10b4024
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command dmsetup on target.
+#  Opiton : version
+
+test="version"
+
+if dmsetup version
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
Signature · 1 line
1.8.3.1
#3 lore raw

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

In reply to Wang Mingyu

This test set is used to check if the command can display the video mode settings and information of frame buffer.

---
 tests/Functional.fbset/fbset_test.sh          |  4 ++++
 tests/Functional.fbset/fuego_test.sh          | 17 +++++++++++++++++
 tests/Functional.fbset/parser.py              | 20 ++++++++++++++++++++
 tests/Functional.fbset/spec.json              |  6 ++++++
 tests/Functional.fbset/tests/fbset_help.sh    | 15 +++++++++++++++
 tests/Functional.fbset/tests/fbset_show.sh    | 18 ++++++++++++++++++
 tests/Functional.fbset/tests/fbset_verbose.sh | 15 +++++++++++++++
 tests/Functional.fbset/tests/fbset_xfree.sh   | 15 +++++++++++++++
 8 files changed, 110 insertions(+)
 create mode 100755 tests/Functional.fbset/fbset_test.sh
 create mode 100644 tests/Functional.fbset/fuego_test.sh
 create mode 100644 tests/Functional.fbset/parser.py
 create mode 100644 tests/Functional.fbset/spec.json
 create mode 100644 tests/Functional.fbset/tests/fbset_help.sh
 create mode 100644 tests/Functional.fbset/tests/fbset_show.sh
 create mode 100644 tests/Functional.fbset/tests/fbset_verbose.sh
 create mode 100644 tests/Functional.fbset/tests/fbset_xfree.sh
tests/Functional.fbset/fbset_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.fbset/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..3d659a1
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program fbset
+}
+
+function test_deploy {
+    put $TEST_HOME/fbset_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./fbset_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.fbset/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.fbset/spec.json new file +6 -0
new file mode 100644
index 0000000..0795681
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.fbset",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.fbset/tests/fbset_help.sh new file +15 -0
new file mode 100644
index 0000000..e8ae652
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: --help.
+
+test="help"
+
+fbset --help > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log
tests/Functional.fbset/tests/fbset_show.sh new file +18 -0
new file mode 100644
index 0000000..3150965
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: -s.
+
+test="show"
+
+modprobe vfb vfb_enable=1
+
+echo "sleep 3 seconds"
+sleep 3
+
+if fbset -s
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.fbset/tests/fbset_verbose.sh new file +15 -0
new file mode 100644
index 0000000..497b179
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: -v.
+
+test="verbose"
+
+modprobe vfb vfb_enable=1
+
+if fbset -i -v | grep "/dev/fb0"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.fbset/tests/fbset_xfree.sh new file +15 -0
new file mode 100644
index 0000000..7b50088
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: -x.
+
+test="xfree"
+
+modprobe vfb vfb_enable=1
+
+if fbset -x
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#4 lore raw

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

Applied. Thanks.

See one comment inline below.
-- Tim

Quoted 48 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Friday, March 15, 2019 6:56 AM
To: [email protected]
Subject: [Fuego] [PATCH v2] fbset: Add test cases for command fbset.

This test set is used to check if the command can display the video mode settings and information of frame buffer.

---
 tests/Functional.fbset/fbset_test.sh          |  4 ++++
 tests/Functional.fbset/fuego_test.sh          | 17 +++++++++++++++++
 tests/Functional.fbset/parser.py              | 20 ++++++++++++++++++++
 tests/Functional.fbset/spec.json              |  6 ++++++
 tests/Functional.fbset/tests/fbset_help.sh    | 15 +++++++++++++++
 tests/Functional.fbset/tests/fbset_show.sh    | 18 ++++++++++++++++++
 tests/Functional.fbset/tests/fbset_verbose.sh | 15 +++++++++++++++
 tests/Functional.fbset/tests/fbset_xfree.sh   | 15 +++++++++++++++
 8 files changed, 110 insertions(+)
 create mode 100755 tests/Functional.fbset/fbset_test.sh
 create mode 100644 tests/Functional.fbset/fuego_test.sh
 create mode 100644 tests/Functional.fbset/parser.py
 create mode 100644 tests/Functional.fbset/spec.json
 create mode 100644 tests/Functional.fbset/tests/fbset_help.sh
 create mode 100644 tests/Functional.fbset/tests/fbset_show.sh
 create mode 100644 tests/Functional.fbset/tests/fbset_verbose.sh
 create mode 100644 tests/Functional.fbset/tests/fbset_xfree.sh
tests/Functional.fbset/fbset_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.fbset/fuego_test.sh new file +0 -0
new file mode 100644
index 0000000..3d659a1

tests/Functional.fbset/fuego_test.sh line 2

Quoted 2 lines
tests/Functional.fbset/fuego_test.sh new file +2 -0
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program fbset

Would probably be good to check for module vfb here.

Quoted 155 lines
tests/Functional.fbset/fuego_test.sh new file +15 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/fbset_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./fbset_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.fbset/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.fbset/spec.json new file +6 -0
new file mode 100644
index 0000000..0795681
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.fbset",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.fbset/tests/fbset_help.sh new file +15 -0
new file mode 100644
index 0000000..e8ae652
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: --help.
+
+test="help"
+
+fbset --help > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log
tests/Functional.fbset/tests/fbset_show.sh new file +18 -0
new file mode 100644
index 0000000..3150965
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: -s.
+
+test="show"
+
+modprobe vfb vfb_enable=1
+
+echo "sleep 3 seconds"
+sleep 3
+
+if fbset -s
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.fbset/tests/fbset_verbose.sh new file +15 -0
new file mode 100644
index 0000000..497b179
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: -v.
+
+test="verbose"
+
+modprobe vfb vfb_enable=1
+
+if fbset -i -v | grep "/dev/fb0"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.fbset/tests/fbset_xfree.sh new file +15 -1
new file mode 100644
index 0000000..7b50088
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command fbset.
+#  option: -x.
+
+test="xfree"
+
+modprobe vfb vfb_enable=1
+
+if fbset -x
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
--

1.8.3.1

_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego

#5 lore raw

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

In reply to Wang Mingyu

This test set is used to check che inittab command halt, ifdown-ifup and sendsigs.

---
 tests/Functional.initscripts/fuego_test.sh         | 19 ++++++++++++++
 tests/Functional.initscripts/initscripts_test.sh   |  4 +++
 tests/Functional.initscripts/parser.py             | 20 +++++++++++++++
 tests/Functional.initscripts/spec.json             |  6 +++++
 .../tests/initscripts_halt.sh                      | 13 ++++++++++
 .../tests/initscripts_ifdown-ifup.sh               | 30 ++++++++++++++++++++++
 .../tests/initscripts_sendsigs.sh                  | 13 ++++++++++
 7 files changed, 105 insertions(+)
 create mode 100644 tests/Functional.initscripts/fuego_test.sh
 create mode 100755 tests/Functional.initscripts/initscripts_test.sh
 create mode 100644 tests/Functional.initscripts/parser.py
 create mode 100644 tests/Functional.initscripts/spec.json
 create mode 100644 tests/Functional.initscripts/tests/initscripts_halt.sh
 create mode 100644 tests/Functional.initscripts/tests/initscripts_ifdown-ifup.sh
 create mode 100644 tests/Functional.initscripts/tests/initscripts_sendsigs.sh
tests/Functional.initscripts/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..667c380
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program ifup
+    assert_has_program ifdown
+    assert_has_program halt
+}
+
+function test_deploy {
+    put $TEST_HOME/initscripts_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./initscripts_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.initscripts/initscripts_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.initscripts/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.initscripts/spec.json new file +6 -0
new file mode 100644
index 0000000..6560900
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.initscripts",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.initscripts/tests/initscripts_halt.sh new file +13 -0
new file mode 100644
index 0000000..fdb8487
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command halt.
+# option: none
+
+test="halt"
+
+if [ $(ls -l /etc/init.d/halt | wc -l) = 1 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.initscripts/tests/initscripts_ifdown-ifup.sh new file +30 -0
new file mode 100644
index 0000000..8c1f56f
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# In target, run command ifdown/ifup.
+# option: none
+
+test="ifdown/ifup"
+
+if [ ! -f /etc/sysconfig/network-scripts/ifcfg-lo ]
+then
+    echo " -> $test: ifcfg file is not exist."
+    echo " -> $test: TEST-SKIP"
+    exit 0
+fi
+
+if ifdown lo
+then
+    echo " -> $test: ifdown lo succeeded."
+else
+    echo " -> $test: ifdown lo  failed."
+    echo " -> $test: TEST-FAIL"
+    exit 0
+fi
+
+if ifup lo
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +13 -0
new file mode 100644
index 0000000..90f0043
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command sendsigs.
+# option: none
+
+test="sendsigs"
+
+if [ $(ls -l /etc/init.d/sendsigs | wc -l) = 1 ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#6 lore raw

Re: [Fuego] [PATCH v2] initscripts: Add test cases for commands of initscripts.

See comments inline below.

Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Friday, March 15, 2019 6:56 AM
To: [email protected]
Subject: [Fuego] [PATCH v2] initscripts: Add test cases for commands of initscripts.

This test set is used to check che inittab command halt, ifdown-ifup and

I assume 'che' should be 'the'.

Quoted 28 lines

sendsigs.

---
 tests/Functional.initscripts/fuego_test.sh         | 19 ++++++++++++++
 tests/Functional.initscripts/initscripts_test.sh   |  4 +++
 tests/Functional.initscripts/parser.py             | 20 +++++++++++++++
 tests/Functional.initscripts/spec.json             |  6 +++++
 .../tests/initscripts_halt.sh                      | 13 ++++++++++
 .../tests/initscripts_ifdown-ifup.sh               | 30 ++++++++++++++++++++++
 .../tests/initscripts_sendsigs.sh                  | 13 ++++++++++
 7 files changed, 105 insertions(+)
 create mode 100644 tests/Functional.initscripts/fuego_test.sh
 create mode 100755 tests/Functional.initscripts/initscripts_test.sh
 create mode 100644 tests/Functional.initscripts/parser.py
 create mode 100644 tests/Functional.initscripts/spec.json
 create mode 100644 tests/Functional.initscripts/tests/initscripts_halt.sh
 create mode 100644 tests/Functional.initscripts/tests/initscripts_ifdown-
ifup.sh
 create mode 100644 tests/Functional.initscripts/tests/initscripts_sendsigs.sh
tests/Functional.initscripts/fuego_test.sh new file +0 -0
new file mode 100644
index 0000000..667c380

tests/Functional.initscripts/fuego_test.sh line 4

Quoted 4 lines
tests/Functional.initscripts/fuego_test.sh new file +4 -0
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program ifup
+    assert_has_program ifdown
+    assert_has_program halt

This is going to find /sbin/halt, which is not the same as /etc/init.d/halt. Which one are you checking for here?

Quoted 73 lines
tests/Functional.initscripts/fuego_test.sh new file +15 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/initscripts_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./initscripts_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.initscripts/initscripts_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.initscripts/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.initscripts/spec.json new file +6 -0
new file mode 100644
index 0000000..6560900
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.initscripts",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.initscripts/tests/initscripts_halt.sh new file +0 -0
new file mode 100644
index 0000000..fdb8487

tests/Functional.initscripts/tests/initscripts_halt.sh line 3

Quoted 3 lines
tests/Functional.initscripts/tests/initscripts_halt.sh new file +3 -0
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command halt.

This comment appears to be wrong. See below.

tests/Functional.initscripts/tests/initscripts_halt.sh line 8

Quoted 5 lines
tests/Functional.initscripts/tests/initscripts_halt.sh new file +5 -0
+# option: none
+
+test="halt"
+
+if [ $(ls -l /etc/init.d/halt | wc -l) = 1 ]

This appears to only test that the file 'halt' is present? There is no attempt to actually execute 'halt'. Is that correct? (I realize that would cause the machine to stop, but that's why we have the 'reboot' function, which can be run mid-test if needed.)

Also, I think this could be done with 'if [ -f /etc/init.d/halt ]', removing the need for the pipe and 'wc -l'.
It would even be better, IMHO, to use [ -x /etc/init.d/halt ], to verify that the file is executable

Quoted 49 lines
tests/Functional.initscripts/tests/initscripts_halt.sh new file +5 -0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.initscripts/tests/initscripts_ifdown-ifup.sh new file +30 -0
new file mode 100644
index 0000000..8c1f56f
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# In target, run command ifdown/ifup.
+# option: none
+
+test="ifdown/ifup"
+
+if [ ! -f /etc/sysconfig/network-scripts/ifcfg-lo ]
+then
+    echo " -> $test: ifcfg file is not exist."
+    echo " -> $test: TEST-SKIP"
+    exit 0
+fi
+
+if ifdown lo
+then
+    echo " -> $test: ifdown lo succeeded."
+else
+    echo " -> $test: ifdown lo  failed."
+    echo " -> $test: TEST-FAIL"
+    exit 0
+fi
+
+if ifup lo
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +0 -0
new file mode 100644
index 0000000..90f0043

tests/Functional.initscripts/tests/initscripts_sendsigs.sh line 3

Quoted 3 lines
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +3 -0
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command sendsigs.

This comment appears to be wrong. See below.

tests/Functional.initscripts/tests/initscripts_sendsigs.sh line 8

Quoted 5 lines
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +5 -0
+# option: none
+
+test="sendsigs"
+
+if [ $(ls -l /etc/init.d/sendsigs | wc -l) = 1 ]

This doesn't run sendsigs, but just checks that it's present. Couldn't this be done with 'if [ -x /etc/init.d/sendsigs ]'?

Quoted 7 lines
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +5 -1
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
--

1.8.3.1

Thanks for the submission. Please respond to my comments and questions.
-- Tim

#7 lore raw

Re: [Fuego] [PATCH v2] initscripts: Add test cases for commands of initscripts.

Hi Tim,

Quoted 6 lines

tests/Functional.initscripts/fuego_test.sh line 4

Quoted 4 lines
tests/Functional.initscripts/fuego_test.sh new file +4 -0
+function test_pre_check {
+    assert_has_program ifup
+    assert_has_program ifdown
+    assert_has_program halt

This is going to find /sbin/halt, which is not the same as /etc/init.d/halt. Which one are you checking for here?

The test will check etc/init.d/halt, so I delete halt from here.

Other test cases were also modified according to the comment. I will resubmit the patch.

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, March 27, 2019 6:30 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH v2] initscripts: Add test cases for commands of initscripts.

See comments inline below.

Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Friday, March 15, 2019 6:56 AM
To: [email protected]
Subject: [Fuego] [PATCH v2] initscripts: Add test cases for commands of initscripts.

This test set is used to check che inittab command halt, ifdown-ifup and

I assume 'che' should be 'the'.

Quoted 31 lines

sendsigs.

---
 tests/Functional.initscripts/fuego_test.sh         | 19 ++++++++++++++
 tests/Functional.initscripts/initscripts_test.sh   |  4 +++
 tests/Functional.initscripts/parser.py             | 20 +++++++++++++++
 tests/Functional.initscripts/spec.json             |  6 +++++
 .../tests/initscripts_halt.sh                      | 13 ++++++++++
 .../tests/initscripts_ifdown-ifup.sh               | 30 ++++++++++++++++++++++
 .../tests/initscripts_sendsigs.sh                  | 13 ++++++++++
 7 files changed, 105 insertions(+)
 create mode 100644 tests/Functional.initscripts/fuego_test.sh
 create mode 100755 tests/Functional.initscripts/initscripts_test.sh
 create mode 100644 tests/Functional.initscripts/parser.py
 create mode 100644 tests/Functional.initscripts/spec.json
 create mode 100644 
tests/Functional.initscripts/tests/initscripts_halt.sh
 create mode 100644 
tests/Functional.initscripts/tests/initscripts_ifdown-
ifup.sh
 create mode 100644 

tests/Functional.initscripts/tests/initscripts_sendsigs.sh

tests/Functional.initscripts/fuego_test.sh new file +0 -0
new file mode 100644
index 0000000..667c380

tests/Functional.initscripts/fuego_test.sh line 4

Quoted 4 lines
tests/Functional.initscripts/fuego_test.sh new file +4 -0
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program ifup
+    assert_has_program ifdown
+    assert_has_program halt

This is going to find /sbin/halt, which is not the same as /etc/init.d/halt. Which one are you checking for here?

Quoted 72 lines
tests/Functional.initscripts/fuego_test.sh new file +14 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/initscripts_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ }
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./initscripts_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.initscripts/initscripts_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.initscripts/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.initscripts/spec.json new file +6 -0
new file mode 100644
index 0000000..6560900
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.initscripts",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.initscripts/tests/initscripts_halt.sh new file +0 -0
new file mode 100644
index 0000000..fdb8487

tests/Functional.initscripts/tests/initscripts_halt.sh line 3

Quoted 3 lines
tests/Functional.initscripts/tests/initscripts_halt.sh new file +3 -0
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command halt.

This comment appears to be wrong. See below.

tests/Functional.initscripts/tests/initscripts_halt.sh line 8

Quoted 5 lines
tests/Functional.initscripts/tests/initscripts_halt.sh new file +5 -0
+# option: none
+
+test="halt"
+
+if [ $(ls -l /etc/init.d/halt | wc -l) = 1 ]

This appears to only test that the file 'halt' is present?
There is no attempt to actually execute 'halt'. Is that correct?
(I realize that would cause the machine to stop, but that's why we have the 'reboot' function, which can be run mid-test if needed.)

Also, I think this could be done with 'if [ -f /etc/init.d/halt ]', removing the need for the pipe and 'wc -l'. It would even be better, IMHO, to use [ -x /etc/init.d/halt ], to verify that the file is executable

Quoted 50 lines
tests/Functional.initscripts/tests/initscripts_halt.sh new file +5 -0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
(quoted diff) +0 -0

a/tests/Functional.initscripts/tests/initscripts_ifdown-ifup.sh b/tests/Functional.initscripts/tests/initscripts_ifdown-ifup.sh new file mode 100644
index 0000000..8c1f56f

tests/Functional.initscripts/tests/initscripts_ifdown-ifup.sh new file +29 -0
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# In target, run command ifdown/ifup.
+# option: none
+
+test="ifdown/ifup"
+
+if [ ! -f /etc/sysconfig/network-scripts/ifcfg-lo ] then
+    echo " -> $test: ifcfg file is not exist."
+    echo " -> $test: TEST-SKIP"
+    exit 0
+fi
+
+if ifdown lo
+then
+    echo " -> $test: ifdown lo succeeded."
+else
+    echo " -> $test: ifdown lo  failed."
+    echo " -> $test: TEST-FAIL"
+    exit 0
+fi
+
+if ifup lo
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
(quoted diff) +0 -0

a/tests/Functional.initscripts/tests/initscripts_sendsigs.sh b/tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file mode 100644
index 0000000..90f0043

tests/Functional.initscripts/tests/initscripts_sendsigs.sh line 3

Quoted 3 lines
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +3 -0
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command sendsigs.

This comment appears to be wrong. See below.

tests/Functional.initscripts/tests/initscripts_sendsigs.sh line 8

Quoted 5 lines
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +5 -0
+# option: none
+
+test="sendsigs"
+
+if [ $(ls -l /etc/init.d/sendsigs | wc -l) = 1 ]

This doesn't run sendsigs, but just checks that it's present. Couldn't this be done with 'if [ -x /etc/init.d/sendsigs ]'?

Quoted 7 lines
tests/Functional.initscripts/tests/initscripts_sendsigs.sh new file +5 -1
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
--

1.8.3.1

Thanks for the submission. Please respond to my comments and questions.
-- Tim

#8 lore raw

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

In reply to Wang Mingyu

This test set is used to check if the network connection is OK when iperf is started with server mode and client mode.

---
 tests/Functional.iperf/fuego_test.sh          | 17 +++++++++++++++++
 tests/Functional.iperf/iperf_test.sh          |  4 ++++
 tests/Functional.iperf/parser.py              | 20 ++++++++++++++++++++
 tests/Functional.iperf/spec.json              |  6 ++++++
 tests/Functional.iperf/tests/iperf_help.sh    | 13 +++++++++++++
 tests/Functional.iperf/tests/iperf_server1.sh | 26 ++++++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server2.sh | 18 ++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server3.sh | 22 ++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server4.sh | 22 ++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server5.sh | 20 ++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server6.sh | 23 +++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_version.sh | 13 +++++++++++++
 12 files changed, 204 insertions(+)
 create mode 100644 tests/Functional.iperf/fuego_test.sh
 create mode 100755 tests/Functional.iperf/iperf_test.sh
 create mode 100644 tests/Functional.iperf/parser.py
 create mode 100644 tests/Functional.iperf/spec.json
 create mode 100644 tests/Functional.iperf/tests/iperf_help.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server1.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server2.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server3.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server4.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server5.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server6.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_version.sh
tests/Functional.iperf/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..cd42c0c
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program iperf3
+}
+
+function test_deploy {
+    put $TEST_HOME/iperf_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./iperf_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.iperf/iperf_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.iperf/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.iperf/spec.json new file +6 -0
new file mode 100644
index 0000000..cb5fec8
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.iperf",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.iperf/tests/iperf_help.sh new file +13 -0
new file mode 100644
index 0000000..8c3c629
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : --help
+
+test="help"
+
+if iperf3 --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.iperf/tests/iperf_server1.sh new file +26 -0
new file mode 100644
index 0000000..6431159
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : server(TCP)
+
+test="server1"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+sleep 10
+
+ls .
+netstat -l > iperf-test
+
+sleep 10
+
+if cat iperf-test | grep "5201"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
+rm -f iperf-test
tests/Functional.iperf/tests/iperf_server2.sh new file +18 -0
new file mode 100644
index 0000000..2e87a6f
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : server(UDP)
+
+test="server2"
+
+killall -KILL iperf3
+iperf3 -s -D
+
+if netstat -l | grep "5201"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
tests/Functional.iperf/tests/iperf_server3.sh new file +22 -0
new file mode 100644
index 0000000..fd65fd1
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : server(TCP port 6000)
+
+test="server3"
+
+killall -KILL iperf3
+
+expect <<-EOF
+spawn iperf3 -s -p 6000&
+expect {
+ -re ".*Server listening on 6000.*" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }  }
+send "\n"
+expect eof
+EOF
+
+killall -KILL iperf3
+
tests/Functional.iperf/tests/iperf_server4.sh new file +22 -0
new file mode 100644
index 0000000..fcc6d55
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : -c
+
+test="server4"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+iperf3 -c 127.0.0.1 > log
+sleep 5
+
+if cat log | grep "connected"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
+rm log
tests/Functional.iperf/tests/iperf_server5.sh new file +20 -0
new file mode 100644
index 0000000..6082e6c
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : -c (UDP)
+
+test="server5"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+sleep 3
+
+if iperf3 -c 127.0.0.1 -u | grep "connected"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
tests/Functional.iperf/tests/iperf_server6.sh new file +23 -0
new file mode 100644
index 0000000..247a22e
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : -c(port opt)
+
+test="server6"
+
+killall -KILL iperf3
+iperf3 -s -D -p 6000&
+
+expect <<-EOF
+spawn iperf3 -c 127.0.0.1 -p 6000&
+expect {
+ -re ".*connected.*" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }  }
+send "\n"
+expect eof
+EOF
+
+killall -KILL iperf3
+rm log
tests/Functional.iperf/tests/iperf_version.sh new file +13 -0
new file mode 100644
index 0000000..3ab66a4
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : version
+
+test="version"
+
+if iperf3 --version | grep "iperf 3.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
#9 lore raw

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

Thank you for submitting this patch.

See comments inline below.

tests/Functional.iperf/fuego_test.sh

Quoted 44 lines

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

This test set is used to check if the network connection is OK when iperf is started with server mode and client mode.

---
 tests/Functional.iperf/fuego_test.sh          | 17 +++++++++++++++++
 tests/Functional.iperf/iperf_test.sh          |  4 ++++
 tests/Functional.iperf/parser.py              | 20 ++++++++++++++++++++
 tests/Functional.iperf/spec.json              |  6 ++++++
 tests/Functional.iperf/tests/iperf_help.sh    | 13 +++++++++++++
 tests/Functional.iperf/tests/iperf_server1.sh | 26
++++++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server2.sh | 18 ++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server3.sh | 22
++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server4.sh | 22
++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server5.sh | 20 ++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_server6.sh | 23
+++++++++++++++++++++++
 tests/Functional.iperf/tests/iperf_version.sh | 13 +++++++++++++
 12 files changed, 204 insertions(+)
 create mode 100644 tests/Functional.iperf/fuego_test.sh
 create mode 100755 tests/Functional.iperf/iperf_test.sh
 create mode 100644 tests/Functional.iperf/parser.py
 create mode 100644 tests/Functional.iperf/spec.json
 create mode 100644 tests/Functional.iperf/tests/iperf_help.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server1.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server2.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server3.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server4.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server5.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_server6.sh
 create mode 100644 tests/Functional.iperf/tests/iperf_version.sh
tests/Functional.iperf/fuego_test.sh new file +0 -0
new file mode 100644
index 0000000..cd42c0c

This test should probably be called Functional.iperf3_server, as it tests server functionality. We already have Functional.iperf3 for clien-only tests of network performance.

tests/Functional.iperf/fuego_test.sh line 2

Quoted 3 lines
tests/Functional.iperf/fuego_test.sh new file +2 -0
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program iperf3

should check for 'netstat' here also.

Quoted 73 lines
tests/Functional.iperf/fuego_test.sh new file +15 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/iperf_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./iperf_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.iperf/iperf_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.iperf/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.iperf/spec.json new file +6 -0
new file mode 100644
index 0000000..cb5fec8
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.iperf",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.iperf/tests/iperf_help.sh new file +0 -0
new file mode 100644
index 0000000..8c3c629

tests/Functional.iperf/tests/iperf_help.sh line 4

Quoted 4 lines
tests/Functional.iperf/tests/iperf_help.sh new file +4 -0
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : --help

'Opiton' should be changed to 'Option' throughout all tests.

Quoted 16 lines
tests/Functional.iperf/tests/iperf_help.sh new file +9 -0
+
+test="help"
+
+if iperf3 --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.iperf/tests/iperf_server1.sh new file +0 -0
new file mode 100644
index 0000000..6431159

tests/Functional.iperf/tests/iperf_server1.sh line 4

Quoted 4 lines
tests/Functional.iperf/tests/iperf_server1.sh new file +4 -0
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : server(TCP)

Opiton -> Option

tests/Functional.iperf/tests/iperf_server1.sh line 16

Quoted 12 lines
tests/Functional.iperf/tests/iperf_server1.sh new file +12 -0
+
+test="server1"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+sleep 10
+
+ls .
+netstat -l > iperf-test
+
+sleep 10

Why is this sleep needed?

Quoted 17 lines
tests/Functional.iperf/tests/iperf_server1.sh new file +10 -0
+
+if cat iperf-test | grep "5201"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
+rm -f iperf-test
tests/Functional.iperf/tests/iperf_server2.sh new file +0 -0
new file mode 100644
index 0000000..2e87a6f

tests/Functional.iperf/tests/iperf_server2.sh line 4

Quoted 4 lines
tests/Functional.iperf/tests/iperf_server2.sh new file +4 -0
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : server(UDP)

Opiton -> Option

tests/Functional.iperf/tests/iperf_server2.sh line 6

Quoted 2 lines
tests/Functional.iperf/tests/iperf_server2.sh new file +2 -0
+
+test="server2"

'server2' is not very descriptive. "server_UDP" would be better

Quoted 29 lines
tests/Functional.iperf/tests/iperf_server2.sh new file +12 -0
+
+killall -KILL iperf3
+iperf3 -s -D
+
+if netstat -l | grep "5201"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
tests/Functional.iperf/tests/iperf_server3.sh new file +10 -0
new file mode 100644
index 0000000..fd65fd1
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : server(TCP port 6000)
+
+test="server3"
+
+killall -KILL iperf3
+
+expect <<-EOF

tests/Functional.iperf/tests/iperf_server3.sh line 20

Quoted 10 lines
tests/Functional.iperf/tests/iperf_server3.sh new file +10 -0
+spawn iperf3 -s -p 6000&
+expect {
+ -re ".*Server listening on 6000.*" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }  }
+send "\n"
+expect eof
+EOF
+

Can this be converted to something that doesn't use 'expect'?

Maybe like this:

iperf3 -s -p 6000 >iperf.log &
killall iperf3
if grep "Server listening on 6000" iperf.log ; then
echo $test: TEST-PASS
else
echo $test: TEST-FAIL
fi

tests/Functional.iperf/tests/iperf_server4.sh line 4

Quoted 13 lines
tests/Functional.iperf/tests/iperf_server3.sh new file +2 -0
+killall -KILL iperf3
+
tests/Functional.iperf/tests/iperf_server4.sh new file +4 -0
new file mode 100644
index 0000000..fcc6d55
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : -c

Opiton -> Option

tests/Functional.iperf/tests/iperf_server4.sh line 14

Quoted 10 lines
tests/Functional.iperf/tests/iperf_server4.sh new file +10 -0
+
+test="server4"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+iperf3 -c 127.0.0.1 > log
+sleep 5
+
+if cat log | grep "connected"

This can be:
grep "connected" log

Quoted 15 lines
tests/Functional.iperf/tests/iperf_server4.sh new file +8 -0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
+rm log
tests/Functional.iperf/tests/iperf_server5.sh new file +0 -0
new file mode 100644
index 0000000..6082e6c

tests/Functional.iperf/tests/iperf_server5.sh line 4

Quoted 4 lines
tests/Functional.iperf/tests/iperf_server5.sh new file +4 -0
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : -c (UDP)

Opiton -> Option:

Quoted 23 lines
tests/Functional.iperf/tests/iperf_server5.sh new file +16 -0
+
+test="server5"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+sleep 3
+
+if iperf3 -c 127.0.0.1 -u | grep "connected"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
tests/Functional.iperf/tests/iperf_server6.sh new file +0 -0
new file mode 100644
index 0000000..247a22e

tests/Functional.iperf/tests/iperf_server6.sh line 4

Quoted 4 lines
tests/Functional.iperf/tests/iperf_server6.sh new file +4 -0
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : -c(port opt)

Opiton -> Option

Quoted 6 lines
tests/Functional.iperf/tests/iperf_server6.sh new file +6 -0
+
+test="server6"
+
+killall -KILL iperf3
+iperf3 -s -D -p 6000&
+

tests/Functional.iperf/tests/iperf_server6.sh line 20

Quoted 10 lines
tests/Functional.iperf/tests/iperf_server6.sh new file +10 -0
+expect <<-EOF
+spawn iperf3 -c 127.0.0.1 -p 6000&
+expect {
+ -re ".*connected.*" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }  }
+send "\n"
+expect eof
+EOF

Can this be converted to something that doesn't use 'expect'?

Quoted 10 lines
tests/Functional.iperf/tests/iperf_server6.sh new file +3 -0
+
+killall -KILL iperf3
+rm log
tests/Functional.iperf/tests/iperf_version.sh new file +0 -0
new file mode 100644
index 0000000..3ab66a4

tests/Functional.iperf/tests/iperf_version.sh line 4

Quoted 4 lines
tests/Functional.iperf/tests/iperf_version.sh new file +4 -0
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Opiton : version

Opiton -> Option

Quoted 11 lines
tests/Functional.iperf/tests/iperf_version.sh new file +9 -1
+
+test="version"
+
+if iperf3 --version | grep "iperf 3.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
--

1.8.3.1

Please address my comments and re-submit.

Thanks,
-- Tim

#10 lore raw

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

Quoted 8 lines

-----Original Message-----
From: [email protected]

Quoted 1 line

+++ b/tests/Functional.iperf/fuego_test.sh

This test should probably be called Functional.iperf3_server, as it tests server functionality. We already have Functional.iperf3 for clien-only tests of network performance.

I meant to say that we have "Benchmark.iperf3" for client-only tests... Sorry for the typos and wrong names.
-- Tim

#11 lore raw

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

In reply to Wang Mingyu

This test set uses libtool to show all configuration variables and output the help and version of libtool.

---
 tests/Functional.libtool/fuego_test.sh            | 17 +++++++++++++++++
 tests/Functional.libtool/libtool_test.sh          |  4 ++++
 tests/Functional.libtool/parser.py                | 20 ++++++++++++++++++++
 tests/Functional.libtool/spec.json                |  6 ++++++
 tests/Functional.libtool/tests/libtool_config.sh  | 13 +++++++++++++
 tests/Functional.libtool/tests/libtool_help.sh    | 13 +++++++++++++
 tests/Functional.libtool/tests/libtool_version.sh | 13 +++++++++++++
 7 files changed, 86 insertions(+)
 create mode 100644 tests/Functional.libtool/fuego_test.sh
 create mode 100755 tests/Functional.libtool/libtool_test.sh
 create mode 100644 tests/Functional.libtool/parser.py
 create mode 100644 tests/Functional.libtool/spec.json
 create mode 100644 tests/Functional.libtool/tests/libtool_config.sh
 create mode 100644 tests/Functional.libtool/tests/libtool_help.sh
 create mode 100644 tests/Functional.libtool/tests/libtool_version.sh
tests/Functional.libtool/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..912ec65
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program libtool
+}
+
+function test_deploy {
+    put $TEST_HOME/libtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./libtool_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.libtool/libtool_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.libtool/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.libtool/spec.json new file +6 -0
new file mode 100644
index 0000000..0a1557e
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.libtool",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.libtool/tests/libtool_config.sh new file +13 -0
new file mode 100644
index 0000000..8011d38
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command libtool.
+#  option: --config.
+
+test="config"
+
+if libtool --config | grep "version_type=linux"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.libtool/tests/libtool_help.sh new file +13 -0
new file mode 100644
index 0000000..8d2a034
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command libtool.
+#  option: --help.
+
+test="help"
+
+if libtool --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.libtool/tests/libtool_version.sh new file +13 -0
new file mode 100644
index 0000000..1832aaf
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command libtool.
+#  option: --version.
+
+test="version"
+
+if libtool --version | grep libtool
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
Signature · 1 line
1.8.3.1
#12 lore raw

PATCH v2 1/1 libxml: Add test cases for command xmlcatalog/xmllint of libxml.

In reply to Wang Mingyu

The libxml library is used to parse XML files.
This test set is used to parse and manipulate XML or SGML files.

---
 tests/Functional.libxml/fuego_test.sh              | 18 ++++++++++++
 tests/Functional.libxml/libxml_test.sh             |  4 +++
 tests/Functional.libxml/parser.py                  | 20 ++++++++++++++
 tests/Functional.libxml/spec.json                  |  6 ++++
 tests/Functional.libxml/tests/xmlcatalog_create.sh | 13 +++++++++
 tests/Functional.libxml/tests/xmlcatalog_debug.sh  | 17 ++++++++++++
 tests/Functional.libxml/tests/xmlcatalog_help.sh   | 13 +++++++++
 tests/Functional.libxml/tests/xmllint_checkxml.sh  | 32 ++++++++++++++++++++++
 tests/Functional.libxml/tests/xmllint_debug.sh     | 32 ++++++++++++++++++++++
 tests/Functional.libxml/tests/xmllint_format.sh    | 19 +++++++++++++
 tests/Functional.libxml/tests/xmllint_noout.sh     | 32 ++++++++++++++++++++++
 11 files changed, 206 insertions(+)
 create mode 100644 tests/Functional.libxml/fuego_test.sh
 create mode 100755 tests/Functional.libxml/libxml_test.sh
 create mode 100644 tests/Functional.libxml/parser.py
 create mode 100644 tests/Functional.libxml/spec.json
 create mode 100644 tests/Functional.libxml/tests/xmlcatalog_create.sh
 create mode 100644 tests/Functional.libxml/tests/xmlcatalog_debug.sh
 create mode 100644 tests/Functional.libxml/tests/xmlcatalog_help.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_checkxml.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_debug.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_format.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_noout.sh
tests/Functional.libxml/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..0bb514d
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program xmlcatalog PROGRAM_XMLCATALOG
+    assert_has_program xmllint PROGRAM_XMLLINT
+}
+
+function test_deploy {
+    put $TEST_HOME/libxml_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./libxml_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.libxml/libxml_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.libxml/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.libxml/spec.json new file +6 -0
new file mode 100644
index 0000000..a610acb
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.libxml",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.libxml/tests/xmlcatalog_create.sh new file +13 -0
new file mode 100644
index 0000000..f9426d1
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command xmlcatalog and confirm the result.
+#  option : --create
+
+test="xmlcatalog2"
+
+if xmlcatalog --create | grep "DTD"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.libxml/tests/xmlcatalog_debug.sh new file +17 -0
new file mode 100644
index 0000000..0cd8329
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In the target to execute command xmlcatalog and confirm the result.
+#  option : --create,--verbose
+
+test="xmlcatalog3"
+
+xmlcatalog --create > catalog
+xmlcatalog --verbose catalog > log 2>&1
+if cat log | grep "Catalogs cleanup"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f catalog
+rm log
tests/Functional.libxml/tests/xmlcatalog_help.sh new file +13 -0
new file mode 100644
index 0000000..7e1b1a8
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command xmlcatalog and confirm the result.
+#  option : --help
+
+test="xmlcatalog1"
+
+if xmlcatalog --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.libxml/tests/xmllint_checkxml.sh new file +32 -0
new file mode 100644
index 0000000..1cafb57
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : none
+
+test="xmllint1"
+
+cat >> sample01.xml <<EOF
+<?xml version="1.0" encoding="Shift_JIS" ?>
+
+<!DOCTYPE linux[
+<!ELEMENT linux (distribution)>
+<!ELEMENT distribution (debian,redhat)>
+<!ELEMENT debian (#PCDATA)>
+<!ELEMENT redhat (#PCDATA)>
+]>
+
+<linux>
+  <distribution>
+    <debian>favorit</debian>
+    <redhat>interest</redhat>
+  </distribution>
+</linux>
+EOF
+
+if xmllint sample01.xml
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm sample01.xml
tests/Functional.libxml/tests/xmllint_debug.sh new file +32 -0
new file mode 100644
index 0000000..6822234
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : --debug
+
+test="xmllint3"
+
+cat >> sample01.xml <<EOF
+<?xml version="1.0" encoding="Shift_JIS" ?>
+
+<!DOCTYPE linux[
+<!ELEMENT linux (distribution)>
+<!ELEMENT distribution (debian,redhat)>
+<!ELEMENT debian (#PCDATA)>
+<!ELEMENT redhat (#PCDATA)>
+]>
+
+<linux>
+  <distribution>
+    <debian>favorit</debian>
+    <redhat>interest</redhat>
+  </distribution>
+</linux>
+EOF
+
+if xmllint --debug sample01.xml | grep ".*DTD.*linux.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm sample01.xml
tests/Functional.libxml/tests/xmllint_format.sh new file +19 -0
new file mode 100644
index 0000000..c2ea653
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : --format
+
+test="xmllint4"
+
+cat >> format.xml <<EOF
+<root><parent><child><subchild>DOCUMENT</subchild></child><child>
+<subchild>TEXT</subchild></child></parent></root>
+EOF
+
+if xmllint --format format.xml | wc -l | grep 11
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm format.xml
tests/Functional.libxml/tests/xmllint_noout.sh new file +32 -0
new file mode 100644
index 0000000..959253d
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : --noout,--valid
+
+test="xmllint2"
+
+cat >> sample01.xml <<EOF
+<?xml version="1.0" encoding="Shift_JIS" ?>
+
+<!DOCTYPE linux[
+<!ELEMENT linux (distribution)>
+<!ELEMENT distribution (debian,redhat)>
+<!ELEMENT debian (#PCDATA)>
+<!ELEMENT redhat (#PCDATA)>
+]>
+
+<linux>
+  <distribution>
+    <debian>favorit</debian>
+    <redhat>interest</redhat>
+  </distribution>
+</linux>
+EOF
+
+if xmllint --noout --valid sample01.xml
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm sample01.xml
Signature · 1 line
1.8.3.1
#13 lore raw

Re: [Fuego] [PATCH v2] libxml: Add test cases for command xmlcatalog/xmllint of libxml.

Applied to fuegotest 'next' branch.

I really appreciate that this one does some actual functional testing of the command operation. Thanks,
-- Tim

Quoted 332 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Friday, March 15, 2019 6:56 AM
To: [email protected]
Subject: [Fuego] [PATCH v2] libxml: Add test cases for command xmlcatalog/xmllint of libxml.

The libxml library is used to parse XML files.
This test set is used to parse and manipulate XML or SGML files.

---
 tests/Functional.libxml/fuego_test.sh              | 18 ++++++++++++
 tests/Functional.libxml/libxml_test.sh             |  4 +++
 tests/Functional.libxml/parser.py                  | 20 ++++++++++++++
 tests/Functional.libxml/spec.json                  |  6 ++++
 tests/Functional.libxml/tests/xmlcatalog_create.sh | 13 +++++++++
 tests/Functional.libxml/tests/xmlcatalog_debug.sh  | 17 ++++++++++++
 tests/Functional.libxml/tests/xmlcatalog_help.sh   | 13 +++++++++
 tests/Functional.libxml/tests/xmllint_checkxml.sh  | 32
++++++++++++++++++++++
 tests/Functional.libxml/tests/xmllint_debug.sh     | 32
++++++++++++++++++++++
 tests/Functional.libxml/tests/xmllint_format.sh    | 19 +++++++++++++
 tests/Functional.libxml/tests/xmllint_noout.sh     | 32
++++++++++++++++++++++
 11 files changed, 206 insertions(+)
 create mode 100644 tests/Functional.libxml/fuego_test.sh
 create mode 100755 tests/Functional.libxml/libxml_test.sh
 create mode 100644 tests/Functional.libxml/parser.py
 create mode 100644 tests/Functional.libxml/spec.json
 create mode 100644 tests/Functional.libxml/tests/xmlcatalog_create.sh
 create mode 100644 tests/Functional.libxml/tests/xmlcatalog_debug.sh
 create mode 100644 tests/Functional.libxml/tests/xmlcatalog_help.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_checkxml.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_debug.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_format.sh
 create mode 100644 tests/Functional.libxml/tests/xmllint_noout.sh
tests/Functional.libxml/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..0bb514d
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program xmlcatalog PROGRAM_XMLCATALOG
+    assert_has_program xmllint PROGRAM_XMLLINT
+}
+
+function test_deploy {
+    put $TEST_HOME/libxml_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./libxml_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.libxml/libxml_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.libxml/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.libxml/spec.json new file +6 -0
new file mode 100644
index 0000000..a610acb
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.libxml",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.libxml/tests/xmlcatalog_create.sh new file +13 -0
new file mode 100644
index 0000000..f9426d1
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command xmlcatalog and confirm the result.
+#  option : --create
+
+test="xmlcatalog2"
+
+if xmlcatalog --create | grep "DTD"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.libxml/tests/xmlcatalog_debug.sh new file +17 -0
new file mode 100644
index 0000000..0cd8329
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In the target to execute command xmlcatalog and confirm the result.
+#  option : --create,--verbose
+
+test="xmlcatalog3"
+
+xmlcatalog --create > catalog
+xmlcatalog --verbose catalog > log 2>&1
+if cat log | grep "Catalogs cleanup"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f catalog
+rm log
tests/Functional.libxml/tests/xmlcatalog_help.sh new file +13 -0
new file mode 100644
index 0000000..7e1b1a8
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command xmlcatalog and confirm the result.
+#  option : --help
+
+test="xmlcatalog1"
+
+if xmlcatalog --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.libxml/tests/xmllint_checkxml.sh new file +32 -0
new file mode 100644
index 0000000..1cafb57
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : none
+
+test="xmllint1"
+
+cat >> sample01.xml <<EOF
+<?xml version="1.0" encoding="Shift_JIS" ?>
+
+<!DOCTYPE linux[
+<!ELEMENT linux (distribution)>
+<!ELEMENT distribution (debian,redhat)>
+<!ELEMENT debian (#PCDATA)>
+<!ELEMENT redhat (#PCDATA)>
+]>
+
+<linux>
+  <distribution>
+    <debian>favorit</debian>
+    <redhat>interest</redhat>
+  </distribution>
+</linux>
+EOF
+
+if xmllint sample01.xml
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm sample01.xml
tests/Functional.libxml/tests/xmllint_debug.sh new file +32 -0
new file mode 100644
index 0000000..6822234
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : --debug
+
+test="xmllint3"
+
+cat >> sample01.xml <<EOF
+<?xml version="1.0" encoding="Shift_JIS" ?>
+
+<!DOCTYPE linux[
+<!ELEMENT linux (distribution)>
+<!ELEMENT distribution (debian,redhat)>
+<!ELEMENT debian (#PCDATA)>
+<!ELEMENT redhat (#PCDATA)>
+]>
+
+<linux>
+  <distribution>
+    <debian>favorit</debian>
+    <redhat>interest</redhat>
+  </distribution>
+</linux>
+EOF
+
+if xmllint --debug sample01.xml | grep ".*DTD.*linux.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm sample01.xml
tests/Functional.libxml/tests/xmllint_format.sh new file +19 -0
new file mode 100644
index 0000000..c2ea653
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : --format
+
+test="xmllint4"
+
+cat >> format.xml <<EOF
+<root><parent><child><subchild>DOCUMENT</subchild></child><child>
+<subchild>TEXT</subchild></child></parent></root>
+EOF
+
+if xmllint --format format.xml | wc -l | grep 11
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm format.xml
tests/Functional.libxml/tests/xmllint_noout.sh new file +32 -1
new file mode 100644
index 0000000..959253d
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#  In the target to execute command xmllint and confirm the result.
+#  option : --noout,--valid
+
+test="xmllint2"
+
+cat >> sample01.xml <<EOF
+<?xml version="1.0" encoding="Shift_JIS" ?>
+
+<!DOCTYPE linux[
+<!ELEMENT linux (distribution)>
+<!ELEMENT distribution (debian,redhat)>
+<!ELEMENT debian (#PCDATA)>
+<!ELEMENT redhat (#PCDATA)>
+]>
+
+<linux>
+  <distribution>
+    <debian>favorit</debian>
+    <redhat>interest</redhat>
+  </distribution>
+</linux>
+EOF
+
+if xmllint --noout --valid sample01.xml
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm sample01.xml
--

1.8.3.1

_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego

#14 lore raw

PATCH 1/1 bind: Fix bug for tests of service named and restore the status of service when test is over.

In reply to Wang Mingyu
---
 tests/Functional.bind/bind_test.sh                 |  5 +-
 tests/Functional.bind/data/bind9/addr.arpa.db      | 10 +++
 tests/Functional.bind/data/bind9/linux_test.com.db | 10 +++
 tests/Functional.bind/fuego_test.sh                | 24 +++----
 tests/Functional.bind/spec.json                    |  1 -
 tests/Functional.bind/tests/bind_chroot_chkconf.sh | 40 ++++--------
 tests/Functional.bind/tests/bind_chroot_dig1.sh    | 70 ++++++++++----------
 tests/Functional.bind/tests/bind_chroot_dig2.sh    | 70 ++++++++++----------
 tests/Functional.bind/tests/bind_chroot_lport.sh   | 73 ++++++++++-----------
 tests/Functional.bind/tests/bind_chroot_pid.sh     | 74 ++++++++++------------
 tests/Functional.bind/tests/bind_chroot_ps.sh      | 47 +++++++-------
 .../tests/bind_chroot_rndc-confgen.sh              | 50 +++++++--------
 .../Functional.bind/tests/bind_chroot_syslog-ng.sh | 63 +++++++++---------
 tests/Functional.bind/tests/bind_named_chkconf.sh  | 15 +++--
 tests/Functional.bind/tests/bind_named_chkzone1.sh | 22 +++++--
 tests/Functional.bind/tests/bind_named_chkzone2.sh | 22 +++++--
 tests/Functional.bind/tests/bind_named_dig1.sh     | 34 +++++++---
 tests/Functional.bind/tests/bind_named_dig2.sh     | 32 +++++++---
 tests/Functional.bind/tests/bind_named_lport.sh    | 30 +++++++--
 tests/Functional.bind/tests/bind_named_pidfile.sh  | 34 ++++++++--
 tests/Functional.bind/tests/bind_named_ps.sh       | 30 +++++++--
 tests/Functional.bind/tests/bind_named_syslog.sh   | 27 ++++++--
 tests/Functional.bind/tests/bind_rndc-confgen.sh   | 14 +++-
 23 files changed, 457 insertions(+), 340 deletions(-)
 create mode 100644 tests/Functional.bind/data/bind9/addr.arpa.db
 create mode 100644 tests/Functional.bind/data/bind9/linux_test.com.db
tests/Functional.bind/bind_test.sh +4 -1
index dd5ce37..95c34db 100755
@@ -1,4 +1,7 @@
 #!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
 for i in tests/*.sh; do
-    sh $i
+    source $i
 done
tests/Functional.bind/data/bind9/addr.arpa.db new file +10 -0
new file mode 100644
index 0000000..3100047
@@ -0,0 +1,10 @@
+$TTL    86400
+@               IN SOA  linux-test.com. root.linux-test.com. (
+                                        42              ; serial (d. adams)
+                                        3H              ; refresh
+                                        15M             ; retry
+                                        1W              ; expiry
+                                        1D )            ; minimum
+                IN NS           linux-test.com.
+		IN MX 10	linux-test.com.
+1		IN PTR		linux-test.com.
tests/Functional.bind/data/bind9/linux_test.com.db new file +10 -0
new file mode 100644
index 0000000..6a163c3
@@ -0,0 +1,10 @@
+$TTL    86400
+@               IN SOA  linux-test.com. root.linux-test.com. (
+                                        42              ; serial (d. adams)
+                                        3H              ; refresh
+                                        15M             ; retry
+                                        1W              ; expiry
+                                        1D )            ; minimum
+                IN NS           linux-test.com.
+		IN MX 10	linux-test.com.
+@		IN A	        remotehost
tests/Functional.bind/fuego_test.sh +10 -14
index 3b60197..052ee75 100644
@@ -1,16 +1,12 @@
+NEED_ROOT=1
+
 function test_pre_check {
-    is_on_target_path named-checkconf PROGRAM_CHECKCONF
-    assert_define PROGRAM_CHECKCONF "Missing 'bind' program on target board"
-    is_on_target_path dig PROGRAM_DIG
-    assert_define PROGRAM_DIG "Missing 'dig' program on target board"
-    is_on_target_path named PROGRAM_NAMED
-    assert_define PROGRAM_NAMED "Missing 'named' program on target board"
-    is_on_target_path netstat PROGRAM_NETSTAT
-    assert_define PROGRAM_NETSTAT "Missing 'netstat' program on target board"
-    is_on_target_path rndc-confgen PROGRAM_CONFGEN
-    assert_define PROGRAM_CONFGEN "Missing 'rndc-confgen' program on target board"
-    is_on_target_path named-checkzone PROGRAM_CHECKZONE
-    assert_define PROGRAM_CHECKZONE "Missing 'named-checkzone' program on target board"
+    assert_has_program named-checkconf
+    assert_has_program dig
+    assert_has_program named
+    assert_has_program netstat
+    assert_has_program rndc-confgen
+    assert_has_program named-checkzone
 }
 
 function test_deploy {
@@ -22,8 +18,8 @@ function test_deploy {
 
 function test_run {
     report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
-    export tst_bind_file=246.168.192.in-addr.arpa.db;\
-    export test_target_conf=x86_64;\
+    export tst_bind_file=$ADDR.in-addr.arpa.db;\
+    export test_target_conf=$TARGET_ARCH;\
     export remotehost=$IPADDR;\
     ./bind_test.sh"
 }
tests/Functional.bind/spec.json +0 -1
index 00a56f9..0f10617 100644
@@ -4,4 +4,3 @@
         "default": {}
     }
 }
-
tests/Functional.bind/tests/bind_chroot_chkconf.sh +12 -28
index 5a6fbb7..e69ce30 100644
@@ -4,40 +4,20 @@
 
 test="chroot_chkconf"
 
-kill -9 $(pgrep named)
-
-if [ ! -d /var/named/chroot/etc/bind ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named/chroot/etc/bind
-fi
-
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
+    mv /var/named/ /var/named_bak
 fi
 
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 cp /etc/sysconfig/named /etc/sysconfig/named_bak
 cp data/bind9/sysconfig/named /etc/sysconfig/named
 
-if [ ! -f /var/named/chroot/etc/bind/named.conf ]
-then
-    touch /var/named/chroot/etc/bind/named.conf
-fi
+touch /var/named/chroot/etc/bind/named.conf
 
 cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
 
@@ -49,4 +29,8 @@ else
 fi
 
 rm -rf /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
 mv /etc/sysconfig/named_bak /etc/sysconfig/named
tests/Functional.bind/tests/bind_chroot_dig1.sh +33 -37

121 lines not on this page · raw message

tests/Functional.bind/tests/bind_chroot_dig2.sh +32 -38

120 lines not on this page · raw message

tests/Functional.bind/tests/bind_chroot_lport.sh +33 -40

128 lines not on this page · raw message

tests/Functional.bind/tests/bind_chroot_pid.sh +32 -42

127 lines not on this page · raw message

tests/Functional.bind/tests/bind_chroot_ps.sh +24 -23

61 lines not on this page · raw message

tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh +23 -27

71 lines not on this page · raw message

tests/Functional.bind/tests/bind_chroot_syslog-ng.sh +33 -30

84 lines not on this page · raw message

tests/Functional.bind/tests/bind_named_chkconf.sh +11 -4
index 7914e0d..4494c2e 100644
@@ -4,10 +4,9 @@
 
 test="named_chkconf"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ -f /etc/bind/named.conf ]
@@ -28,3 +27,11 @@ if [ -f /etc/bind/named.conf_bak ]
 then
     mv /etc/bind/named.conf_bak /etc/bind/named.conf
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_chkzone1.sh +16 -6
index 40a6387..26ad318 100644
@@ -4,10 +4,9 @@
 
 test="named_chkzone1"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -d /var/named ]
@@ -15,8 +14,10 @@ then
     mkdir -p /var/named
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf /var/named/linux_test.com.db
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 
 if named-checkzone linux-test.com /var/named/linux_test.com.db
 then
@@ -26,3 +27,12 @@ else
 fi
 
 rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_chkzone2.sh +16 -6
index 6a3da22..625a2f2 100644
@@ -4,10 +4,9 @@
 
 test="named_chkzone2"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -d /var/named ]
@@ -15,8 +14,10 @@ then
     mkdir -p /var/named
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf /var/named/linux_test.com.db
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 
 if named-checkzone 192.168.0.0 /var/named/$tst_bind_file
 then
@@ -26,3 +27,12 @@ else
 fi
 
 rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_dig1.sh +26 -8
index 8cbbdb1..e5c8f97 100644
@@ -2,13 +2,12 @@
 
 # Start the named on target.
 # Check the IP address.
-
 test="named_dig1"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
 
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -f /etc/bind/named.conf ]
@@ -36,13 +35,17 @@ cp data/bind9/named.conf /etc/bind/named.conf
 mv /etc/bind/rndc.conf /etc/bind/rndc.conf_bak
 cp data/bind9/rndc.conf /etc/bind/rndc.conf
 
-if [ ! -d /var/named ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named
+    mv /var/named /var/named_bak
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf /var/named/linux_test.com.db
+mkdir -p /var/named
+
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 if [ ! -f /etc/hosts ]
 then
     touch /etc/hosts
@@ -50,6 +53,8 @@ fi
 mv /etc/hosts /etc/hosts_bak
 cp data/bind9/hosts /etc/hosts
 
+sleep 10
+
 exec_service_on_target named start
 
 if dig linux-test.com | grep $remotehost
@@ -64,5 +69,18 @@ exec_service_on_target named stop
 mv /etc/resolv.conf_bak /etc/resolv.conf
 mv /etc/bind/named.conf_bak /etc/bind/named.conf
 mv /etc/bind/rndc.conf_bak /etc/bind/rndc.conf
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
 rm -fr /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
 mv /etc/hosts_bak /etc/hosts
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_dig2.sh +24 -8
index 1259f3e..a792d38 100644
@@ -5,10 +5,9 @@
 
 test="named_dig2"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -f /etc/bind/named.conf ]
@@ -49,13 +48,17 @@ fi
 mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
 cp data/bind9/rndc.key /etc/bind/rndc.key
 
-if [ ! -d /var/named ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named
+    mv /var/named /var/named_bak
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf /var/named/linux_test.com.db
+mkdir -p /var/named
+
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 if [ ! -f /etc/hosts ]
 then
     touch /etc/hosts
@@ -80,6 +83,19 @@ mv /etc/resolv.conf_bak /etc/resolv.conf
 mv /etc/bind/named.conf_bak /etc/bind/named.conf
 mv /etc/bind/rndc.conf_bak /etc/bind/rndc.conf
 mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
 
 rm -fr /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
 mv /etc/hosts_bak /etc/hosts
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_lport.sh +23 -7
index 0a171a6..944b0f8 100644
@@ -5,10 +5,9 @@
 
 test="named_lport"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 if [ -f /etc/bind/rndc.key ]
 then
     rm -f /etc/bind/rndc.key
@@ -22,6 +21,10 @@ then
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -31,7 +34,14 @@ then
 else
     echo " -> port 53 is not exist."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$named_status" = "inactive" ]
+    then
+        exec_service_on_target named stop
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -42,5 +52,11 @@ else
     echo " -> port 953 is not exist."
     echo " -> $test: TEST-FAIL"
 fi
-
-exec_service_on_target named stop
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_pidfile.sh +29 -5
index be2fc89..1bfaac6 100644
@@ -5,10 +5,9 @@
 
 test="named_pidfile"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 if [ -f /etc/bind/rndc.key ]
 then
     rm -f /etc/bind/rndc.key
@@ -16,12 +15,18 @@ fi
 
 exec_service_on_target named stop
 
+sleep 5
+
 if exec_service_on_target named start
 then
     echo " -> start of named succeeded."
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ dnsmasq_status = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -31,7 +36,14 @@ then
 else
     echo " -> pid file of named is not exist."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$named_status" = "inactive" ]
+    then
+        exec_service_on_target named stop
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -41,6 +53,10 @@ then
 else
     echo " -> stop of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -50,3 +66,11 @@ then
 else
     echo " -> $test: TEST-FAIL"
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_ps.sh +25 -5
index cd5fcc0..3e52f0b 100644
@@ -4,18 +4,23 @@
 
 test="named_ps"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
+sleep 5
+
 if exec_service_on_target named start
 then
     echo " -> start of named succeeded."
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -27,7 +32,14 @@ then
 else
     echo " -> can't get the process of named."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$named_status" = "inactive" ]
+    then
+        exec_service_on_target named stop
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -39,3 +51,11 @@ then
 else
     echo " -> $test: TEST-PASS"
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_syslog.sh +20 -7
index 0b7c690..cc04717 100644
@@ -5,11 +5,12 @@
 
 test="named_syslog"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
 logger_service=$(detect_logger_service)
 
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
+
 if [ -f /etc/bind/rndc.key ]
 then
     rm -f /etc/bind/rndc.key
@@ -33,7 +34,10 @@ then
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     if [ -f /var/log/syslog_bak ]
     then
         mv /var/log/syslog_bak /var/log/syslog
@@ -41,7 +45,9 @@ else
     exit
 fi
 
-if cat /var/log/syslog | grep "starting up"
+sleep 5
+
+if cat /var/log/syslog | grep "BIND"
 then
     echo " -> $test: TEST-PASS"
 else
@@ -49,9 +55,16 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
-exec_service_on_target named stop
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
+
 if [ -f /var/log/syslog_bak ]
 then
     mv /var/log/syslog_bak /var/log/syslog
 fi
-
tests/Functional.bind/tests/bind_rndc-confgen.sh +11 -3
index adc38ca..77a7d80 100644
@@ -4,10 +4,10 @@
 
 test="rndc-confgen"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
 
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ -f /etc/bind/rndc.key ]
@@ -33,3 +33,11 @@ then
 else
     rm -f /etc/bind/rndc.key
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
Signature · 1 line
1.8.3.1
#15 lore raw

Re: [Fuego] [PATCH] bind: Fix bug for tests of service named and restore the status of service when test is over.

Looks good. Applied to the fuegotest 'next' branch.
-- Tim

Quoted 1,569 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Friday, March 15, 2019 6:56 AM
To: [email protected]
Subject: [Fuego] [PATCH] bind: Fix bug for tests of service named and restore the status of service when test is over.

---
 tests/Functional.bind/bind_test.sh                 |  5 +-
 tests/Functional.bind/data/bind9/addr.arpa.db      | 10 +++
 tests/Functional.bind/data/bind9/linux_test.com.db | 10 +++
 tests/Functional.bind/fuego_test.sh                | 24 +++----
 tests/Functional.bind/spec.json                    |  1 -
 tests/Functional.bind/tests/bind_chroot_chkconf.sh | 40 ++++--------
 tests/Functional.bind/tests/bind_chroot_dig1.sh    | 70 ++++++++++----------
 tests/Functional.bind/tests/bind_chroot_dig2.sh    | 70 ++++++++++----------
 tests/Functional.bind/tests/bind_chroot_lport.sh   | 73 ++++++++++---------
--
 tests/Functional.bind/tests/bind_chroot_pid.sh     | 74 ++++++++++----------
--
 tests/Functional.bind/tests/bind_chroot_ps.sh      | 47 +++++++-------
 .../tests/bind_chroot_rndc-confgen.sh              | 50 +++++++--------
 .../Functional.bind/tests/bind_chroot_syslog-ng.sh | 63 +++++++++---------
 tests/Functional.bind/tests/bind_named_chkconf.sh  | 15 +++--
 tests/Functional.bind/tests/bind_named_chkzone1.sh | 22 +++++--
 tests/Functional.bind/tests/bind_named_chkzone2.sh | 22 +++++--
 tests/Functional.bind/tests/bind_named_dig1.sh     | 34 +++++++---
 tests/Functional.bind/tests/bind_named_dig2.sh     | 32 +++++++---
 tests/Functional.bind/tests/bind_named_lport.sh    | 30 +++++++--
 tests/Functional.bind/tests/bind_named_pidfile.sh  | 34 ++++++++--
 tests/Functional.bind/tests/bind_named_ps.sh       | 30 +++++++--
 tests/Functional.bind/tests/bind_named_syslog.sh   | 27 ++++++--
 tests/Functional.bind/tests/bind_rndc-confgen.sh   | 14 +++-
 23 files changed, 457 insertions(+), 340 deletions(-)
 create mode 100644 tests/Functional.bind/data/bind9/addr.arpa.db
 create mode 100644 tests/Functional.bind/data/bind9/linux_test.com.db
tests/Functional.bind/bind_test.sh +4 -1
index dd5ce37..95c34db 100755
@@ -1,4 +1,7 @@
 #!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
 for i in tests/*.sh; do
-    sh $i
+    source $i
 done
tests/Functional.bind/data/bind9/addr.arpa.db new file +10 -0
new file mode 100644
index 0000000..3100047
@@ -0,0 +1,10 @@
+$TTL    86400
+@               IN SOA  linux-test.com. root.linux-test.com. (
+                                        42              ; serial (d. adams)
+                                        3H              ; refresh
+                                        15M             ; retry
+                                        1W              ; expiry
+                                        1D )            ; minimum
+                IN NS           linux-test.com.
+		IN MX 10	linux-test.com.
+1		IN PTR		linux-test.com.
tests/Functional.bind/data/bind9/linux_test.com.db new file +10 -0
new file mode 100644
index 0000000..6a163c3
@@ -0,0 +1,10 @@
+$TTL    86400
+@               IN SOA  linux-test.com. root.linux-test.com. (
+                                        42              ; serial (d. adams)
+                                        3H              ; refresh
+                                        15M             ; retry
+                                        1W              ; expiry
+                                        1D )            ; minimum
+                IN NS           linux-test.com.
+		IN MX 10	linux-test.com.
+@		IN A	        remotehost
tests/Functional.bind/fuego_test.sh +2 -2
index 3b60197..052ee75 100644
@@ -1,16 +1,12 @@
+NEED_ROOT=1
+
 function test_pre_check {
-    is_on_target_path named-checkconf PROGRAM_CHECKCONF
-    assert_define PROGRAM_CHECKCONF "Missing 'bind' program on target

board"

tests/Functional.bind/fuego_test.sh +0 -4
-    is_on_target_path dig PROGRAM_DIG
-    assert_define PROGRAM_DIG "Missing 'dig' program on target board"
-    is_on_target_path named PROGRAM_NAMED
-    assert_define PROGRAM_NAMED "Missing 'named' program on target

board"

tests/Functional.bind/fuego_test.sh +0 -2
-    is_on_target_path netstat PROGRAM_NETSTAT
-    assert_define PROGRAM_NETSTAT "Missing 'netstat' program on target

board"

tests/Functional.bind/fuego_test.sh +0 -2
-    is_on_target_path rndc-confgen PROGRAM_CONFGEN
-    assert_define PROGRAM_CONFGEN "Missing 'rndc-confgen' program on

target board"

tests/Functional.bind/fuego_test.sh +0 -2
-    is_on_target_path named-checkzone PROGRAM_CHECKZONE
-    assert_define PROGRAM_CHECKZONE "Missing 'named-checkzone'

program on target board"

tests/Functional.bind/fuego_test.sh +8 -2
+    assert_has_program named-checkconf
+    assert_has_program dig
+    assert_has_program named
+    assert_has_program netstat
+    assert_has_program rndc-confgen
+    assert_has_program named-checkzone
 }
 
 function test_deploy {
@@ -22,8 +18,8 @@ function test_deploy {
 
 function test_run {
     report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
-    export tst_bind_file=246.168.192.in-addr.arpa.db;\
-    export test_target_conf=x86_64;\
+    export tst_bind_file=$ADDR.in-addr.arpa.db;\
+    export test_target_conf=$TARGET_ARCH;\
     export remotehost=$IPADDR;\
     ./bind_test.sh"
 }
tests/Functional.bind/spec.json +0 -1
index 00a56f9..0f10617 100644
@@ -4,4 +4,3 @@
         "default": {}
     }
 }
-
tests/Functional.bind/tests/bind_chroot_chkconf.sh +12 -28
index 5a6fbb7..e69ce30 100644
@@ -4,40 +4,20 @@
 
 test="chroot_chkconf"
 
-kill -9 $(pgrep named)
-
-if [ ! -d /var/named/chroot/etc/bind ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named/chroot/etc/bind
-fi
-
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
+    mv /var/named/ /var/named_bak
 fi
 
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 cp /etc/sysconfig/named /etc/sysconfig/named_bak
 cp data/bind9/sysconfig/named /etc/sysconfig/named
 
-if [ ! -f /var/named/chroot/etc/bind/named.conf ]
-then
-    touch /var/named/chroot/etc/bind/named.conf
-fi
+touch /var/named/chroot/etc/bind/named.conf
 
 cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
 
@@ -49,4 +29,8 @@ else
 fi
 
 rm -rf /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
 mv /etc/sysconfig/named_bak /etc/sysconfig/named
tests/Functional.bind/tests/bind_chroot_dig1.sh +14 -36
index ccd261d..03c028c 100644
@@ -4,32 +4,22 @@
 
 test="chroot_dig1"
 
-kill -9 $(pgrep named)
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
 
-if [ ! -d /var/named/chroot/etc/bind ]
-then
-    mkdir -p /var/named/chroot/etc/bind
-fi
+killall -9 named
+exec_service_on_target dnsmasq stop
 
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
+if [ -d /var/named/ ]
 then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
+    mv /var/named /var/named_bak
 fi
 
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
-fi
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 
 if [ ! -f /etc/resolv.conf ]
 then
@@ -39,11 +29,7 @@ fi
 cp /etc/resolv.conf /etc/resolv.conf_bak
 cp data/bind9/resolv.conf /etc/resolv.conf
 
-if [ ! -f /var/named/chroot/etc/bind/named.conf ]
-then
-    touch /var/named/chroot/etc/bind/named.conf
-fi
-
+touch /var/named/chroot/etc/bind/named.conf
 cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
 
 if [ ! -f /etc/bind/named.conf ]
@@ -53,10 +39,7 @@ fi
 mv /etc/bind/named.conf /etc/bind/named.conf_bak
 ln -s /var/named/chroot/etc/bind/named.conf /etc/bind/named.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.conf ]
-then
-    touch /var/named/chroot/etc/bind/rndc.conf
-fi
+touch /var/named/chroot/etc/bind/rndc.conf
 cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
 
 if [ ! -f /etc/bind/rndc.conf ]
@@ -66,10 +49,7 @@ fi
 mv /etc/bind/rndc.conf /etc/bind/rndc.conf_bak
 ln -s /var/named/chroot/etc/bind/rndc.conf /etc/bind/rndc.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.key ]
-then
-    touch /var/named/chroot/etc/bind/rndc.key
-fi
+touch /var/named/chroot/etc/bind/rndc.key
 cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
 
 if [ ! -f /etc/bind/rndc.key ]
@@ -79,8 +59,10 @@ fi
 mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
 ln -s /var/named/chroot/etc/bind/rndc.key /etc/bind/rndc.key
 
-cp data/bind9/$tst_bind_file /var/named/chroot/var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/chroot/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_chroot_dig1.sh +4 -0
+cp data/bind9/addr.arpa.db /var/named/chroot/var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db

/var/named/chroot/var/named/linux_test.com.db
if [ ! -f /etc/hosts ]
then
touch /etc/hosts

tests/Functional.bind/tests/bind_chroot_dig1.sh +4 -0
@@ -90,6 +72,10 @@ cp data/bind9/hosts /etc/hosts
 
 restore_target() {
     rm -rf /var/named
+    if [ -d /var/named_bak ]
+    then
+        mv /var/named_bak /var/named
+    fi
     mv /etc/resolv.conf_bak /etc/resolv.conf
     mv /etc/hosts_bak /etc/hosts
     mv /etc/bind/named.conf_bak /etc/bind/named.conf
@@ -97,6 +83,7 @@ restore_target() {
     mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
     chown root.named /etc/bind/rndc.key /etc/bind/rndc.conf

/etc/bind/named.conf
chmod 644 /etc/bind/rndc.key /etc/bind/rndc.conf /etc/bind/named.conf

tests/Functional.bind/tests/bind_chroot_dig1.sh +11 -1
+    mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
 }
 
 named -t /var/named/chroot
@@ -108,5 +95,14 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
-kill -9 $(pgrep named)
+killall -9 named
 restore_target
+
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_chroot_dig2.sh +14 -37
index bbeb981..2c8a087 100644
@@ -4,32 +4,21 @@
 
 test="chroot_dig2"
 
-kill -9 $(pgrep named)
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
+killall -9 named
 
-if [ ! -d /var/named/chroot/etc/bind ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named/chroot/etc/bind
+    mv /var/named /var/named_bak
 fi
 
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
-fi
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 
 cp /etc/sysconfig/named /etc/sysconfig/named_bak
 cp data/bind9/sysconfig/named /etc/sysconfig/named
@@ -42,11 +31,7 @@ fi
 cp /etc/resolv.conf /etc/resolv.conf_bak
 cp data/bind9/resolv.conf /etc/resolv.conf
 
-if [ ! -f /var/named/chroot/etc/bind/named.conf ]
-then
-    touch /var/named/chroot/etc/bind/named.conf
-fi
-
+touch /var/named/chroot/etc/bind/named.conf
 cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
 
 if [ ! -f /etc/bind/named.conf ]
@@ -56,10 +41,7 @@ fi
 mv /etc/bind/named.conf /etc/bind/named.conf_bak
 ln -s /var/named/chroot/etc/bind/named.conf /etc/bind/named.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.conf ]
-then
-    touch /var/named/chroot/etc/bind/rndc.conf
-fi
+touch /var/named/chroot/etc/bind/rndc.conf
 cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
 
 if [ ! -f /etc/bind/rndc.conf ]
@@ -69,10 +51,7 @@ fi
 mv /etc/bind/rndc.conf /etc/bind/rndc.conf_bak
 ln -s /var/named/chroot/etc/bind/rndc.conf /etc/bind/rndc.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.key ]
-then
-    touch /var/named/chroot/etc/bind/rndc.key
-fi
+touch /var/named/chroot/etc/bind/rndc.key
 cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
 
 if [ ! -f /etc/bind/rndc.key ]
@@ -82,8 +61,10 @@ fi
 mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
 ln -s /var/named/chroot/etc/bind/rndc.key /etc/bind/rndc.key
 
-cp data/bind9/$tst_bind_file /var/named/chroot/var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/chroot/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_chroot_dig2.sh +4 -0
+cp data/bind9/addr.arpa.db /var/named/chroot/var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db

/var/named/chroot/var/named/linux_test.com.db
if [ ! -f /etc/hosts ]
then
touch /etc/hosts

tests/Functional.bind/tests/bind_chroot_dig2.sh +4 -0
@@ -93,6 +74,10 @@ cp data/bind9/hosts /etc/hosts
 
 restore_target() {
     rm -rf /var/named
+    if [ -d /var/named_bak ]
+    then
+        mv /var/named_bak /var/named
+    fi
     mv /etc/sysconfig/named_bak /etc/sysconfig/named
     mv /etc/resolv.conf_bak /etc/resolv.conf
     mv /etc/hosts_bak /etc/hosts
@@ -101,6 +86,7 @@ restore_target() {
     mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
     chown root.named /etc/bind/rndc.key /etc/bind/rndc.conf

/etc/bind/named.conf
chmod 644 /etc/bind/rndc.key /etc/bind/rndc.conf /etc/bind/named.conf

tests/Functional.bind/tests/bind_chroot_dig2.sh +10 -1
+    mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
 }
 
 named -t /var/named/chroot
@@ -114,5 +100,13 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
-kill -9 $(pgrep named)
+killall -9 named
 restore_target
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_chroot_lport.sh +12 -28
index 88456c0..81d1e73 100644
@@ -4,32 +4,20 @@
 
 test="chroot_lport"
 
-kill -9 $(pgrep named)
-
-if [ ! -d /var/named/chroot/etc/bind ]
-then
-    mkdir -p /var/named/chroot/etc/bind
-fi
-
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+killall -9 named
+exec_service_on_target dnsmasq stop
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named/chroot/var/named
+    mv /var/named /var/named_bak
 fi
 
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
-fi
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 
 cp /etc/sysconfig/named /etc/sysconfig/named_bak
 cp data/bind9/sysconfig/named /etc/sysconfig/named
@@ -42,11 +30,7 @@ fi
 cp /etc/resolv.conf /etc/resolv.conf_bak
 cp data/bind9/resolv.conf /etc/resolv.conf
 
-if [ ! -f /var/named/chroot/etc/bind/named.conf ]
-then
-    touch /var/named/chroot/etc/bind/named.conf
-fi
-
+touch /var/named/chroot/etc/bind/named.conf
 cp /var/named/chroot/etc/bind/named.conf

/var/named/chroot/etc/bind/named.conf_bak
cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf

tests/Functional.bind/tests/bind_chroot_lport.sh +1 -4
@@ -57,10 +41,7 @@ fi
 mv /etc/bind/named.conf /etc/bind/named.conf_bak
 ln -s /var/named/chroot/etc/bind/named.conf /etc/bind/named.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.conf ]
-then
-    touch /var/named/chroot/etc/bind/rndc.conf
-fi
+touch /var/named/chroot/etc/bind/rndc.conf
 cp /var/named/chroot/etc/bind/rndc.conf

/var/named/chroot/etc/bind/rndc.conf_bak
cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf

tests/Functional.bind/tests/bind_chroot_lport.sh +1 -4
@@ -71,10 +52,7 @@ fi
 mv /etc/bind/rndc.conf /etc/bind/rndc.conf_bak
 ln -s /var/named/chroot/etc/bind/rndc.conf /etc/bind/rndc.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.key ]
-then
-    touch /var/named/chroot/etc/bind/rndc.key
-fi
+touch /var/named/chroot/etc/bind/rndc.key
 cp /var/named/chroot/etc/bind/rndc.key

/var/named/chroot/etc/bind/rndc.key_bak
cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key

tests/Functional.bind/tests/bind_chroot_lport.sh +0 -2
@@ -85,8 +63,10 @@ fi
 mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
 ln -s /var/named/chroot/etc/bind/rndc.key /etc/bind/rndc.key
 
-cp data/bind9/$tst_bind_file /var/named/chroot/var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/chroot/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_chroot_lport.sh +4 -0
+cp data/bind9/addr.arpa.db /var/named/chroot/var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db

/var/named/chroot/var/named/linux_test.com.db
if [ ! -f /etc/hosts ]
then
touch /etc/hosts

tests/Functional.bind/tests/bind_chroot_lport.sh +4 -0
@@ -96,6 +76,10 @@ cp data/bind9/hosts /etc/hosts
 
 restore_target() {
     rm -rf /var/named
+    if [ -d /var/named_bak ]
+    then
+        mv /var/named_bak /var/named
+    fi
     mv /etc/sysconfig/named_bak /etc/sysconfig/named
     mv /etc/resolv.conf_bak /etc/resolv.conf
     mv /etc/hosts_bak /etc/hosts
@@ -104,6 +88,15 @@ restore_target() {
     mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
     chown root.named /etc/bind/rndc.key /etc/bind/rndc.conf

/etc/bind/named.conf
chmod 644 /etc/bind/rndc.key /etc/bind/rndc.conf /etc/bind/named.conf

tests/Functional.bind/tests/bind_chroot_lport.sh +11 -2
+    mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
+    if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+    then
+        exec_service_on_target named start
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
 }
 
 named -t /var/named/chroot
@@ -114,7 +107,7 @@ then
 else
     echo " -> port 53 is not active."
     echo " -> $test: TEST-FAIL"
-    kill -9 $(pgrep named)
+    killall -9 named
     restore_target
     exit
 fi
@@ -126,5 +119,5 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
-kill -9 $(pgrep named)
+killall -9 named
 restore_target
tests/Functional.bind/tests/bind_chroot_pid.sh +12 -31
index 70f872b..a2f27fd 100644
@@ -4,37 +4,22 @@
 
 test="chroot_pid"
 
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
 killall named
+exec_service_on_target dnsmasq stop
 
-if [ ! -d /var/named/chroot/etc/bind ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named/chroot/etc/bind
+    mv /var/named /var/named_bak
 fi
 
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
-fi
-
-if [ -f /var/named/chroot/var/run/named/named.pid ]
-then
-    rm -f /var/named/chroot/var/run/named/named.pid
-fi
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
+rm -f /var/named/chroot/var/run/named/named.pid
 
 cp /etc/sysconfig/named /etc/sysconfig/named_bak
 cp data/bind9/sysconfig/named /etc/sysconfig/named
@@ -47,11 +32,7 @@ fi
 cp /etc/resolv.conf /etc/resolv.conf_bak
 cp data/bind9/resolv.conf /etc/resolv.conf
 
-if [ ! -f /var/named/chroot/etc/bind/named.conf ]
-then
-    touch /var/named/chroot/etc/bind/named.conf
-fi
-
+touch /var/named/chroot/etc/bind/named.conf
 cp /var/named/chroot/etc/bind/named.conf

/var/named/chroot/etc/bind/named.conf_bak
cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf

tests/Functional.bind/tests/bind_chroot_pid.sh +1 -4
@@ -62,10 +43,7 @@ fi
 mv /etc/bind/named.conf /etc/bind/named.conf_bak
 ln -s /var/named/chroot/etc/bind/named.conf /etc/bind/named.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.conf ]
-then
-    touch /var/named/chroot/etc/bind/rndc.conf
-fi
+touch /var/named/chroot/etc/bind/rndc.conf
 cp /var/named/chroot/etc/bind/rndc.conf

/var/named/chroot/etc/bind/rndc.conf_bak
cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf

tests/Functional.bind/tests/bind_chroot_pid.sh +1 -4
@@ -76,10 +54,7 @@ fi
 mv /etc/bind/rndc.conf /etc/bind/rndc.conf_bak
 ln -s /var/named/chroot/etc/bind/rndc.conf /etc/bind/rndc.conf
 
-if [ ! -f /var/named/chroot/etc/bind/rndc.key ]
-then
-    touch /var/named/chroot/etc/bind/rndc.key
-fi
+touch /var/named/chroot/etc/bind/rndc.key
 cp /var/named/chroot/etc/bind/rndc.key

/var/named/chroot/etc/bind/rndc.key_bak
cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key

tests/Functional.bind/tests/bind_chroot_pid.sh +0 -2
@@ -90,8 +65,10 @@ fi
 mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
 ln -s /var/named/chroot/etc/bind/rndc.key /etc/bind/rndc.key
 
-cp data/bind9/$tst_bind_file /var/named/chroot/var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/chroot/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_chroot_pid.sh +4 -0
+cp data/bind9/addr.arpa.db /var/named/chroot/var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db

/var/named/chroot/var/named/linux_test.com.db
if [ ! -f /etc/hosts ]
then
touch /etc/hosts

tests/Functional.bind/tests/bind_chroot_pid.sh +4 -0
@@ -101,6 +78,10 @@ cp data/bind9/hosts /etc/hosts
 
 restore_target() {
     rm -rf /var/named
+    if [ -d /var/named_bak ]
+    then
+        mv /var/named_bak /var/named
+    fi
     mv /etc/sysconfig/named_bak /etc/sysconfig/named
     mv /etc/resolv.conf_bak /etc/resolv.conf
     mv /etc/hosts_bak /etc/hosts
@@ -109,6 +90,15 @@ restore_target() {
     mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
     chown root.named /etc/bind/rndc.key /etc/bind/rndc.conf

/etc/bind/named.conf
chmod 644 /etc/bind/rndc.key /etc/bind/rndc.conf /etc/bind/named.conf

tests/Functional.bind/tests/bind_chroot_pid.sh +10 -1
+    mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
+    if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+    then
+        exec_service_on_target named start
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
 }
 
 named -t /var/named/chroot
@@ -119,7 +109,7 @@ then
 else
     echo " -> pid file is not exist."
     echo " -> $test: TEST-FAIL"
-    killall named
+    killall -9 named
     restore_target
     exit
 fi
tests/Functional.bind/tests/bind_chroot_ps.sh +24 -23
index d99c3cb..f10fbf1 100644
@@ -4,32 +4,21 @@
 
 test="chroot_ps"
 
-kill -9 $(pgrep named)
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+killall -9 named
+exec_service_on_target dnsmasq stop
 
-if [ ! -d /var/named/chroot/etc/bind ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named/chroot/etc/bind
+    mv /var/named /var/named_bak
 fi
 
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
-fi
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 
 named -t /var/named/chroot
 
@@ -41,5 +30,17 @@ else
     echo " -> can't get the process of named."
     echo " -> $test: TEST-FAIL"
 fi
-kill -9 $(pgrep named)
+killall -9 named
 rm -rf /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh +23 -27
index be1919d..c660b7a 100644
@@ -4,32 +4,21 @@
 
 test="chroot_rndc-confgen"
 
-kill -9 $(pgrep named)
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
+killall -9 named
 
-if [ ! -d /var/named/chroot/etc/bind ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named/chroot/etc/bind
+    mv /var/named /var/named_bak
 fi
 
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
-fi
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 
 cp /etc/sysconfig/named /etc/sysconfig/named_bak
 cp data/bind9/sysconfig/named /etc/sysconfig/named
@@ -39,11 +28,6 @@ then
     mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
 fi
 
-if [ -f /var/named/chroot/etc/bind/rndc.key ]
-then
-    rm /var/named/chroot/etc/bind/rndc.key
-fi
-
 rndc-confgen -a -k rndckey -t /var/named/chroot
 if ls /var/named/chroot/etc/bind/rndc.key
 then
@@ -53,5 +37,17 @@ else
 fi
 
 rm -rf /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
 mv /etc/sysconfig/named_bak /etc/sysconfig/named
 mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_chroot_syslog-ng.sh +33 -30
index 195410f..dc25016 100644
@@ -4,11 +4,15 @@
 
 test="chroot_syslog-ng"
 
-kill -9 $(pgrep named)
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+killall -9 named
+exec_service_on_target dnsmasq stop
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
+if [ -d /var/named/ ]
+then
+    mv /var/named /var/named_bak
+fi
 
 exec_service_on_target syslog-ng stop
 
@@ -17,40 +21,39 @@ then
     mv /var/log/syslog /var/log/syslog_bak
 fi
 
-if [ ! -d /var/named/chroot/etc/bind ]
-then
-    mkdir -p /var/named/chroot/etc/bind
-fi
-
-if [ ! $(ls /var/named/chroot/etc/bind/) ]
-then
-    cp -f /etc/bind/* /var/named/chroot/etc/bind/
-fi
-
-if [ ! -d /var/named/chroot/var/named ]
-then
-    mkdir -p /var/named/chroot/var/named
-fi
-
-if [ ! -d /var/named/chroot/var/cache/bind ]
-then
-    mkdir -p /var/named/chroot/var/cache/bind
-fi
-
-if [ ! -d /var/named/chroot/var/run/named ]
-then
-    mkdir -p /var/named/chroot/var/run/named
-fi
+mkdir -p /var/named/chroot/etc/bind
+cp -f /etc/bind/* /var/named/chroot/etc/bind/
+mkdir -p /var/named/chroot/var/named
+mkdir -p /var/named/chroot/var/cache/bind
+mkdir -p /var/named/chroot/var/run/named
 
 exec_service_on_target syslog-ng restart
 
 named -t /var/named/chroot
 
-if cat /var/log/syslog | grep "starting up"
+sleep 10
+
+if cat /var/log/syslog | grep "BIND"
 then
     echo " -> $test: TEST-PASS"
 else
     echo " -> $test: TEST-FAIL"
 fi
-kill -9 $(pgrep named)
+killall -9 named
 rm -rf /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
+if [ -f /var/log/syslog_bak ]
+then
+    mv /var/log/syslog_bak /var/log/syslog
+fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_chkconf.sh +11 -4
index 7914e0d..4494c2e 100644
@@ -4,10 +4,9 @@
 
 test="named_chkconf"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ -f /etc/bind/named.conf ]
@@ -28,3 +27,11 @@ if [ -f /etc/bind/named.conf_bak ]
 then
     mv /etc/bind/named.conf_bak /etc/bind/named.conf
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_chkzone1.sh +3 -6
index 40a6387..26ad318 100644
@@ -4,10 +4,9 @@
 
 test="named_chkzone1"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -d /var/named ]
@@ -15,8 +14,10 @@ then
     mkdir -p /var/named
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_named_chkzone1.sh +13 -0
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 
 if named-checkzone linux-test.com /var/named/linux_test.com.db
 then
@@ -26,3 +27,12 @@ else
 fi
 
 rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_chkzone2.sh +3 -6
index 6a3da22..625a2f2 100644
@@ -4,10 +4,9 @@
 
 test="named_chkzone2"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -d /var/named ]
@@ -15,8 +14,10 @@ then
     mkdir -p /var/named
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_named_chkzone2.sh +13 -0
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 
 if named-checkzone 192.168.0.0 /var/named/$tst_bind_file
 then
@@ -26,3 +27,12 @@ else
 fi
 
 rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_dig1.sh +5 -8
index 8cbbdb1..e5c8f97 100644
@@ -2,13 +2,12 @@
 
 # Start the named on target.
 # Check the IP address.
-
 test="named_dig1"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
 
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -f /etc/bind/named.conf ]
@@ -36,13 +35,17 @@ cp data/bind9/named.conf /etc/bind/named.conf
 mv /etc/bind/rndc.conf /etc/bind/rndc.conf_bak
 cp data/bind9/rndc.conf /etc/bind/rndc.conf
 
-if [ ! -d /var/named ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named
+    mv /var/named /var/named_bak
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_named_dig1.sh +21 -0
+mkdir -p /var/named
+
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 if [ ! -f /etc/hosts ]
 then
     touch /etc/hosts
@@ -50,6 +53,8 @@ fi
 mv /etc/hosts /etc/hosts_bak
 cp data/bind9/hosts /etc/hosts
 
+sleep 10
+
 exec_service_on_target named start
 
 if dig linux-test.com | grep $remotehost
@@ -64,5 +69,18 @@ exec_service_on_target named stop
 mv /etc/resolv.conf_bak /etc/resolv.conf
 mv /etc/bind/named.conf_bak /etc/bind/named.conf
 mv /etc/bind/rndc.conf_bak /etc/bind/rndc.conf
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
 rm -fr /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
 mv /etc/hosts_bak /etc/hosts
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_dig2.sh +5 -8
index 1259f3e..a792d38 100644
@@ -5,10 +5,9 @@
 
 test="named_dig2"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ ! -f /etc/bind/named.conf ]
@@ -49,13 +48,17 @@ fi
 mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
 cp data/bind9/rndc.key /etc/bind/rndc.key
 
-if [ ! -d /var/named ]
+if [ -d /var/named/ ]
 then
-    mkdir -p /var/named
+    mv /var/named /var/named_bak
 fi
 
-cp data/bind9/$tst_bind_file /var/named/$tst_bind_file
-cp data/bind9/linux_test.com.db_$test_target_conf

/var/named/linux_test.com.db

tests/Functional.bind/tests/bind_named_dig2.sh +19 -0
+mkdir -p /var/named
+
+cp data/bind9/addr.arpa.db /var/named/$tst_bind_file
+cp data/bind9/linux_test.com.db data/bind9/linux_test.com.db_bak
+sed -i 's/remotehost/'"$remotehost"'/g' data/bind9/linux_test.com.db
+cp data/bind9/linux_test.com.db /var/named/linux_test.com.db
 if [ ! -f /etc/hosts ]
 then
     touch /etc/hosts
@@ -80,6 +83,19 @@ mv /etc/resolv.conf_bak /etc/resolv.conf
 mv /etc/bind/named.conf_bak /etc/bind/named.conf
 mv /etc/bind/rndc.conf_bak /etc/bind/rndc.conf
 mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
+mv data/bind9/linux_test.com.db_bak data/bind9/linux_test.com.db
 
 rm -fr /var/named
+if [ -d /var/named_bak ]
+then
+    mv /var/named_bak /var/named
+fi
 mv /etc/hosts_bak /etc/hosts
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_lport.sh +23 -7
index 0a171a6..944b0f8 100644
@@ -5,10 +5,9 @@
 
 test="named_lport"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 if [ -f /etc/bind/rndc.key ]
 then
     rm -f /etc/bind/rndc.key
@@ -22,6 +21,10 @@ then
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -31,7 +34,14 @@ then
 else
     echo " -> port 53 is not exist."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$named_status" = "inactive" ]
+    then
+        exec_service_on_target named stop
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -42,5 +52,11 @@ else
     echo " -> port 953 is not exist."
     echo " -> $test: TEST-FAIL"
 fi
-
-exec_service_on_target named stop
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_pidfile.sh +29 -5
index be2fc89..1bfaac6 100644
@@ -5,10 +5,9 @@
 
 test="named_pidfile"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 if [ -f /etc/bind/rndc.key ]
 then
     rm -f /etc/bind/rndc.key
@@ -16,12 +15,18 @@ fi
 
 exec_service_on_target named stop
 
+sleep 5
+
 if exec_service_on_target named start
 then
     echo " -> start of named succeeded."
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ dnsmasq_status = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -31,7 +36,14 @@ then
 else
     echo " -> pid file of named is not exist."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$named_status" = "inactive" ]
+    then
+        exec_service_on_target named stop
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -41,6 +53,10 @@ then
 else
     echo " -> stop of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -50,3 +66,11 @@ then
 else
     echo " -> $test: TEST-FAIL"
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_ps.sh +25 -5
index cd5fcc0..3e52f0b 100644
@@ -4,18 +4,23 @@
 
 test="named_ps"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
-
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
+sleep 5
+
 if exec_service_on_target named start
 then
     echo " -> start of named succeeded."
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -27,7 +32,14 @@ then
 else
     echo " -> can't get the process of named."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$named_status" = "inactive" ]
+    then
+        exec_service_on_target named stop
+    fi
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     exit
 fi
 
@@ -39,3 +51,11 @@ then
 else
     echo " -> $test: TEST-PASS"
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
tests/Functional.bind/tests/bind_named_syslog.sh +20 -7
index 0b7c690..cc04717 100644
@@ -5,11 +5,12 @@
 
 test="named_syslog"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
 logger_service=$(detect_logger_service)
 
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
+exec_service_on_target dnsmasq stop
+
 if [ -f /etc/bind/rndc.key ]
 then
     rm -f /etc/bind/rndc.key
@@ -33,7 +34,10 @@ then
 else
     echo " -> start of named failed."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target named stop
+    if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
     if [ -f /var/log/syslog_bak ]
     then
         mv /var/log/syslog_bak /var/log/syslog
@@ -41,7 +45,9 @@ else
     exit
 fi
 
-if cat /var/log/syslog | grep "starting up"
+sleep 5
+
+if cat /var/log/syslog | grep "BIND"
 then
     echo " -> $test: TEST-PASS"
 else
@@ -49,9 +55,16 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
-exec_service_on_target named stop
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
+
 if [ -f /var/log/syslog_bak ]
 then
     mv /var/log/syslog_bak /var/log/syslog
 fi
-
tests/Functional.bind/tests/bind_rndc-confgen.sh +11 -4
index adc38ca..77a7d80 100644
@@ -4,10 +4,10 @@
 
 test="rndc-confgen"
 
-. ./fuego_board_function_lib.sh
-
-set_init_manager
+named_status=$(get_service_status named)
+dnsmasq_status=$(get_service_status dnsmasq)
 
+exec_service_on_target dnsmasq stop
 exec_service_on_target named stop
 
 if [ -f /etc/bind/rndc.key ]
@@ -33,3 +33,11 @@ then
 else
     rm -f /etc/bind/rndc.key
 fi
+if [ "$named_status" = "active" -o "$named_status" = "unknown" ]
+then
+    exec_service_on_target named start
+fi
+if [ "$dnsmasq_status" = "active" -o "$dnsmasq_status" = "unknown" ]
+then
+    exec_service_on_target dnsmasq start
+fi
--

1.8.3.1

_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego

#16 lore raw

PATCH 1/1 dovecot:Use get_service_status to restore the status of service after the test is over.

In reply to Wang Mingyu
---
 tests/Functional.dovecot/dovecot_test.sh          |  5 ++-
 tests/Functional.dovecot/fuego_test.sh            |  5 +--
 tests/Functional.dovecot/spec.json                |  1 -
 tests/Functional.dovecot/tests/dovecot_listen.sh  |  9 +++--
 tests/Functional.dovecot/tests/dovecot_logfile.sh | 45 +++++++++++++++++++----
 tests/Functional.dovecot/tests/dovecot_pidfile.sh | 13 +++++--
 tests/Functional.dovecot/tests/dovecot_ps.sh      | 17 ++++++---
 7 files changed, 68 insertions(+), 27 deletions(-)
 mode change 100644 => 100755 tests/Functional.dovecot/dovecot_test.sh
tests/Functional.dovecot/dovecot_test.sh +4 -1
old mode 100644
new mode 100755
index dd5ce37..95c34db
@@ -1,4 +1,7 @@
 #!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
 for i in tests/*.sh; do
-    sh $i
+    source $i
 done
tests/Functional.dovecot/fuego_test.sh +2 -3
index f86510a..92fbe69 100644
@@ -1,6 +1,5 @@
 function test_pre_check {
-    is_on_target_path dovecot PROGRAM_DOVECOT
-    assert_define PROGRAM_DOVECOT "Missing 'dovecot' program on target board"
+    assert_has_program dovecot
 }
 
 function test_deploy {
@@ -11,7 +10,7 @@ function test_deploy {
 
 function test_run {
     report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
-        sh -v dovecot_test.sh"
+    ./dovecot_test.sh"
 }
 
 function test_processing {
tests/Functional.dovecot/spec.json +0 -1
index 3a71a30..c1acde1 100644
@@ -4,4 +4,3 @@
         "default": {}
     }
 }
-
tests/Functional.dovecot/tests/dovecot_listen.sh +5 -4
index 7471d79..26f4381 100644
@@ -5,9 +5,7 @@
 
 test="listen"
 
-. "./fuego_board_function_lib.sh"
-
-set_init_manager
+service_status=$(get_service_status dovecot)
 
 exec_service_on_target dovecot stop
 
@@ -26,4 +24,7 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
-exec_service_on_target dovecot stop
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target dovecot stop
+fi
tests/Functional.dovecot/tests/dovecot_logfile.sh +37 -8

68 lines not on this page · raw message

tests/Functional.dovecot/tests/dovecot_pidfile.sh +9 -4
index 95df023..06f4a2a 100644
@@ -5,9 +5,7 @@
 
 test="pidfile"
 
-. "./fuego_board_function_lib.sh"
-
-set_init_manager
+service_status=$(get_service_status dovecot)
 
 exec_service_on_target dovecot stop
 
@@ -27,7 +25,10 @@ then
 else
     echo " -> ls /var/run/dovecot/master.pid failed."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target dovecot stop
+    if [ "$service_status" = "inactive" ]
+    then
+        exec_service_on_target dovecot stop
+    fi
     exit
 fi
 
@@ -39,3 +40,7 @@ then
 else
     echo " -> $test: TEST-FAIL"
 fi
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target dovecot start
+fi
tests/Functional.dovecot/tests/dovecot_ps.sh +11 -6
index 2c627bb..190b14d 100644
@@ -5,9 +5,7 @@
 
 test="ps"
 
-. "./fuego_board_function_lib.sh"
-
-set_init_manager
+service_status=$(get_service_status dovecot)
 
 exec_service_on_target dovecot stop
 if exec_service_on_target dovecot start
@@ -19,13 +17,16 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | 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
+    if [ "$service_status" = "inactive" ]
+    then
+        exec_service_on_target dovecot stop
+    fi
     exit
 fi
 
@@ -38,9 +39,13 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
     echo " -> $test: TEST-PASS"
 fi
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target dovecot start
+fi
Signature · 1 line
1.8.3.1
#17 lore raw

Re: [Fuego] [PATCH] dovecot:Use get_service_status to restore the status of service after the test is over.

Looks good. Applied to the fuegotest 'next' branch.

Thanks!
-- Tim

Quoted 265 lines

-----Original Message-----
From: Wang Mingyu
Sent: Friday, March 15, 2019 6:56 AM
To: [email protected]
Subject: [Fuego] [PATCH] dovecot:Use get_service_status to restore the status of service after the test is over.

---
 tests/Functional.dovecot/dovecot_test.sh          |  5 ++-
 tests/Functional.dovecot/fuego_test.sh            |  5 +--
 tests/Functional.dovecot/spec.json                |  1 -
 tests/Functional.dovecot/tests/dovecot_listen.sh  |  9 +++--
 tests/Functional.dovecot/tests/dovecot_logfile.sh | 45
+++++++++++++++++++----
 tests/Functional.dovecot/tests/dovecot_pidfile.sh | 13 +++++--
 tests/Functional.dovecot/tests/dovecot_ps.sh      | 17 ++++++---
 7 files changed, 68 insertions(+), 27 deletions(-)
 mode change 100644 => 100755 tests/Functional.dovecot/dovecot_test.sh
tests/Functional.dovecot/dovecot_test.sh +4 -1
old mode 100644
new mode 100755
index dd5ce37..95c34db
@@ -1,4 +1,7 @@
 #!/bin/sh
+. ./fuego_board_function_lib.sh
+set_init_manager
+
 for i in tests/*.sh; do
-    sh $i
+    source $i
 done
tests/Functional.dovecot/fuego_test.sh +0 -2
index f86510a..92fbe69 100644
@@ -1,6 +1,5 @@
 function test_pre_check {
-    is_on_target_path dovecot PROGRAM_DOVECOT
-    assert_define PROGRAM_DOVECOT "Missing 'dovecot' program on target

board"

tests/Functional.dovecot/fuego_test.sh +2 -1
+    assert_has_program dovecot
 }
 
 function test_deploy {
@@ -11,7 +10,7 @@ function test_deploy {
 
 function test_run {
     report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
-        sh -v dovecot_test.sh"
+    ./dovecot_test.sh"
 }
 
 function test_processing {
tests/Functional.dovecot/spec.json +0 -1
index 3a71a30..c1acde1 100644
@@ -4,4 +4,3 @@
         "default": {}
     }
 }
-
tests/Functional.dovecot/tests/dovecot_listen.sh +5 -4
index 7471d79..26f4381 100644
@@ -5,9 +5,7 @@
 
 test="listen"
 
-. "./fuego_board_function_lib.sh"
-
-set_init_manager
+service_status=$(get_service_status dovecot)
 
 exec_service_on_target dovecot stop
 
@@ -26,4 +24,7 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
-exec_service_on_target dovecot stop
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target dovecot stop
+fi
tests/Functional.dovecot/tests/dovecot_logfile.sh +0 -0
index 7489103..fed6067 100644
@@ -3,18 +3,37 @@
 #  In the target to start dovecot dovecot, to confirm the acquisition of the

log.
# check the keyword "dovecot".

tests/Functional.dovecot/tests/dovecot_logfile.sh +37 -8
-
 test="logfile"
-service_name=""
-
-. "./fuego_board_function_lib.sh"
 
-set_init_manager
+service_status=$(get_service_status dovecot)
+logger_service=$(detect_logger_service)
 
 exec_service_on_target dovecot stop
-rm -f /var/log/mail.log
 
-exec_service_on_target $service_name restart
+if [ -f /var/log/mail.log ]
+then
+    mv /var/log/mail.log /var/log/mail.log_bak
+fi
+
+if [ -f /var/log/messages ]
+then
+    mv /var/log/messages /var/log/messages_bak
+fi
+
+restore_target() {
+    if [ -f /var/log/messages_bak ]
+    then
+        mv /var/log/messages_bak /var/log/messages
+    fi
+    if [ -f /var/log/mail.log_bak ]
+    then
+        mv /var/log/mail.log_bak /var/log/mail.log
+    fi
+}
+
+exec_service_on_target $logger_service restart
+
+sleep 3
 
 if exec_service_on_target dovecot start
 then
@@ -22,13 +41,23 @@ then
 else
     echo " -> start of dovecot failed."
     echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
 fi
 
+sleep 3
+
 if tail /var/log/mail.log | grep "dovecot"
 then
-    echo " -> $test: TEST-PASS"
+    echo " -> grep dovecto from mail.log"
 else
+    echo " -> can't grep dovecto from mail.log"
     echo " -> $test: TEST-FAIL"
 fi
 
 exec_service_on_target dovecot stop
+restore_target
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target dovecot start
+fi
tests/Functional.dovecot/tests/dovecot_pidfile.sh +9 -4
index 95df023..06f4a2a 100644
@@ -5,9 +5,7 @@
 
 test="pidfile"
 
-. "./fuego_board_function_lib.sh"
-
-set_init_manager
+service_status=$(get_service_status dovecot)
 
 exec_service_on_target dovecot stop
 
@@ -27,7 +25,10 @@ then
 else
     echo " -> ls /var/run/dovecot/master.pid failed."
     echo " -> $test: TEST-FAIL"
-    exec_service_on_target dovecot stop
+    if [ "$service_status" = "inactive" ]
+    then
+        exec_service_on_target dovecot stop
+    fi
     exit
 fi
 
@@ -39,3 +40,7 @@ then
 else
     echo " -> $test: TEST-FAIL"
 fi
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target dovecot start
+fi
tests/Functional.dovecot/tests/dovecot_ps.sh +11 -7
index 2c627bb..190b14d 100644
@@ -5,9 +5,7 @@
 
 test="ps"
 
-. "./fuego_board_function_lib.sh"
-
-set_init_manager
+service_status=$(get_service_status dovecot)
 
 exec_service_on_target dovecot stop
 if exec_service_on_target dovecot start
@@ -19,13 +17,16 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | 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
+    if [ "$service_status" = "inactive" ]
+    then
+        exec_service_on_target dovecot stop
+    fi
     exit
 fi
 
@@ -38,9 +39,13 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
     echo " -> $test: TEST-PASS"
 fi
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target dovecot start
+fi
--

1.8.3.1

_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego

#18 lore raw
In reply to Wang Mingyu
Quoted 144 lines

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

This test set is used to show the computer's DMI (some say SMBIOS ) table contents.

---
 tests/Functional.dmidecode/dmidecode_test.sh         |  4 ++++
 tests/Functional.dmidecode/fuego_test.sh             | 17 +++++++++++++++++
 tests/Functional.dmidecode/parser.py                 | 20
++++++++++++++++++++
 tests/Functional.dmidecode/spec.json                 |  6 ++++++
 tests/Functional.dmidecode/tests/dmidecode_help.sh   | 13
+++++++++++++
 tests/Functional.dmidecode/tests/dmidecode_memory.sh | 13
+++++++++++++
 6 files changed, 73 insertions(+)
 create mode 100755 tests/Functional.dmidecode/dmidecode_test.sh
 create mode 100644 tests/Functional.dmidecode/fuego_test.sh
 create mode 100644 tests/Functional.dmidecode/parser.py
 create mode 100644 tests/Functional.dmidecode/spec.json
 create mode 100644 tests/Functional.dmidecode/tests/dmidecode_help.sh
 create mode 100644

tests/Functional.dmidecode/tests/dmidecode_memory.sh

tests/Functional.dmidecode/dmidecode_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.dmidecode/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..7aff3a9
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program dmidecode
+}
+
+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;\
+    ./dmidecode_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.dmidecode/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.dmidecode/spec.json new file +6 -0
new file mode 100644
index 0000000..99d5ae1
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dmidecode",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.dmidecode/tests/dmidecode_help.sh new file +13 -0
new file mode 100644
index 0000000..b8ed1d1
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command dmidecode.
+#  option: help
+
+test="help"
+
+if dmidecode -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.dmidecode/tests/dmidecode_memory.sh new file +13 -1
new file mode 100644
index 0000000..ce2cd1c
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command 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;
--
Quoted 1 line

1.8.3.1

I wish this test did some validation of the data returned by the command. But this is OK as a skeleton start for testing this functionality.

Applied in 'next'.
-- Tim