Skip to contentSkip to conversation

kbd: Add test cases for commands of kbd.

PATCH In review Wang Mingyu 2 participants 20 messages Oct 9, 2018 – Oct 13, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbd: Add test cases for commands of kbd.

---
 engine/tests/Functional.kbd/fuego_test.sh          | 56 ++++++++++++++++++++++
 engine/tests/Functional.kbd/kbd_test.sh            |  4 ++
 engine/tests/Functional.kbd/parser.py              | 22 +++++++++
 engine/tests/Functional.kbd/spec.json              |  6 +++
 engine/tests/Functional.kbd/tests/chvt.sh          | 30 ++++++++++++
 engine/tests/Functional.kbd/tests/deallocvt.sh     | 14 ++++++
 engine/tests/Functional.kbd/tests/dumpkeys1.sh     | 12 +++++
 engine/tests/Functional.kbd/tests/dumpkeys2.sh     | 13 +++++
 engine/tests/Functional.kbd/tests/dumpkeys3.sh     | 22 +++++++++
 engine/tests/Functional.kbd/tests/fgconsole.sh     | 12 +++++
 engine/tests/Functional.kbd/tests/kbd_mode1.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode2.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode3.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode4.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbdrate1.sh      | 12 +++++
 engine/tests/Functional.kbd/tests/kbdrate2.sh      | 13 +++++
 engine/tests/Functional.kbd/tests/loadkeys.sh      | 13 +++++
 engine/tests/Functional.kbd/tests/loadunimap.sh    | 15 ++++++
 engine/tests/Functional.kbd/tests/mapscrn.sh       | 15 ++++++
 engine/tests/Functional.kbd/tests/openvt.sh        | 25 ++++++++++
 engine/tests/Functional.kbd/tests/psfaddtable.sh   | 15 ++++++
 engine/tests/Functional.kbd/tests/psfgettable.sh   | 15 ++++++
 engine/tests/Functional.kbd/tests/psfxtable.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/resizecons.sh    | 15 ++++++
 engine/tests/Functional.kbd/tests/setfont.sh       | 16 +++++++
 engine/tests/Functional.kbd/tests/setkeycodes.sh   | 16 +++++++
 engine/tests/Functional.kbd/tests/setleds.sh       | 13 +++++
 .../tests/Functional.kbd/tests/showconsolefont.sh  | 12 +++++
 engine/tests/Functional.kbd/tests/showkey.sh       | 17 +++++++
 engine/tests/Functional.kbd/tests/unicode_start.sh | 15 ++++++
 30 files changed, 493 insertions(+)
 create mode 100644 engine/tests/Functional.kbd/fuego_test.sh
 create mode 100755 engine/tests/Functional.kbd/kbd_test.sh
 create mode 100644 engine/tests/Functional.kbd/parser.py
 create mode 100644 engine/tests/Functional.kbd/spec.json
 create mode 100644 engine/tests/Functional.kbd/tests/chvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/deallocvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys3.sh
 create mode 100644 engine/tests/Functional.kbd/tests/fgconsole.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode3.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode4.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbdrate1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbdrate2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/loadkeys.sh
 create mode 100644 engine/tests/Functional.kbd/tests/loadunimap.sh
 create mode 100644 engine/tests/Functional.kbd/tests/mapscrn.sh
 create mode 100644 engine/tests/Functional.kbd/tests/openvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfaddtable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfgettable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfxtable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/resizecons.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setfont.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setkeycodes.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setleds.sh
 create mode 100644 engine/tests/Functional.kbd/tests/showconsolefont.sh
 create mode 100644 engine/tests/Functional.kbd/tests/showkey.sh
 create mode 100644 engine/tests/Functional.kbd/tests/unicode_start.sh
engine/tests/Functional.kbd/fuego_test.sh new file +56 -0
new file mode 100644
index 0000000..fd5084f
@@ -0,0 +1,56 @@
+function test_pre_check {
+    is_on_target_path chvt PROGRAM_CHVT
+    assert_define PROGRAM_CHVT "Missing 'chvt' program on target board"
+    is_on_target_path deallocvt PROGRAM_DEALLOCVT
+    assert_define PROGRAM_DEALLOCVT "Missing 'deallocvt' program on target board"
+    is_on_target_path dumpkeys PROGRAM_DUMPKEYS
+    assert_define PROGRAM_DUMPKEYS "Missing 'dumpkeys' program on target board"
+    is_on_target_path fgconsole PROGRAM_FGCONSOLE
+    assert_define PROGRAM_FGCONSOLE "Missing 'fgconsole' program on target board"
+    is_on_target_path kbd_mode PROGRAM_KBD_MODE
+    assert_define PROGRAM_KBD_MODE "Missing 'kbd_mode' program on target board"
+    is_on_target_path kbdrate PROGRAM_KBDRATE
+    assert_define PROGRAM_KBDRATE "Missing 'kbdrate' program on target board"
+    is_on_target_path loadkeys PROGRAM_LOADKEYS
+    assert_define PROGRAM_LOADKEYS "Missing 'loadkeys' program on target board"
+    is_on_target_path loadunimap PROGRAM_LOADUNIMAP
+    assert_define PROGRAM_LOADUNIMAP "Missing 'loadunimap' program on target board"
+    is_on_target_path mapscrn PROGRAM_MAPSCRN
+    assert_define PROGRAM_MAPSCRN "Missing 'mapscrn' program on target board"
+    is_on_target_path openvt PROGRAM_OPENVT
+    assert_define PROGRAM_OPENVT "Missing 'openvt' program on target board"
+    is_on_target_path psfaddtable PROGRAM_PSFADDTABLE
+    assert_define PROGRAM_PSFADDTABLE "Missing 'psfaddtable' program on target board"
+    is_on_target_path psfgettable PROGRAM_PSFGETTABLE
+    assert_define PROGRAM_PSFGETTABLE "Missing 'psfgettable' program on target board"
+    is_on_target_path psfxtable PROGRAM_PSFXTABLE
+    assert_define PROGRAM_PSFXTABLE "Missing 'psfxtable' program on target board"
+    is_on_target_path resizecons PROGRAM_RESIZECONS
+    assert_define PROGRAM_RESIZECONS "Missing 'resizecons' program on target board"
+    is_on_target_path setfont PROGRAM_SETFONT
+    assert_define PROGRAM_SETFONT "Missing 'setfont' program on target board"
+    is_on_target_path setkeycodes PROGRAM_SETKEYCODES
+    assert_define PROGRAM_SETKEYCODES "Missing 'setkeycodes' program on target board"
+    is_on_target_path setleds PROGRAM_SETLEDS
+    assert_define PROGRAM_SETLEDS "Missing 'setleds' program on target board"
+    is_on_target_path showconsolefont PROGRAM_SHOWCONSOLEFONT
+    assert_define PROGRAM_SHOWCONSOLEFONT "Missing 'showconsolefont' program on target board"
+    is_on_target_path showkey PROGRAM_SHOWKEY
+    assert_define PROGRAM_SHOWKEY "Missing 'showkey' program on target board"
+    is_on_target_path unicode_start PROGRAM_UNICODE_START
+    assert_define PROGRAM_UNICODE_START "Missing 'unicode_start' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/kbd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./kbd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.kbd/kbd_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
engine/tests/Functional.kbd/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.kbd/spec.json new file +6 -0
new file mode 100644
index 0000000..0a85fef
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.kbd",
+    "specs": {
+        "default": {}
+    }
+}
engine/tests/Functional.kbd/tests/chvt.sh new file +30 -0
new file mode 100644
index 0000000..7bdeaf0
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  In the target to execute command chvt and confirm the result.
+
+test="chvt"
+
+if tty | grep "^not" ; then
+    echo " -> $test: test script not running in a changable tty"
+    echo " -> $test: TEST-SKIP"
+    exit 0
+fi
+
+tty_path=$(tty)
+# use shell variable sub-string removal to isolate the tty number
+anum=${tty_path##*/}
+if [ $anum -eq 1 ]
+then
+    bnum=$(($anum+1))
+else
+    bnum=$(($anum-1))
+fi
+echo "$test: Changing to VT $bnum"
+if chvt $bnum
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+echo "$test: Changing back to VT $bnum"
+chvt $anum
engine/tests/Functional.kbd/tests/deallocvt.sh new file +14 -0
new file mode 100644
index 0000000..26bb2d0
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  In the target to execute command deallocvt and confirm the result.
+
+test="deallocvt"
+
+openvt -f -c 4 ls
+sleep 1
+if deallocvt 4
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys1.sh new file +12 -0
new file mode 100644
index 0000000..96e0d5c
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result .
+
+test="dumpkeys1"
+
+if dumpkeys > /dev/null
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys2.sh new file +13 -0
new file mode 100644
index 0000000..511a6bc
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result.
+#  option : -i
+
+test="dumpkeys2"
+
+if dumpkeys -i | grep "keycode range supported by kernel"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys3.sh new file +22 -0
new file mode 100644
index 0000000..e2db65a
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result .
+#  option : -n
+
+test="dumpkeys3"
+
+if [ -f dumpkeys_test ]
+then
+    rm -f dumpkeys_test
+fi
+
+dumpkeys -n > dumpkeys_test
+
+if cat dumpkeys_test | grep "keymaps"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm dumpkeys_test
engine/tests/Functional.kbd/tests/fgconsole.sh new file +12 -0
new file mode 100644
index 0000000..9fa4410
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command fgconsole and confirm the result.
+
+test="fgconsole"
+
+if fgconsole
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/kbd_mode1.sh new file +15 -0
new file mode 100644
index 0000000..d86c224
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -s
+
+test="kbd_mode1"
+
+kbd_mode -s
+if kbd_mode | grep scancode
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode2.sh new file +15 -0
new file mode 100644
index 0000000..6f43ae6
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -k
+
+test="kbd_mode2"
+
+kbd_mode -k
+if kbd_mode | grep mediumraw
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode3.sh new file +15 -0
new file mode 100644
index 0000000..bbb8f0b
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -a
+
+test="kbd_mode3"
+
+kbd_mode -a
+if kbd_mode | grep ASCII
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode4.sh new file +15 -0
new file mode 100644
index 0000000..ce4132f
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -u
+
+test="kbd_mode4"
+
+kbd_mode -u
+if kbd_mode | grep UTF-8
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbdrate1.sh new file +12 -0
new file mode 100644
index 0000000..a16150e
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command kbdrate and confirm the result.
+
+test="kbdrate1"
+
+if kbdrate | grep Typematic
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/kbdrate2.sh new file +13 -0
new file mode 100644
index 0000000..33d3b37
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command kbdrate and confirm the result.
+#  option : -r
+
+test="kbdrate2"
+
+if kbdrate -r 15 -d 250
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/loadkeys.sh new file +13 -0
new file mode 100644
index 0000000..5458630
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command loadkeys and confirm the result.
+#  option : -d
+
+test="loadkeys"
+
+if loadkeys -d
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/loadunimap.sh new file +15 -0
new file mode 100644
index 0000000..ce2a24c
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command loadunimap and confirm the result.
+
+test="loadunimap"
+
+expect <<-EOF
+spawn loadunimap
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/mapscrn.sh new file +15 -0
new file mode 100644
index 0000000..5a9cfd5
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command mapscrn and confirm the result.
+
+test="mapscrn"
+
+expect <<-EOF
+spawn mapscrn
+expect {
+ "usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/openvt.sh new file +25 -0
new file mode 100644
index 0000000..7a70dc6
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  In the target to execute command openvt and confirm the result.
+#  option : -f
+
+test="openvt"
+
+killall sleep
+openvt -f -c 2 sleep 15732
+if  ps aux | grep "[s]leep 15732"
+then
+    echo " -> $test: ps aux | grep "[s]leep 15732" executed."
+else
+    echo " -> $test: ps aux | grep "[s]leep 15732" failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi;
+
+kill $(pgrep -f "[s]leep 15732")
+if ps aux | grep "[s]leep 15732"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
engine/tests/Functional.kbd/tests/psfaddtable.sh new file +15 -0
new file mode 100644
index 0000000..79449d2
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfaddtable and confirm the result.
+
+test="psfaddtable"
+
+expect <<-EOF
+spawn psfaddtable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/psfgettable.sh new file +15 -0
new file mode 100644
index 0000000..4c8d201
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfgettable and confirm the result.
+
+test="psfgettable"
+
+expect <<-EOF
+spawn psfgettable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/psfxtable.sh new file +15 -0
new file mode 100644
index 0000000..49e7316
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfxtable and confirm the result.
+
+test="psfxtable"
+
+expect <<-EOF
+spawn psfxtable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/resizecons.sh new file +15 -0
new file mode 100644
index 0000000..7002e6a
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command resizecons and confirm the result.
+
+test="resizecons"
+
+expect <<-EOF
+spawn resizecons
+expect {
+ "COLSxROWS" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/setfont.sh new file +16 -0
new file mode 100644
index 0000000..e97d504
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command setfont and confirm the result.
+#  option : -h
+
+test="setfont"
+
+expect <<-EOF
+spawn setfont -h
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/setkeycodes.sh new file +16 -0
new file mode 100644
index 0000000..3300318
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command setkeycodes and confirm the result.
+#  option : -h
+
+test="setkeycodes"
+
+expect <<-EOF
+spawn setkeycodes -h
+expect {
+ "usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/setleds.sh new file +13 -0
new file mode 100644
index 0000000..1d97700
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command setleds and confirm the result.
+#  option : -V
+
+test="setleds"
+
+if setleds -V | grep "setleds from"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/showconsolefont.sh new file +12 -0
new file mode 100644
index 0000000..aadbeab
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command showconsolefont and confirm the result.
+
+test="showconsolefont"
+
+if showconsolefont
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/showkey.sh new file +17 -0
new file mode 100644
index 0000000..e064077
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In the target to execute command showkey and confirm the result.
+#  option : -h
+
+test="showkey"
+
+expect <<-EOF
+spawn showkey -h
+expect {
+ "usage:" {
+           send "\n"
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.kbd/tests/unicode_start.sh new file +15 -0
new file mode 100644
index 0000000..6af7c2f
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command unicode_start and confirm the result.
+
+test="unicode_start"
+
+expect <<-EOF
+spawn unicode_start
+expect {
+ "skipped" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 mcelog: Add test cases for command mcelog.

---
 engine/tests/Functional.mcelog/fuego_test.sh      | 18 ++++++++++++++++++
 engine/tests/Functional.mcelog/mcelog_test.sh     |  4 ++++
 engine/tests/Functional.mcelog/parser.py          | 22 ++++++++++++++++++++++
 engine/tests/Functional.mcelog/spec.json          |  7 +++++++
 engine/tests/Functional.mcelog/tests/mcelog_01.sh | 17 +++++++++++++++++
 engine/tests/Functional.mcelog/tests/mcelog_02.sh | 22 ++++++++++++++++++++++
 6 files changed, 90 insertions(+)
 create mode 100644 engine/tests/Functional.mcelog/fuego_test.sh
 create mode 100755 engine/tests/Functional.mcelog/mcelog_test.sh
 create mode 100644 engine/tests/Functional.mcelog/parser.py
 create mode 100644 engine/tests/Functional.mcelog/spec.json
 create mode 100644 engine/tests/Functional.mcelog/tests/mcelog_01.sh
 create mode 100644 engine/tests/Functional.mcelog/tests/mcelog_02.sh
engine/tests/Functional.mcelog/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..1950cb8
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path mcelog PROGRAM_MCELOG
+    assert_define PROGRAM_MCELOG "Missing 'mcelog' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/mcelog_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./mcelog_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.mcelog/mcelog_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
engine/tests/Functional.mcelog/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.mcelog/spec.json new file +7 -0
new file mode 100644
index 0000000..2ccad89
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.mcelog",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.mcelog/tests/mcelog_01.sh new file +17 -0
new file mode 100644
index 0000000..8276ebb
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run command mcelog.
+#  If the text that is not an error log is input to mcelog, it is confirmed that the decoding process is not performed.
+
+test="mcelog_01"
+
+mkdir mcelog
+echo "this file is not hardware error log" > mcelog/mcelog_plain_text.log
+
+if mcelog --ascii < mcelog/mcelog_plain_text.log | grep "this file is not hardware error log"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr mcelog
engine/tests/Functional.mcelog/tests/mcelog_02.sh new file +22 -0
new file mode 100644
index 0000000..9a80ff9
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  In target, run command mcelog.
+#  Verify that the error log is decoded, and check the output.
+
+test="mcelog_02"
+
+mkdir mcelog
+touch mcelog/mcelog_hw_error.log
+cat >> mcelog/mcelog_hw_error.log <<EOF
+PU 0: Machine Check Exception:                4 Bank 4: b200000000070f0f
+TSC 3151881f80cc
+Kernel panic - not syncing: Machine check
+EOF
+
+if mcelog --ascii < mcelog/mcelog_hw_error.log | grep -z ".*Hardware event.*MCGSTATUS.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr mcelog
Signature · 1 line
1.8.3.1
#2 lore raw

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

Applied. Thanks,
-- Tim

Quoted 177 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Monday, October 08, 2018 11:43 PM
To: [email protected]
Subject: [Fuego] [PATCH] mcelog: Add test cases for command mcelog.

---
 engine/tests/Functional.mcelog/fuego_test.sh      | 18
++++++++++++++++++
 engine/tests/Functional.mcelog/mcelog_test.sh     |  4 ++++
 engine/tests/Functional.mcelog/parser.py          | 22
++++++++++++++++++++++
 engine/tests/Functional.mcelog/spec.json          |  7 +++++++
 engine/tests/Functional.mcelog/tests/mcelog_01.sh | 17
+++++++++++++++++
 engine/tests/Functional.mcelog/tests/mcelog_02.sh | 22
++++++++++++++++++++++
 6 files changed, 90 insertions(+)
 create mode 100644 engine/tests/Functional.mcelog/fuego_test.sh
 create mode 100755 engine/tests/Functional.mcelog/mcelog_test.sh
 create mode 100644 engine/tests/Functional.mcelog/parser.py
 create mode 100644 engine/tests/Functional.mcelog/spec.json
 create mode 100644 engine/tests/Functional.mcelog/tests/mcelog_01.sh
 create mode 100644 engine/tests/Functional.mcelog/tests/mcelog_02.sh
engine/tests/Functional.mcelog/fuego_test.sh new file +3 -0
new file mode 100644
index 0000000..1950cb8
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path mcelog PROGRAM_MCELOG
+    assert_define PROGRAM_MCELOG "Missing 'mcelog' program on target

board"

engine/tests/Functional.mcelog/fuego_test.sh new file +15 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/mcelog_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./mcelog_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.mcelog/mcelog_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
engine/tests/Functional.mcelog/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.mcelog/spec.json new file +7 -0
new file mode 100644
index 0000000..2ccad89
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.mcelog",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.mcelog/tests/mcelog_01.sh new file +4 -0
new file mode 100644
index 0000000..8276ebb
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run command mcelog.
+#  If the text that is not an error log is input to mcelog, it is confirmed that

the decoding process is not performed.

engine/tests/Functional.mcelog/tests/mcelog_01.sh new file +7 -0
+
+test="mcelog_01"
+
+mkdir mcelog
+echo "this file is not hardware error log" > mcelog/mcelog_plain_text.log
+
+if mcelog --ascii < mcelog/mcelog_plain_text.log | grep "this file is not

hardware error log"

engine/tests/Functional.mcelog/tests/mcelog_01.sh new file +6 -0
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr mcelog
engine/tests/Functional.mcelog/tests/mcelog_02.sh new file +16 -0
new file mode 100644
index 0000000..9a80ff9
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  In target, run command mcelog.
+#  Verify that the error log is decoded, and check the output.
+
+test="mcelog_02"
+
+mkdir mcelog
+touch mcelog/mcelog_hw_error.log
+cat >> mcelog/mcelog_hw_error.log <<EOF
+PU 0: Machine Check Exception:                4 Bank 4: b200000000070f0f
+TSC 3151881f80cc
+Kernel panic - not syncing: Machine check
+EOF
+
+if mcelog --ascii < mcelog/mcelog_hw_error.log | grep -z ".*Hardware

event.*MCGSTATUS.*"

engine/tests/Functional.mcelog/tests/mcelog_02.sh new file +6 -1
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm -fr mcelog
--

1.8.3.1

_______________________________________________
Fuego mailing list
[email protected]
https://urldefense.proofpoint.com/v2/url?u=https-
3A__lists.linuxfoundation.org_mailman_listinfo_fuego&d=DwICAg&c=fP4tf- -1dS0biCFlB0saz0I0kjO5v7- GLPtvShAo4cc&r=jjTc71ylyJg68rRxrFQuDFMMybIqPCnrHF85A- GzCRg&m=2gcCiAWL35wFokcXTstK4RiujLB0jMphv8jegq5mxrY&s=Mwnkgp- rV1mMZjs4E5IaOjfdk9LJo9RoCzbKbRGls2Y&e=

#3 lore raw

PATCH 1/1 bind: Add test cases for commands of bind(chroot).

In reply to Wang Mingyu
---
 engine/tests/Functional.bind/bind_test.sh          |   4 +
 .../data/bind9/0.168.192.in-addr.arpa.db           |  10 ++
 .../data/bind9/20.24.10.in-addr.arpa.db            |  10 ++
 .../data/bind9/246.168.192.in-addr.arpa.db         |  10 ++
 .../Functional.bind/data/bind9/fjelinux.com.db     |  10 ++
 engine/tests/Functional.bind/data/bind9/hosts      |   3 +
 .../data/bind9/linux_test.com.db_ARMV8             |  10 ++
 .../data/bind9/linux_test.com.db_MPC               |  10 ++
 .../data/bind9/linux_test.com.db_fedora            |  10 ++
 .../data/bind9/linux_test.com.db_p1020             |  10 ++
 .../data/bind9/linux_test.com.db_p2020             |  10 ++
 .../data/bind9/linux_test.com.db_p4080             |  10 ++
 .../data/bind9/linux_test.com.db_pandaboard        |  10 ++
 .../data/bind9/linux_test.com.db_x86               |  10 ++
 .../data/bind9/linux_test.com.db_x86_64            |  10 ++
 .../data/bind9/linux_test.com.db_zunq              |  10 ++
 engine/tests/Functional.bind/data/bind9/named      |   7 ++
 engine/tests/Functional.bind/data/bind9/named.conf |  48 ++++++++
 .../tests/Functional.bind/data/bind9/resolv.conf   |   0
 engine/tests/Functional.bind/data/bind9/rndc.conf  |  34 +++++
 engine/tests/Functional.bind/data/bind9/rndc.key   |   4 +
 .../Functional.bind/data/bind9/sysconfig/named     |   7 ++
 .../data/bind9/sysconfig/named.nochroot            |   7 ++
 .../Functional.bind/data/bind9/x86_64_named.conf   |  76 ++++++++++++
 .../tests/Functional.bind/data/linux_test.com.db   |  10 ++
 .../Functional.bind/data/linux_test.com.db_24      |  10 ++
 .../Functional.bind/data/linux_test.com.db_27      |  10 ++
 .../Functional.bind/data/linux_test.com.db_29      |  10 ++
 .../Functional.bind/data/linux_test.com.db_30      |  10 ++
 .../Functional.bind/data/linux_test.com.db_31      |  10 ++
 .../Functional.bind/data/linux_test.com.db_34      |  10 ++
 .../Functional.bind/data/linux_test.com.db_36      |  10 ++
 .../Functional.bind/data/linux_test.com.db_38      |  10 ++
 .../tests/Functional.bind/data/linux_test.com.db_8 |  10 ++
 engine/tests/Functional.bind/fuego_test.sh         |  33 +++++
 engine/tests/Functional.bind/parser.py             |  22 ++++
 engine/tests/Functional.bind/spec.json             |   7 ++
 .../Functional.bind/tests/bind_chroot_chkconf.sh   |  52 ++++++++
 .../Functional.bind/tests/bind_chroot_dig1.sh      | 112 +++++++++++++++++
 .../Functional.bind/tests/bind_chroot_dig2.sh      | 118 ++++++++++++++++++
 .../Functional.bind/tests/bind_chroot_lport.sh     | 130 +++++++++++++++++++
 .../tests/Functional.bind/tests/bind_chroot_pid.sh | 137 +++++++++++++++++++++
 .../tests/Functional.bind/tests/bind_chroot_ps.sh  |  45 +++++++
 .../tests/bind_chroot_rndc-confgen.sh              |  57 +++++++++
 .../Functional.bind/tests/bind_chroot_syslog-ng.sh |  56 +++++++++
 45 files changed, 1199 insertions(+)
 create mode 100755 engine/tests/Functional.bind/bind_test.sh
 create mode 100644 engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/fjelinux.com.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/hosts
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64
 create mode 100644 engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq
 create mode 100644 engine/tests/Functional.bind/data/bind9/named
 create mode 100644 engine/tests/Functional.bind/data/bind9/named.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/resolv.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/rndc.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/rndc.key
 create mode 100644 engine/tests/Functional.bind/data/bind9/sysconfig/named
 create mode 100644 engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot
 create mode 100644 engine/tests/Functional.bind/data/bind9/x86_64_named.conf
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_24
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_27
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_29
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_30
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_31
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_34
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_36
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_38
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db_8
 create mode 100644 engine/tests/Functional.bind/fuego_test.sh
 create mode 100644 engine/tests/Functional.bind/parser.py
 create mode 100644 engine/tests/Functional.bind/spec.json
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_dig1.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_dig2.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_lport.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_pid.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_ps.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh
engine/tests/Functional.bind/bind_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
engine/tests/Functional.bind/data/bind9/0.168.192.in-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.
engine/tests/Functional.bind/data/bind9/20.24.10.in-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.
engine/tests/Functional.bind/data/bind9/246.168.192.in-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.
engine/tests/Functional.bind/data/bind9/fjelinux.com.db new file +10 -0
new file mode 100644
index 0000000..45d3d19
@@ -0,0 +1,10 @@
+$TTL    86400
+@               IN SOA  fjelinux.com. root.fjelinux.com. (
+                                        42              ; serial (d. adams)
+                                        3H              ; refresh
+                                        15M             ; retry
+                                        1W              ; expiry
+                                        1D )            ; minimum
+                IN NS           fjelinux.com.
+		IN MX 10	fjelinux.com.
+@		IN A		192.168.0.9
engine/tests/Functional.bind/data/bind9/hosts new file +3 -0
new file mode 100644
index 0000000..c7b9f21
@@ -0,0 +1,3 @@
+# /etc/hosts test
+#
+127.0.0.1	localhost.localdomain	localhost
engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 new file +10 -0
new file mode 100644
index 0000000..880166b
@@ -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	        192.168.246.59
engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC new file +10 -0
new file mode 100644
index 0000000..02b6086
@@ -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	        192.168.246.87
engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 new file +10 -0
new file mode 100644
index 0000000..f39f5fb
@@ -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	        192.168.246.85
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 new file +10 -0
new file mode 100644
index 0000000..f4a8377
@@ -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	        192.168.246.86
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 new file +10 -0
new file mode 100644
index 0000000..9f942f2
@@ -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	        192.168.246.90
engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard new file +10 -0
new file mode 100644
index 0000000..dc373bb
@@ -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	        192.168.246.129
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 new file +10 -0
new file mode 100644
index 0000000..ca836b5
@@ -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	        192.168.246.61
engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq new file +10 -0
new file mode 100644
index 0000000..d24501f
@@ -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	        192.168.246.136
engine/tests/Functional.bind/data/bind9/named new file +7 -0
new file mode 100644
index 0000000..82e6b6b
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/var/named/chroot
engine/tests/Functional.bind/data/bind9/named.conf new file +48 -0

48 lines not on this page · raw message

engine/tests/Functional.bind/data/bind9/resolv.conf new file +0 -0
new file mode 100644
index 0000000..e69de29
engine/tests/Functional.bind/data/bind9/rndc.conf new file +34 -0
new file mode 100644
index 0000000..5e85bfa
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: rndc.conf,v 1.7.2.1 2004/03/09 06:09:27 marka Exp $ */
+
+/*
+ * Sample rndc configuration file.
+ */
+
+options {
+        default-server  localhost;
+        default-key     "rndckey";
+};
+
+server localhost {
+        key     "rndckey";
+};
+
+include "/etc/bind/rndc.key";
+
engine/tests/Functional.bind/data/bind9/rndc.key new file +4 -0
new file mode 100644
index 0000000..aca0e86
@@ -0,0 +1,4 @@
+key "rndckey" {
+	algorithm hmac-md5;
+	secret "mH48lXo3q1gxhMeeFxFJ9A==";
+};
engine/tests/Functional.bind/data/bind9/sysconfig/named new file +7 -0
new file mode 100644
index 0000000..82e6b6b
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/var/named/chroot
engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot new file +7 -0
new file mode 100644
index 0000000..595051d
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/
engine/tests/Functional.bind/data/bind9/x86_64_named.conf new file +76 -0

76 lines not on this page · raw message

engine/tests/Functional.bind/data/linux_test.com.db new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/data/linux_test.com.db_24 new file +10 -0
new file mode 100644
index 0000000..02b6086
@@ -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	        192.168.246.87
engine/tests/Functional.bind/data/linux_test.com.db_27 new file +10 -0
new file mode 100644
index 0000000..ca836b5
@@ -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	        192.168.246.61
engine/tests/Functional.bind/data/linux_test.com.db_29 new file +10 -0
new file mode 100644
index 0000000..f4a8377
@@ -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	        192.168.246.86
engine/tests/Functional.bind/data/linux_test.com.db_30 new file +10 -0
new file mode 100644
index 0000000..dc373bb
@@ -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	        192.168.246.129
engine/tests/Functional.bind/data/linux_test.com.db_31 new file +10 -0
new file mode 100644
index 0000000..f39f5fb
@@ -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	        192.168.246.85
engine/tests/Functional.bind/data/linux_test.com.db_34 new file +10 -0
new file mode 100644
index 0000000..9f942f2
@@ -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	        192.168.246.90
engine/tests/Functional.bind/data/linux_test.com.db_36 new file +10 -0
new file mode 100644
index 0000000..d24501f
@@ -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	        192.168.246.136
engine/tests/Functional.bind/data/linux_test.com.db_38 new file +10 -0
new file mode 100644
index 0000000..880166b
@@ -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	        192.168.246.59
engine/tests/Functional.bind/data/linux_test.com.db_8 new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/fuego_test.sh new file +33 -0
new file mode 100644
index 0000000..7e4fa2d
@@ -0,0 +1,33 @@
+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"
+}
+
+function test_deploy {
+    put $TEST_HOME/bind_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+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 remotehost=$IPADDR;\
+    ./bind_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.bind/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.bind/spec.json new file +7 -0
new file mode 100644
index 0000000..00a56f9
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.bind",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +52 -0

52 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +112 -0

112 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +118 -0

118 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +130 -0

130 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +137 -0

137 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_chroot_ps.sh new file +45 -0

45 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh new file +57 -0

57 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw

Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot).

Comments and questions inline below...

Quoted 2 lines

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

Would be nice to get some description of what's going on here in the commit message body.
But I'm going to apply this without it.

Quoted 669 lines
---
 engine/tests/Functional.bind/bind_test.sh          |   4 +
 .../data/bind9/0.168.192.in-addr.arpa.db           |  10 ++
 .../data/bind9/20.24.10.in-addr.arpa.db            |  10 ++
 .../data/bind9/246.168.192.in-addr.arpa.db         |  10 ++
 .../Functional.bind/data/bind9/fjelinux.com.db     |  10 ++
 engine/tests/Functional.bind/data/bind9/hosts      |   3 +
 .../data/bind9/linux_test.com.db_ARMV8             |  10 ++
 .../data/bind9/linux_test.com.db_MPC               |  10 ++
 .../data/bind9/linux_test.com.db_fedora            |  10 ++
 .../data/bind9/linux_test.com.db_p1020             |  10 ++
 .../data/bind9/linux_test.com.db_p2020             |  10 ++
 .../data/bind9/linux_test.com.db_p4080             |  10 ++
 .../data/bind9/linux_test.com.db_pandaboard        |  10 ++
 .../data/bind9/linux_test.com.db_x86               |  10 ++
 .../data/bind9/linux_test.com.db_x86_64            |  10 ++
 .../data/bind9/linux_test.com.db_zunq              |  10 ++
 engine/tests/Functional.bind/data/bind9/named      |   7 ++
 engine/tests/Functional.bind/data/bind9/named.conf |  48 ++++++++
 .../tests/Functional.bind/data/bind9/resolv.conf   |   0
 engine/tests/Functional.bind/data/bind9/rndc.conf  |  34 +++++
 engine/tests/Functional.bind/data/bind9/rndc.key   |   4 +
 .../Functional.bind/data/bind9/sysconfig/named     |   7 ++
 .../data/bind9/sysconfig/named.nochroot            |   7 ++
 .../Functional.bind/data/bind9/x86_64_named.conf   |  76 ++++++++++++
 .../tests/Functional.bind/data/linux_test.com.db   |  10 ++
 .../Functional.bind/data/linux_test.com.db_24      |  10 ++
 .../Functional.bind/data/linux_test.com.db_27      |  10 ++
 .../Functional.bind/data/linux_test.com.db_29      |  10 ++
 .../Functional.bind/data/linux_test.com.db_30      |  10 ++
 .../Functional.bind/data/linux_test.com.db_31      |  10 ++
 .../Functional.bind/data/linux_test.com.db_34      |  10 ++
 .../Functional.bind/data/linux_test.com.db_36      |  10 ++
 .../Functional.bind/data/linux_test.com.db_38      |  10 ++
 .../tests/Functional.bind/data/linux_test.com.db_8 |  10 ++
 engine/tests/Functional.bind/fuego_test.sh         |  33 +++++
 engine/tests/Functional.bind/parser.py             |  22 ++++
 engine/tests/Functional.bind/spec.json             |   7 ++
 .../Functional.bind/tests/bind_chroot_chkconf.sh   |  52 ++++++++
 .../Functional.bind/tests/bind_chroot_dig1.sh      | 112
+++++++++++++++++
 .../Functional.bind/tests/bind_chroot_dig2.sh      | 118
++++++++++++++++++
 .../Functional.bind/tests/bind_chroot_lport.sh     | 130
+++++++++++++++++++
 .../tests/Functional.bind/tests/bind_chroot_pid.sh | 137
+++++++++++++++++++++
 .../tests/Functional.bind/tests/bind_chroot_ps.sh  |  45 +++++++
 .../tests/bind_chroot_rndc-confgen.sh              |  57 +++++++++
 .../Functional.bind/tests/bind_chroot_syslog-ng.sh |  56 +++++++++
 45 files changed, 1199 insertions(+)
 create mode 100755 engine/tests/Functional.bind/bind_test.sh
 create mode 100644 engine/tests/Functional.bind/data/bind9/0.168.192.in-
addr.arpa.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/20.24.10.in-
addr.arpa.db
 create mode 100644
engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db
 create mode 100644
engine/tests/Functional.bind/data/bind9/fjelinux.com.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/hosts
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq
 create mode 100644 engine/tests/Functional.bind/data/bind9/named
 create mode 100644 engine/tests/Functional.bind/data/bind9/named.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/resolv.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/rndc.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/rndc.key
 create mode 100644
engine/tests/Functional.bind/data/bind9/sysconfig/named
 create mode 100644
engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot
 create mode 100644
engine/tests/Functional.bind/data/bind9/x86_64_named.conf
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_24
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_27
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_29
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_30
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_31
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_34
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_36
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_38
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_8
 create mode 100644 engine/tests/Functional.bind/fuego_test.sh
 create mode 100644 engine/tests/Functional.bind/parser.py
 create mode 100644 engine/tests/Functional.bind/spec.json
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_dig1.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_dig2.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_lport.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_pid.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_ps.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_rndc-
confgen.sh
 create mode 100644

engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh

engine/tests/Functional.bind/bind_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
(quoted diff) +0 -0

addr.arpa.db b/engine/tests/Functional.bind/data/bind9/0.168.192.in- addr.arpa.db
new file mode 100644
index 0000000..3100047

engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db new file +10 -0
@@ -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.
(quoted diff) +0 -0

addr.arpa.db b/engine/tests/Functional.bind/data/bind9/20.24.10.in- addr.arpa.db
new file mode 100644
index 0000000..3100047

engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db new file +10 -0
@@ -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.
(quoted diff) +0 -0

addr.arpa.db b/engine/tests/Functional.bind/data/bind9/246.168.192.in- addr.arpa.db
new file mode 100644
index 0000000..3100047

engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db new file +10 -0
@@ -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.
engine/tests/Functional.bind/data/bind9/fjelinux.com.db new file +10 -0
new file mode 100644
index 0000000..45d3d19
@@ -0,0 +1,10 @@
+$TTL    86400
+@               IN SOA  fjelinux.com. root.fjelinux.com. (
+                                        42              ; serial (d. adams)
+                                        3H              ; refresh
+                                        15M             ; retry
+                                        1W              ; expiry
+                                        1D )            ; minimum
+                IN NS           fjelinux.com.
+		IN MX 10	fjelinux.com.
+@		IN A		192.168.0.9
engine/tests/Functional.bind/data/bind9/hosts new file +3 -0
new file mode 100644
index 0000000..c7b9f21
@@ -0,0 +1,3 @@
+# /etc/hosts test
+#
+127.0.0.1	localhost.localdomain	localhost

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 new file mode 100644
index 0000000..880166b

engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 new file +10 -0
@@ -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	        192.168.246.59
engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC new file +10 -0
new file mode 100644
index 0000000..02b6086
@@ -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	        192.168.246.87

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora new file mode 100644
index 0000000..7846fd5

engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora new file +10 -0
@@ -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	        192.168.246.41

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 new file mode 100644
index 0000000..f39f5fb

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 new file +10 -0
@@ -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	        192.168.246.85

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 new file mode 100644
index 0000000..f4a8377

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 new file +10 -0
@@ -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	        192.168.246.86

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 new file mode 100644
index 0000000..9f942f2

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 new file +10 -0
@@ -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	        192.168.246.90

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard new file mode 100644
index 0000000..dc373bb
--- /dev/null
+++
b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 new file +10 -0
@@ -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	        192.168.246.129
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 new file mode 100644
index 0000000..ca836b5

engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 new file +10 -0
@@ -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	        192.168.246.61

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq new file mode 100644
index 0000000..d24501f

engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq new file +10 -0
@@ -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	        192.168.246.136
engine/tests/Functional.bind/data/bind9/named new file +7 -0
new file mode 100644
index 0000000..82e6b6b
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/var/named/chroot
engine/tests/Functional.bind/data/bind9/named.conf new file +48 -0
new file mode 100644
index 0000000..cbe9b3b
@@ -0,0 +1,48 @@
+// This is the primary configuration file for the BIND DNS server named.
+//
+// If you are just adding zones, please do that in /etc/bind/named.conf.local
+
+include "/etc/bind/named.conf.options";
+
+// prime the server with knowledge of the root servers
+zone "." {
+	type hint;
+	file "/etc/bind/db.root";
+};
+
+// be authoritative for the localhost forward and reverse zones, and for
+// broadcast zones as per RFC 1912
+
+zone "localhost" {
+	type master;
+	file "/etc/bind/db.local";
+};
+
+zone "127.in-addr.arpa" {
+	type master;
+	file "/etc/bind/db.127";
+};
+
+zone "0.in-addr.arpa" {
+	type master;
+	file "/etc/bind/db.0";
+};
+
+//zone "255.in-addr.arpa" {
+//	type master;
+//	file "/etc/bind/db.255";
+//};
+
+zone "linux-test.com" IN {
+	type master;
+	file "/var/named/linux_test.com.db";
+	allow-update { none; };
+};
+
+zone "246.168.192.in-addr.arpa" IN {
+	type master;
+	file "/var/named/246.168.192.in-addr.arpa.db";
+	allow-update { none; };
+};
+
+include "/etc/bind/named.conf.local";
engine/tests/Functional.bind/data/bind9/resolv.conf new file +0 -0
new file mode 100644
index 0000000..e69de29
engine/tests/Functional.bind/data/bind9/rndc.conf new file +9 -0
new file mode 100644
index 0000000..5e85bfa
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL

WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */

engine/tests/Functional.bind/data/bind9/rndc.conf new file +18 -0
+
+/* $Id: rndc.conf,v 1.7.2.1 2004/03/09 06:09:27 marka Exp $ */
+
+/*
+ * Sample rndc configuration file.
+ */
+
+options {
+        default-server  localhost;
+        default-key     "rndckey";
+};
+
+server localhost {
+        key     "rndckey";
+};
+
+include "/etc/bind/rndc.key";
+
engine/tests/Functional.bind/data/bind9/rndc.key new file +4 -0
new file mode 100644
index 0000000..aca0e86
@@ -0,0 +1,4 @@
+key "rndckey" {
+	algorithm hmac-md5;
+	secret "mH48lXo3q1gxhMeeFxFJ9A==";
+};
engine/tests/Functional.bind/data/bind9/sysconfig/named new file +7 -0
new file mode 100644
index 0000000..82e6b6b
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/var/named/chroot

diff --git a/engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot b/engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot new file mode 100644
index 0000000..595051d

engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot new file +7 -0
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/
engine/tests/Functional.bind/data/bind9/x86_64_named.conf new file +76 -0
new file mode 100644
index 0000000..8c76e30
@@ -0,0 +1,76 @@
+#
+# /etc/named.conf
+#
+
+options {
+
+	directory "/var/named";
+	pid-file "/var/run/named/named.pid";
+
+	/*
+	 * If there is a firewall between you and nameservers you want
+	 * to talk to, you might need to uncomment the query-source
+	 * directive below.  Previous versions of BIND always asked
+	 * questions using port 53, but BIND 8.1 uses an unprivileged
+	 * port by default.
+	 */
+
+	// query-source address * port 53;
+
+	allow-query{
+		127.0.0.1;
+		192.168.0.0/24;
+	};
+
+	allow-recursion{
+		127.0.0.1;
+		192.168.0.0/24;
+	};
+
+	allow-transfer{
+		127.0.0.1;
+		192.168.0.0/24;
+	};
+
+	forwarders{
+		// 192.168.0.1;
+	};
+};
+
+//
+// a caching only nameserver config
+//
+
+controls {
+	inet 127.0.0.1 allow { localhost; } keys { rndckey; };
+};
+
+logging {
+	category lame-servers { null; };
+};
+
+include "/etc/bind/rndc.key";
+
+zone "linux-test.com" IN {
+	type master;
+	file "linux_test.com.db";
+	allow-update { none; };
+};
+
+# zone "0.168.192.in-addr.arpa" IN {
+#        type master;
+#        file "0.168.192.in-addr.arpa.db";
+#        allow-update { none; };
+# };
+
+zone "246.168.192.in-addr.arpa" IN {
+	type master;
+	file "246.168.192.in-addr.arpa.db";
+	allow-update { none; };
+};
+
+#zone "20.24.10.in-addr.arpa" IN {
+#	type master;
+#	file "20.24.10.in-addr.arpa.db";
+#	allow-update { none; };
+#};
engine/tests/Functional.bind/data/linux_test.com.db new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/data/linux_test.com.db_24 new file +0 -0
new file mode 100644
index 0000000..02b6086

engine/tests/Functional.bind/data/linux_test.com.db_24 line 10

Quoted 10 lines
engine/tests/Functional.bind/data/linux_test.com.db_24 new file +10 -0
@@ -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	        192.168.246.87

Does this test require that the device under test be on the 192.168 network?

I'm not familiar enough with named and bind to know.

Quoted 160 lines
engine/tests/Functional.bind/data/linux_test.com.db_27 new file +10 -0
new file mode 100644
index 0000000..ca836b5
@@ -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	        192.168.246.61
engine/tests/Functional.bind/data/linux_test.com.db_29 new file +10 -0
new file mode 100644
index 0000000..f4a8377
@@ -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	        192.168.246.86
engine/tests/Functional.bind/data/linux_test.com.db_30 new file +10 -0
new file mode 100644
index 0000000..dc373bb
@@ -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	        192.168.246.129
engine/tests/Functional.bind/data/linux_test.com.db_31 new file +10 -0
new file mode 100644
index 0000000..f39f5fb
@@ -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	        192.168.246.85
engine/tests/Functional.bind/data/linux_test.com.db_34 new file +10 -0
new file mode 100644
index 0000000..9f942f2
@@ -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	        192.168.246.90
engine/tests/Functional.bind/data/linux_test.com.db_36 new file +10 -0
new file mode 100644
index 0000000..d24501f
@@ -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	        192.168.246.136
engine/tests/Functional.bind/data/linux_test.com.db_38 new file +10 -0
new file mode 100644
index 0000000..880166b
@@ -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	        192.168.246.59
engine/tests/Functional.bind/data/linux_test.com.db_8 new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/fuego_test.sh new file +3 -0
new file mode 100644
index 0000000..7e4fa2d
@@ -0,0 +1,33 @@
+function test_pre_check {
+    is_on_target_path named-checkconf PROGRAM_CHECKCONF
+    assert_define PROGRAM_CHECKCONF "Missing 'bind' program on target

board"

engine/tests/Functional.bind/fuego_test.sh new file +4 -0
+    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"

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

board"

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

target board"

engine/tests/Functional.bind/fuego_test.sh new file +2 -0
+    is_on_target_path named-checkzone PROGRAM_CHECKZONE
+    assert_define PROGRAM_CHECKZONE "Missing 'named-checkzone'
Quoted 1 line

program on target board"

Would be good to check for pgrep here. It is not a command that is common to some of the very low-end systems, and it is used extensively throughout the subtests.

It might be possible to write a simple shell function to perform the same operation as pgrep (at least the way it is used now, which is limited to just grep'ping ps for a single program name (ie - not using any of the flags for filtering the process list by other attributes).

This would be a good candidate to put into fuego_board_function_lib.sh, to provide this feature if pgrep is not present on a board. (Then we wouldn't be dependent on pgrep being present).

engine/tests/Functional.bind/fuego_test.sh line 25

Quoted 13 lines
engine/tests/Functional.bind/fuego_test.sh new file +5 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/bind_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh

$BOARD_TESTDIR/fuego.$TESTDIR

engine/tests/Functional.bind/fuego_test.sh new file +7 -0
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export tst_bind_file=246.168.192.in-addr.arpa.db;\

will this work on a board on any network? Or does the board being tested have to be on a 192.168.246 network?

Quoted 63 lines
engine/tests/Functional.bind/fuego_test.sh new file +8 -0
+    export test_target_conf=x86_64;\
+    export remotehost=$IPADDR;\
+    ./bind_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.bind/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.bind/spec.json new file +7 -0
new file mode 100644
index 0000000..00a56f9
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.bind",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +3 -0
new file mode 100644
index 0000000..5a6fbb7
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+#  After running the/etc/named.conf to the target, run the named

checkconf command in the chroot environment to verify the normal termination.

engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh line 7

Quoted 4 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +4 -0
+
+test="chroot_chkconf"
+
+kill -9 $(pgrep named)

Could this be accomplished with "killall -9 named"? I believe Fuego requires killall, but not pgrep, on boards under test.

It would be good to record here whether named was already running, and start it again (after restoring the configuration files), so that the machine is left in the same state it was in before the test started.

Quoted 34 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +34 -0
+
+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
+
+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
+

engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh line 51

Quoted 10 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +10 -0
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if named-checkconf -t /var/named/chroot
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -rf /var/named

Does this remove anything from the board that this test did not put there? If so, that's bad. We should try to leave the board in the same state we left it. If /var/named existed before this test was run, we should not be destroying it at the end of this test.

Quoted 109 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +1 -0
+mv /etc/sysconfig/named_bak /etc/sysconfig/named
engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +3 -0
new file mode 100644
index 0000000..ccd261d
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm that an IP address is pulled

from the name.

engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +79 -0
+
+test="chroot_dig1"
+
+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 ]
+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 /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +15 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+cp /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    chown root.named /etc/bind/rndc.key /etc/bind/rndc.conf
Quoted 1 line

/etc/bind/named.conf

Does this test require root privileges to perform all these operations (particularly the chown)? If so, there should be a NEED_ROOT=1 in fuego_test.sh to indicate this.

Quoted 135 lines

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

engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +13 -0
+}
+
+named -t /var/named/chroot
+
+if dig linux-test.com | grep $remotehost
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+kill -9 $(pgrep named)
+restore_target
engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +3 -0
new file mode 100644
index 0000000..bbeb981
@@ -0,0 +1,118 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm that an IP address is pulled

from the name.

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +82 -0
+
+test="chroot_dig2"
+
+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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +16 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+cp /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/sysconfig/named_bak /etc/sysconfig/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    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

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +5 -0
+}
+
+named -t /var/named/chroot
+
+sleep 5

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh line 118

Quoted 10 lines
engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +10 -0
+
+if dig -x $remotehost | grep "linux-test.com"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+kill -9 $(pgrep named)
+restore_target

If named was running before this test started, it should be restarted when the test finishes, after all the configuration files have been restored.

Quoted 477 lines
engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +50 -0
new file mode 100644
index 0000000..88456c0
@@ -0,0 +1,130 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm Listening port "53" "953".
+
+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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp /var/named/chroot/etc/bind/named.conf

/var/named/chroot/etc/bind/named.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +14 -0
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp /var/named/chroot/etc/bind/rndc.conf

/var/named/chroot/etc/bind/rndc.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +14 -0
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp /var/named/chroot/etc/bind/rndc.key

/var/named/chroot/etc/bind/rndc.key_bak

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +10 -0
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +16 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+cp /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/sysconfig/named_bak /etc/sysconfig/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    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

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +24 -0
+}
+
+named -t /var/named/chroot
+
+if netstat -ln | grep ":53"
+then
+    echo " -> port 53 is active."
+else
+    echo " -> port 53 is not active."
+    echo " -> $test: TEST-FAIL"
+    kill -9 $(pgrep named)
+    restore_target
+    exit
+fi
+
+if netstat -ln | grep ":953"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+kill -9 $(pgrep named)
+restore_target
engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +55 -0
new file mode 100644
index 0000000..70f872b
@@ -0,0 +1,137 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm the process file id.
+
+test="chroot_pid"
+
+killall 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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp /var/named/chroot/etc/bind/named.conf

/var/named/chroot/etc/bind/named.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +14 -0
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp /var/named/chroot/etc/bind/rndc.conf

/var/named/chroot/etc/bind/rndc.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +14 -0
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp /var/named/chroot/etc/bind/rndc.key

/var/named/chroot/etc/bind/rndc.key_bak

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +10 -0
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +16 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+mv /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/sysconfig/named_bak /etc/sysconfig/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    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

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +26 -0
+}
+
+named -t /var/named/chroot
+
+if ls /var/named/chroot/var/run/named/named.pid
+then
+    echo " -> pid file is exist."
+else
+    echo " -> pid file is not exist."
+    echo " -> $test: TEST-FAIL"
+    killall named
+    restore_target
+    exit
+fi
+
+killall named
+
+sleep 5
+
+if test -f /var/named/chroot/var/run/named/named.pid
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
+restore_target
engine/tests/Functional.bind/tests/bind_chroot_ps.sh new file +3 -0
new file mode 100644
index 0000000..d99c3cb
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm the process condition by

command ps.

engine/tests/Functional.bind/tests/bind_chroot_ps.sh new file +42 -0
+
+test="chroot_ps"
+
+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 ]
+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
+
+named -t /var/named/chroot
+
+if ps aux | grep "[/]var/named/chroot"
+then
+    echo " -> get the process of named."
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> can't get the process of named."
+    echo " -> $test: TEST-FAIL"
+fi
+kill -9 $(pgrep named)
+rm -rf /var/named
engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh new file +3 -0
new file mode 100644
index 0000000..be1919d
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+#  Run the rndc-confgen command in the chroot environment to find the

rndc.key file.

engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh new file +54 -0
+
+test="chroot_rndc-confgen"
+
+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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ -f /etc/bind/rndc.key ]
+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
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -rf /var/named
+mv /etc/sysconfig/named_bak /etc/sysconfig/named
+mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh new file +56 -1
new file mode 100644
index 0000000..195410f
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+#  Launch named chroot with the target and check if syslogis exist.
+
+test="chroot_syslog-ng"
+
+kill -9 $(pgrep named)
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target syslog-ng stop
+
+if [ -f /var/log/syslog ]
+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
+
+exec_service_on_target syslog-ng restart
+
+named -t /var/named/chroot
+
+if cat /var/log/syslog | grep "starting up"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kill -9 $(pgrep named)
+rm -rf /var/named
--
Quoted 1 line

1.8.3.1

Overall, this is a nice test of named functionality. Despite the issues I have with some parts, I'm going to apply it.

However, please answer my questions above, and try to fix the issues I've raised in a new patch on top of this one.

Thanks. Applied.
-- Tim

#5 lore raw

Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot).

Hi Tim

The answers to comment are as follows.

Quoted 30 lines

+++ b/engine/tests/Functional.bind/data/linux_test.com.db_24

engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC new file +10 -0
@@ -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	        192.168.246.87

Does this test require that the device under test be on the 192.168 network? I'm not familiar enough with named and bind to know.

engine/tests/Functional.bind/fuego_test.sh new file +5 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/bind_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh

$BOARD_TESTDIR/fuego.$TESTDIR

engine/tests/Functional.bind/fuego_test.sh new file +7 -0
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export tst_bind_file=246.168.192.in-addr.arpa.db;\
Quoted 2 lines

will this work on a board on any network? Or does the board being tested have to be on a 192.168.246 network?

The test can work on a board on any network.
I will set the value of network in the board with a variable so that the user can make changes according to the actual test environment.

Quoted 10 lines

Would be good to check for pgrep here. It is not a command that is common to some of the very low-end systems, and it is used extensively throughout the subtests.
It might be possible to write a simple shell function to perform the same operation as pgrep (at least the way it is used now, which is limited to just grep'ping ps for a single program name (ie - not using any of the flags for filtering the process list by other attributes).
This would be a good candidate to put into fuego_board_function_lib.sh, to provide this feature if pgrep is not present on a board. (Then we wouldn't be dependent on pgrep being present).

Using pgrep here is just to delete the named process without any other functions. Therefore, killall -9 named can be used instead.

Quoted 4 lines

Does this remove anything from the board that this test did not put there? If so, that's bad. We should try to leave the board in the same state we left it. If /var/named existed before this test was run, we should not be destroying it at the end of this test.

Yes. I plan to check whether /var/named exists first, and if there is, backup it first. After the test is completed, resume it.

Quoted 3 lines

Does this test require root privileges to perform all these operations (particularly the chown)? If so, there should be a NEED_ROOT=1 in fuego_test.sh to indicate this.

Control of service needs root permissions. Therefore, I will add NEED_ROOT=1 to fuego_test.sh.

Quoted 2 lines

If named was running before this test started, it should be restarted when the test finishes, after all the configuration files have been restored.

Yes, I will check if named was running before this test started.
If it was running, when the test finishes, I will restart it, after all the configuration files have been restored.

If you agree with my above modifications, I'll modify the test suite and submit the patch.

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, October 12, 2018 12:35 PM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot).

Comments and questions inline below...

Quoted 2 lines

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

Would be nice to get some description of what's going on here in the commit message body.
But I'm going to apply this without it.

Quoted 669 lines
---
 engine/tests/Functional.bind/bind_test.sh          |   4 +
 .../data/bind9/0.168.192.in-addr.arpa.db           |  10 ++
 .../data/bind9/20.24.10.in-addr.arpa.db            |  10 ++
 .../data/bind9/246.168.192.in-addr.arpa.db         |  10 ++
 .../Functional.bind/data/bind9/fjelinux.com.db     |  10 ++
 engine/tests/Functional.bind/data/bind9/hosts      |   3 +
 .../data/bind9/linux_test.com.db_ARMV8             |  10 ++
 .../data/bind9/linux_test.com.db_MPC               |  10 ++
 .../data/bind9/linux_test.com.db_fedora            |  10 ++
 .../data/bind9/linux_test.com.db_p1020             |  10 ++
 .../data/bind9/linux_test.com.db_p2020             |  10 ++
 .../data/bind9/linux_test.com.db_p4080             |  10 ++
 .../data/bind9/linux_test.com.db_pandaboard        |  10 ++
 .../data/bind9/linux_test.com.db_x86               |  10 ++
 .../data/bind9/linux_test.com.db_x86_64            |  10 ++
 .../data/bind9/linux_test.com.db_zunq              |  10 ++
 engine/tests/Functional.bind/data/bind9/named      |   7 ++
 engine/tests/Functional.bind/data/bind9/named.conf |  48 ++++++++
 .../tests/Functional.bind/data/bind9/resolv.conf   |   0
 engine/tests/Functional.bind/data/bind9/rndc.conf  |  34 +++++
 engine/tests/Functional.bind/data/bind9/rndc.key   |   4 +
 .../Functional.bind/data/bind9/sysconfig/named     |   7 ++
 .../data/bind9/sysconfig/named.nochroot            |   7 ++
 .../Functional.bind/data/bind9/x86_64_named.conf   |  76 ++++++++++++
 .../tests/Functional.bind/data/linux_test.com.db   |  10 ++
 .../Functional.bind/data/linux_test.com.db_24      |  10 ++
 .../Functional.bind/data/linux_test.com.db_27      |  10 ++
 .../Functional.bind/data/linux_test.com.db_29      |  10 ++
 .../Functional.bind/data/linux_test.com.db_30      |  10 ++
 .../Functional.bind/data/linux_test.com.db_31      |  10 ++
 .../Functional.bind/data/linux_test.com.db_34      |  10 ++
 .../Functional.bind/data/linux_test.com.db_36      |  10 ++
 .../Functional.bind/data/linux_test.com.db_38      |  10 ++
 .../tests/Functional.bind/data/linux_test.com.db_8 |  10 ++
 engine/tests/Functional.bind/fuego_test.sh         |  33 +++++
 engine/tests/Functional.bind/parser.py             |  22 ++++
 engine/tests/Functional.bind/spec.json             |   7 ++
 .../Functional.bind/tests/bind_chroot_chkconf.sh   |  52 ++++++++
 .../Functional.bind/tests/bind_chroot_dig1.sh      | 112
+++++++++++++++++
 .../Functional.bind/tests/bind_chroot_dig2.sh      | 118
++++++++++++++++++
 .../Functional.bind/tests/bind_chroot_lport.sh     | 130
+++++++++++++++++++
 .../tests/Functional.bind/tests/bind_chroot_pid.sh | 137
+++++++++++++++++++++
 .../tests/Functional.bind/tests/bind_chroot_ps.sh  |  45 +++++++
 .../tests/bind_chroot_rndc-confgen.sh              |  57 +++++++++
 .../Functional.bind/tests/bind_chroot_syslog-ng.sh |  56 +++++++++
 45 files changed, 1199 insertions(+)
 create mode 100755 engine/tests/Functional.bind/bind_test.sh
 create mode 100644 engine/tests/Functional.bind/data/bind9/0.168.192.in-
addr.arpa.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/20.24.10.in-
addr.arpa.db
 create mode 100644
engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db
 create mode 100644
engine/tests/Functional.bind/data/bind9/fjelinux.com.db
 create mode 100644 engine/tests/Functional.bind/data/bind9/hosts
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64
 create mode 100644
engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq
 create mode 100644 engine/tests/Functional.bind/data/bind9/named
 create mode 100644 engine/tests/Functional.bind/data/bind9/named.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/resolv.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/rndc.conf
 create mode 100644 engine/tests/Functional.bind/data/bind9/rndc.key
 create mode 100644
engine/tests/Functional.bind/data/bind9/sysconfig/named
 create mode 100644
engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot
 create mode 100644
engine/tests/Functional.bind/data/bind9/x86_64_named.conf
 create mode 100644 engine/tests/Functional.bind/data/linux_test.com.db
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_24
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_27
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_29
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_30
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_31
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_34
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_36
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_38
 create mode 100644
engine/tests/Functional.bind/data/linux_test.com.db_8
 create mode 100644 engine/tests/Functional.bind/fuego_test.sh
 create mode 100644 engine/tests/Functional.bind/parser.py
 create mode 100644 engine/tests/Functional.bind/spec.json
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_dig1.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_dig2.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_chroot_lport.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_pid.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_ps.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_chroot_rndc-
confgen.sh
 create mode 100644

engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh

engine/tests/Functional.bind/bind_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
(quoted diff) +0 -0

addr.arpa.db b/engine/tests/Functional.bind/data/bind9/0.168.192.in- addr.arpa.db
new file mode 100644
index 0000000..3100047

engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db new file +10 -0
@@ -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.
(quoted diff) +0 -0

addr.arpa.db b/engine/tests/Functional.bind/data/bind9/20.24.10.in- addr.arpa.db
new file mode 100644
index 0000000..3100047

engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db new file +10 -0
@@ -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.
(quoted diff) +0 -0

addr.arpa.db b/engine/tests/Functional.bind/data/bind9/246.168.192.in- addr.arpa.db
new file mode 100644
index 0000000..3100047

engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db new file +10 -0
@@ -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.
engine/tests/Functional.bind/data/bind9/fjelinux.com.db new file +10 -0
new file mode 100644
index 0000000..45d3d19
@@ -0,0 +1,10 @@
+$TTL    86400
+@               IN SOA  fjelinux.com. root.fjelinux.com. (
+                                        42              ; serial (d. adams)
+                                        3H              ; refresh
+                                        15M             ; retry
+                                        1W              ; expiry
+                                        1D )            ; minimum
+                IN NS           fjelinux.com.
+		IN MX 10	fjelinux.com.
+@		IN A		192.168.0.9
engine/tests/Functional.bind/data/bind9/hosts new file +3 -0
new file mode 100644
index 0000000..c7b9f21
@@ -0,0 +1,3 @@
+# /etc/hosts test
+#
+127.0.0.1	localhost.localdomain	localhost

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 new file mode 100644
index 0000000..880166b

engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 new file +10 -0
@@ -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	        192.168.246.59
engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC new file +10 -0
new file mode 100644
index 0000000..02b6086
@@ -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	        192.168.246.87

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora new file mode 100644
index 0000000..7846fd5

engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora new file +10 -0
@@ -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	        192.168.246.41

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 new file mode 100644
index 0000000..f39f5fb

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 new file +10 -0
@@ -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	        192.168.246.85

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 new file mode 100644
index 0000000..f4a8377

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 new file +10 -0
@@ -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	        192.168.246.86

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 new file mode 100644
index 0000000..9f942f2

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 new file +10 -0
@@ -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	        192.168.246.90

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard new file mode 100644
index 0000000..dc373bb
--- /dev/null
+++
b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_pandaboard

engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 new file +10 -0
@@ -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	        192.168.246.129
engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 new file mode 100644
index 0000000..ca836b5

engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 new file +10 -0
@@ -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	        192.168.246.61

diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq new file mode 100644
index 0000000..d24501f

engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq new file +10 -0
@@ -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	        192.168.246.136
engine/tests/Functional.bind/data/bind9/named new file +7 -0
new file mode 100644
index 0000000..82e6b6b
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/var/named/chroot
engine/tests/Functional.bind/data/bind9/named.conf new file +48 -0
new file mode 100644
index 0000000..cbe9b3b
@@ -0,0 +1,48 @@
+// This is the primary configuration file for the BIND DNS server named.
+//
+// If you are just adding zones, please do that in /etc/bind/named.conf.local
+
+include "/etc/bind/named.conf.options";
+
+// prime the server with knowledge of the root servers
+zone "." {
+	type hint;
+	file "/etc/bind/db.root";
+};
+
+// be authoritative for the localhost forward and reverse zones, and for
+// broadcast zones as per RFC 1912
+
+zone "localhost" {
+	type master;
+	file "/etc/bind/db.local";
+};
+
+zone "127.in-addr.arpa" {
+	type master;
+	file "/etc/bind/db.127";
+};
+
+zone "0.in-addr.arpa" {
+	type master;
+	file "/etc/bind/db.0";
+};
+
+//zone "255.in-addr.arpa" {
+//	type master;
+//	file "/etc/bind/db.255";
+//};
+
+zone "linux-test.com" IN {
+	type master;
+	file "/var/named/linux_test.com.db";
+	allow-update { none; };
+};
+
+zone "246.168.192.in-addr.arpa" IN {
+	type master;
+	file "/var/named/246.168.192.in-addr.arpa.db";
+	allow-update { none; };
+};
+
+include "/etc/bind/named.conf.local";
engine/tests/Functional.bind/data/bind9/resolv.conf new file +0 -0
new file mode 100644
index 0000000..e69de29
engine/tests/Functional.bind/data/bind9/rndc.conf new file +9 -0
new file mode 100644
index 0000000..5e85bfa
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2000, 2001  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL

WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */

engine/tests/Functional.bind/data/bind9/rndc.conf new file +18 -0
+
+/* $Id: rndc.conf,v 1.7.2.1 2004/03/09 06:09:27 marka Exp $ */
+
+/*
+ * Sample rndc configuration file.
+ */
+
+options {
+        default-server  localhost;
+        default-key     "rndckey";
+};
+
+server localhost {
+        key     "rndckey";
+};
+
+include "/etc/bind/rndc.key";
+
engine/tests/Functional.bind/data/bind9/rndc.key new file +4 -0
new file mode 100644
index 0000000..aca0e86
@@ -0,0 +1,4 @@
+key "rndckey" {
+	algorithm hmac-md5;
+	secret "mH48lXo3q1gxhMeeFxFJ9A==";
+};
engine/tests/Functional.bind/data/bind9/sysconfig/named new file +7 -0
new file mode 100644
index 0000000..82e6b6b
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/var/named/chroot

diff --git a/engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot b/engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot new file mode 100644
index 0000000..595051d

engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot new file +7 -0
@@ -0,0 +1,7 @@
+# Currently, you can use the following options:
+# ROOTDIR="/some/where"  --  will run named in a chroot environment.
+#                            you must set up the chroot environment before
+#                            doing this.
+# OPTIONS="whatever" -- These additional options will be passed to named
+#                       at startup. Don't add -t here, use ROOTDIR instead.
+ROOTDIR=/
engine/tests/Functional.bind/data/bind9/x86_64_named.conf new file +76 -0
new file mode 100644
index 0000000..8c76e30
@@ -0,0 +1,76 @@
+#
+# /etc/named.conf
+#
+
+options {
+
+	directory "/var/named";
+	pid-file "/var/run/named/named.pid";
+
+	/*
+	 * If there is a firewall between you and nameservers you want
+	 * to talk to, you might need to uncomment the query-source
+	 * directive below.  Previous versions of BIND always asked
+	 * questions using port 53, but BIND 8.1 uses an unprivileged
+	 * port by default.
+	 */
+
+	// query-source address * port 53;
+
+	allow-query{
+		127.0.0.1;
+		192.168.0.0/24;
+	};
+
+	allow-recursion{
+		127.0.0.1;
+		192.168.0.0/24;
+	};
+
+	allow-transfer{
+		127.0.0.1;
+		192.168.0.0/24;
+	};
+
+	forwarders{
+		// 192.168.0.1;
+	};
+};
+
+//
+// a caching only nameserver config
+//
+
+controls {
+	inet 127.0.0.1 allow { localhost; } keys { rndckey; };
+};
+
+logging {
+	category lame-servers { null; };
+};
+
+include "/etc/bind/rndc.key";
+
+zone "linux-test.com" IN {
+	type master;
+	file "linux_test.com.db";
+	allow-update { none; };
+};
+
+# zone "0.168.192.in-addr.arpa" IN {
+#        type master;
+#        file "0.168.192.in-addr.arpa.db";
+#        allow-update { none; };
+# };
+
+zone "246.168.192.in-addr.arpa" IN {
+	type master;
+	file "246.168.192.in-addr.arpa.db";
+	allow-update { none; };
+};
+
+#zone "20.24.10.in-addr.arpa" IN {
+#	type master;
+#	file "20.24.10.in-addr.arpa.db";
+#	allow-update { none; };
+#};
engine/tests/Functional.bind/data/linux_test.com.db new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/data/linux_test.com.db_24 new file +0 -0
new file mode 100644
index 0000000..02b6086

engine/tests/Functional.bind/data/linux_test.com.db_24 line 10

Quoted 10 lines
engine/tests/Functional.bind/data/linux_test.com.db_24 new file +10 -0
@@ -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	        192.168.246.87

Does this test require that the device under test be on the 192.168 network?

I'm not familiar enough with named and bind to know.

Quoted 160 lines
engine/tests/Functional.bind/data/linux_test.com.db_27 new file +10 -0
new file mode 100644
index 0000000..ca836b5
@@ -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	        192.168.246.61
engine/tests/Functional.bind/data/linux_test.com.db_29 new file +10 -0
new file mode 100644
index 0000000..f4a8377
@@ -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	        192.168.246.86
engine/tests/Functional.bind/data/linux_test.com.db_30 new file +10 -0
new file mode 100644
index 0000000..dc373bb
@@ -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	        192.168.246.129
engine/tests/Functional.bind/data/linux_test.com.db_31 new file +10 -0
new file mode 100644
index 0000000..f39f5fb
@@ -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	        192.168.246.85
engine/tests/Functional.bind/data/linux_test.com.db_34 new file +10 -0
new file mode 100644
index 0000000..9f942f2
@@ -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	        192.168.246.90
engine/tests/Functional.bind/data/linux_test.com.db_36 new file +10 -0
new file mode 100644
index 0000000..d24501f
@@ -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	        192.168.246.136
engine/tests/Functional.bind/data/linux_test.com.db_38 new file +10 -0
new file mode 100644
index 0000000..880166b
@@ -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	        192.168.246.59
engine/tests/Functional.bind/data/linux_test.com.db_8 new file +10 -0
new file mode 100644
index 0000000..7846fd5
@@ -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	        192.168.246.41
engine/tests/Functional.bind/fuego_test.sh new file +3 -0
new file mode 100644
index 0000000..7e4fa2d
@@ -0,0 +1,33 @@
+function test_pre_check {
+    is_on_target_path named-checkconf PROGRAM_CHECKCONF
+    assert_define PROGRAM_CHECKCONF "Missing 'bind' program on target

board"

engine/tests/Functional.bind/fuego_test.sh new file +4 -0
+    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"

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

board"

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

target board"

engine/tests/Functional.bind/fuego_test.sh new file +2 -0
+    is_on_target_path named-checkzone PROGRAM_CHECKZONE
+    assert_define PROGRAM_CHECKZONE "Missing 'named-checkzone'
Quoted 1 line

program on target board"

Would be good to check for pgrep here. It is not a command that is common to some of the very low-end systems, and it is used extensively throughout the subtests.

It might be possible to write a simple shell function to perform the same operation as pgrep (at least the way it is used now, which is limited to just grep'ping ps for a single program name (ie - not using any of the flags for filtering the process list by other attributes).

This would be a good candidate to put into fuego_board_function_lib.sh, to provide this feature if pgrep is not present on a board. (Then we wouldn't be dependent on pgrep being present).

engine/tests/Functional.bind/fuego_test.sh line 25

Quoted 13 lines
engine/tests/Functional.bind/fuego_test.sh new file +5 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/bind_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh

$BOARD_TESTDIR/fuego.$TESTDIR

engine/tests/Functional.bind/fuego_test.sh new file +7 -0
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export tst_bind_file=246.168.192.in-addr.arpa.db;\

will this work on a board on any network? Or does the board being tested have to be on a 192.168.246 network?

Quoted 63 lines
engine/tests/Functional.bind/fuego_test.sh new file +8 -0
+    export test_target_conf=x86_64;\
+    export remotehost=$IPADDR;\
+    ./bind_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.bind/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.bind/spec.json new file +7 -0
new file mode 100644
index 0000000..00a56f9
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.bind",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +3 -0
new file mode 100644
index 0000000..5a6fbb7
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+#  After running the/etc/named.conf to the target, run the named

checkconf command in the chroot environment to verify the normal termination.

engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh line 7

Quoted 4 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +4 -0
+
+test="chroot_chkconf"
+
+kill -9 $(pgrep named)

Could this be accomplished with "killall -9 named"? I believe Fuego requires killall, but not pgrep, on boards under test.

It would be good to record here whether named was already running, and start it again (after restoring the configuration files), so that the machine is left in the same state it was in before the test started.

Quoted 34 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +34 -0
+
+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
+
+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
+

engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh line 51

Quoted 10 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +10 -0
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if named-checkconf -t /var/named/chroot
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -rf /var/named

Does this remove anything from the board that this test did not put there? If so, that's bad. We should try to leave the board in the same state we left it. If /var/named existed before this test was run, we should not be destroying it at the end of this test.

Quoted 109 lines
engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file +1 -0
+mv /etc/sysconfig/named_bak /etc/sysconfig/named
engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +3 -0
new file mode 100644
index 0000000..ccd261d
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm that an IP address is pulled

from the name.

engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +79 -0
+
+test="chroot_dig1"
+
+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 ]
+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 /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +15 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+cp /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    chown root.named /etc/bind/rndc.key /etc/bind/rndc.conf
Quoted 1 line

/etc/bind/named.conf

Does this test require root privileges to perform all these operations (particularly the chown)? If so, there should be a NEED_ROOT=1 in fuego_test.sh to indicate this.

Quoted 135 lines

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

engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file +13 -0
+}
+
+named -t /var/named/chroot
+
+if dig linux-test.com | grep $remotehost
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+kill -9 $(pgrep named)
+restore_target
engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +3 -0
new file mode 100644
index 0000000..bbeb981
@@ -0,0 +1,118 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm that an IP address is pulled

from the name.

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +82 -0
+
+test="chroot_dig2"
+
+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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +16 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+cp /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/sysconfig/named_bak /etc/sysconfig/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    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

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +5 -0
+}
+
+named -t /var/named/chroot
+
+sleep 5

engine/tests/Functional.bind/tests/bind_chroot_dig2.sh line 118

Quoted 10 lines
engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file +10 -0
+
+if dig -x $remotehost | grep "linux-test.com"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+kill -9 $(pgrep named)
+restore_target

If named was running before this test started, it should be restarted when the test finishes, after all the configuration files have been restored.

Quoted 477 lines
engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +50 -0
new file mode 100644
index 0000000..88456c0
@@ -0,0 +1,130 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm Listening port "53" "953".
+
+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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp /var/named/chroot/etc/bind/named.conf

/var/named/chroot/etc/bind/named.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +14 -0
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp /var/named/chroot/etc/bind/rndc.conf

/var/named/chroot/etc/bind/rndc.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +14 -0
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp /var/named/chroot/etc/bind/rndc.key

/var/named/chroot/etc/bind/rndc.key_bak

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +10 -0
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +16 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+cp /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/sysconfig/named_bak /etc/sysconfig/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    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

engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file +24 -0
+}
+
+named -t /var/named/chroot
+
+if netstat -ln | grep ":53"
+then
+    echo " -> port 53 is active."
+else
+    echo " -> port 53 is not active."
+    echo " -> $test: TEST-FAIL"
+    kill -9 $(pgrep named)
+    restore_target
+    exit
+fi
+
+if netstat -ln | grep ":953"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+kill -9 $(pgrep named)
+restore_target
engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +55 -0
new file mode 100644
index 0000000..70f872b
@@ -0,0 +1,137 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm the process file id.
+
+test="chroot_pid"
+
+killall 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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+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
+
+cp /var/named/chroot/etc/bind/named.conf

/var/named/chroot/etc/bind/named.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +14 -0
+cp data/bind9/named.conf /var/named/chroot/etc/bind/named.conf
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+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
+cp /var/named/chroot/etc/bind/rndc.conf

/var/named/chroot/etc/bind/rndc.conf_bak

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +14 -0
+cp data/bind9/rndc.conf /var/named/chroot/etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+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
+cp /var/named/chroot/etc/bind/rndc.key

/var/named/chroot/etc/bind/rndc.key_bak

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +10 -0
+cp data/bind9/rndc.key /var/named/chroot/etc/bind/rndc.key
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+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

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +16 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+mv /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+restore_target() {
+    rm -rf /var/named
+    mv /etc/sysconfig/named_bak /etc/sysconfig/named
+    mv /etc/resolv.conf_bak /etc/resolv.conf
+    mv /etc/hosts_bak /etc/hosts
+    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
+    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

engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file +26 -0
+}
+
+named -t /var/named/chroot
+
+if ls /var/named/chroot/var/run/named/named.pid
+then
+    echo " -> pid file is exist."
+else
+    echo " -> pid file is not exist."
+    echo " -> $test: TEST-FAIL"
+    killall named
+    restore_target
+    exit
+fi
+
+killall named
+
+sleep 5
+
+if test -f /var/named/chroot/var/run/named/named.pid
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
+restore_target
engine/tests/Functional.bind/tests/bind_chroot_ps.sh new file +3 -0
new file mode 100644
index 0000000..d99c3cb
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+#  In the target start named chroot, and confirm the process condition by

command ps.

engine/tests/Functional.bind/tests/bind_chroot_ps.sh new file +42 -0
+
+test="chroot_ps"
+
+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 ]
+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
+
+named -t /var/named/chroot
+
+if ps aux | grep "[/]var/named/chroot"
+then
+    echo " -> get the process of named."
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> can't get the process of named."
+    echo " -> $test: TEST-FAIL"
+fi
+kill -9 $(pgrep named)
+rm -rf /var/named
engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh new file +3 -0
new file mode 100644
index 0000000..be1919d
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+#  Run the rndc-confgen command in the chroot environment to find the

rndc.key file.

engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh new file +54 -0
+
+test="chroot_rndc-confgen"
+
+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 ]
+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
+
+cp /etc/sysconfig/named /etc/sysconfig/named_bak
+cp data/bind9/sysconfig/named /etc/sysconfig/named
+
+if [ -f /etc/bind/rndc.key ]
+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
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -rf /var/named
+mv /etc/sysconfig/named_bak /etc/sysconfig/named
+mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh new file +56 -1
new file mode 100644
index 0000000..195410f
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+#  Launch named chroot with the target and check if syslogis exist.
+
+test="chroot_syslog-ng"
+
+kill -9 $(pgrep named)
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target syslog-ng stop
+
+if [ -f /var/log/syslog ]
+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
+
+exec_service_on_target syslog-ng restart
+
+named -t /var/named/chroot
+
+if cat /var/log/syslog | grep "starting up"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kill -9 $(pgrep named)
+rm -rf /var/named
--
Quoted 1 line

1.8.3.1

Overall, this is a nice test of named functionality. Despite the issues I have with some parts, I'm going to apply it.

However, please answer my questions above, and try to fix the issues I've raised in a new patch on top of this one.

Thanks. Applied.
-- Tim

#6 lore raw

Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot).

Quoted 84 lines

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

Hi Tim

The answers to comment are as follows.

Quoted 13 lines

+++ b/engine/tests/Functional.bind/data/linux_test.com.db_24

engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC new file +10 -0
@@ -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	        192.168.246.87
Quoted 1 line

Does this test require that the device under test be on the 192.168

network?

Quoted 16 lines

I'm not familiar enough with named and bind to know.

engine/tests/Functional.bind/fuego_test.sh new file +5 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/bind_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh

$BOARD_TESTDIR/fuego.$TESTDIR

engine/tests/Functional.bind/fuego_test.sh new file +7 -0
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export tst_bind_file=246.168.192.in-addr.arpa.db;\
Quoted 2 lines

will this work on a board on any network? Or does the board being tested have to be on a 192.168.246 network?

The test can work on a board on any network.
I will set the value of network in the board with a variable so that the user can make changes according to the actual test environment.

Quoted 1 line

Would be good to check for pgrep here. It is not a command that is

common

Quoted 8 lines

to some of the very low-end systems, and it is used extensively throughout the subtests.
It might be possible to write a simple shell function to perform the same operation as pgrep (at least the way it is used now, which is limited to just grep'ping ps for a single program name (ie - not using any of the flags for filtering the process list by other attributes). This would be a good candidate to put into fuego_board_function_lib.sh, to provide this feature if pgrep is not present on a board. (Then we

wouldn't

Quoted 1 line

be dependent on pgrep being present).

Using pgrep here is just to delete the named process without any other functions.
Therefore, killall -9 named can be used instead.

Quoted 4 lines

Does this remove anything from the board that this test did not put there? If so, that's bad. We should try to leave the board in the same state we left it. If /var/named existed before this test was run, we should not be destroying it at the end of this test.

Yes. I plan to check whether /var/named exists first, and if there is, backup it first.
After the test is completed, resume it.

Quoted 3 lines

Does this test require root privileges to perform all these operations (particularly the chown)? If so, there should be a NEED_ROOT=1 in fuego_test.sh to indicate this.

Control of service needs root permissions. Therefore, I will add NEED_ROOT=1 to fuego_test.sh.

Quoted 8 lines
Quoted 2 lines

If named was running before this test started, it should be restarted when the test finishes, after all the configuration files have been restored.

Yes, I will check if named was running before this test started. If it was running, when the test finishes, I will restart it, after all the configuration files have been restored.

If you agree with my above modifications, I'll modify the test suite and submit the patch.

I agree with this. Please submit a patch with the proposed changes.
-- Tim

#7 lore raw

PATCH 1/1 bind: Add test cases for commands of bind(named).

In reply to Wang Mingyu
---
 .../Functional.bind/tests/bind_named_chkconf.sh    | 30 ++++++++
 .../Functional.bind/tests/bind_named_chkzone1.sh   | 28 +++++++
 .../Functional.bind/tests/bind_named_chkzone2.sh   | 28 +++++++
 .../tests/Functional.bind/tests/bind_named_dig1.sh | 68 +++++++++++++++++
 .../tests/Functional.bind/tests/bind_named_dig2.sh | 85 ++++++++++++++++++++++
 .../Functional.bind/tests/bind_named_lport.sh      | 46 ++++++++++++
 .../Functional.bind/tests/bind_named_pidfile.sh    | 52 +++++++++++++
 .../tests/Functional.bind/tests/bind_named_ps.sh   | 41 +++++++++++
 .../Functional.bind/tests/bind_named_syslog.sh     | 57 +++++++++++++++
 .../Functional.bind/tests/bind_rndc-confgen.sh     | 35 +++++++++
 10 files changed, 470 insertions(+)
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_chkconf.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_chkzone1.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_chkzone2.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_dig1.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_dig2.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_lport.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_pidfile.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_ps.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_syslog.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_rndc-confgen.sh
engine/tests/Functional.bind/tests/bind_named_chkconf.sh new file +30 -0
new file mode 100644
index 0000000..7914e0d
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  After running the /etc/named.conf to run to the target, run the named checkconf command and verify the normal end.
+
+test="named_chkconf"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ -f /etc/bind/named.conf ]
+then
+    cp /etc/bind/named.conf /etc/bind/named.conf_bak
+fi
+
+cp data/bind9/named.conf /etc/bind/named.conf
+
+if named-checkconf
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ -f /etc/bind/named.conf_bak ]
+then
+    mv /etc/bind/named.conf_bak /etc/bind/named.conf
+fi
engine/tests/Functional.bind/tests/bind_named_chkzone1.sh new file +28 -0
new file mode 100644
index 0000000..40a6387
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# when the /var/named/ is transformed run the named checkzone command to verify that it is successfully terminated.
+
+test="named_chkzone1"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ ! -d /var/named ]
+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
+
+if named-checkzone linux-test.com /var/named/linux_test.com.db
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
engine/tests/Functional.bind/tests/bind_named_chkzone2.sh new file +28 -0
new file mode 100644
index 0000000..6a3da22
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# when the /var/named/ is transformed run the named checkzone command to verify that it is successfully terminated.
+
+test="named_chkzone2"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ ! -d /var/named ]
+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
+
+if named-checkzone 192.168.0.0 /var/named/$tst_bind_file
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
engine/tests/Functional.bind/tests/bind_named_dig1.sh new file +68 -0

68 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_named_dig2.sh new file +85 -0

85 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_named_lport.sh new file +46 -0

46 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_named_pidfile.sh new file +52 -0

52 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_named_ps.sh new file +41 -0

41 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_named_syslog.sh new file +57 -0

57 lines not on this page · raw message

engine/tests/Functional.bind/tests/bind_rndc-confgen.sh new file +35 -0
new file mode 100644
index 0000000..adc38ca
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#  In the target execute command rndc-confgen, and confirm the file rndc.key.
+
+test="rndc-confgen"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ -f /etc/bind/rndc.key ]
+then
+    mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
+fi
+
+rndc-confgen -a -k rndckey -r /dev/urandom
+
+echo "sleep 60 seconds"
+sleep 60
+
+if ls /etc/bind/rndc.key
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ -f /etc/bind/rndc.key_bak ]
+then
+    mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
+else
+    rm -f /etc/bind/rndc.key
+fi
Signature · 1 line
1.8.3.1
#8 lore raw

Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(named).

Comments and questions inline below.

Quoted 2 lines

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

Missing description in commit message body. Please add these in the future.

Quoted 47 lines
---
 .../Functional.bind/tests/bind_named_chkconf.sh    | 30 ++++++++
 .../Functional.bind/tests/bind_named_chkzone1.sh   | 28 +++++++
 .../Functional.bind/tests/bind_named_chkzone2.sh   | 28 +++++++
 .../tests/Functional.bind/tests/bind_named_dig1.sh | 68
+++++++++++++++++
 .../tests/Functional.bind/tests/bind_named_dig2.sh | 85
++++++++++++++++++++++
 .../Functional.bind/tests/bind_named_lport.sh      | 46 ++++++++++++
 .../Functional.bind/tests/bind_named_pidfile.sh    | 52 +++++++++++++
 .../tests/Functional.bind/tests/bind_named_ps.sh   | 41 +++++++++++
 .../Functional.bind/tests/bind_named_syslog.sh     | 57 +++++++++++++++
 .../Functional.bind/tests/bind_rndc-confgen.sh     | 35 +++++++++
 10 files changed, 470 insertions(+)
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_chkconf.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_chkzone1.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_chkzone2.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_dig1.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_dig2.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_lport.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_pidfile.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_named_ps.sh
 create mode 100644
engine/tests/Functional.bind/tests/bind_named_syslog.sh
 create mode 100644 engine/tests/Functional.bind/tests/bind_rndc-

confgen.sh

engine/tests/Functional.bind/tests/bind_named_chkconf.sh new file +3 -0
new file mode 100644
index 0000000..7914e0d
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  After running the /etc/named.conf to run to the target, run the named

checkconf command and verify the normal end.

engine/tests/Functional.bind/tests/bind_named_chkconf.sh line 11

Quoted 8 lines
engine/tests/Functional.bind/tests/bind_named_chkconf.sh new file +8 -0
+
+test="named_chkconf"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop

We stop named, but don't restart it. We should leave the machine in the same state we found it in.

Quoted 158 lines
engine/tests/Functional.bind/tests/bind_named_chkconf.sh new file +19 -0
+
+if [ -f /etc/bind/named.conf ]
+then
+    cp /etc/bind/named.conf /etc/bind/named.conf_bak
+fi
+
+cp data/bind9/named.conf /etc/bind/named.conf
+
+if named-checkconf
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ -f /etc/bind/named.conf_bak ]
+then
+    mv /etc/bind/named.conf_bak /etc/bind/named.conf
+fi
engine/tests/Functional.bind/tests/bind_named_chkzone1.sh new file +3 -0
new file mode 100644
index 0000000..40a6387
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# when the /var/named/ is transformed run the named checkzone

command to verify that it is successfully terminated.

engine/tests/Functional.bind/tests/bind_named_chkzone1.sh new file +16 -0
+
+test="named_chkzone1"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ ! -d /var/named ]
+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

engine/tests/Functional.bind/tests/bind_named_chkzone1.sh new file +9 -0
+
+if named-checkzone linux-test.com /var/named/linux_test.com.db
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
engine/tests/Functional.bind/tests/bind_named_chkzone2.sh new file +3 -0
new file mode 100644
index 0000000..6a3da22
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# when the /var/named/ is transformed run the named checkzone

command to verify that it is successfully terminated.

engine/tests/Functional.bind/tests/bind_named_chkzone2.sh new file +16 -0
+
+test="named_chkzone2"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ ! -d /var/named ]
+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

engine/tests/Functional.bind/tests/bind_named_chkzone2.sh new file +9 -0
+
+if named-checkzone 192.168.0.0 /var/named/$tst_bind_file
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm -f /var/named/$tst_bind_file /var/named/linux_test.com.db
engine/tests/Functional.bind/tests/bind_named_dig1.sh new file +45 -0
new file mode 100644
index 0000000..8cbbdb1
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# Start the named on target.
+# Check the IP address.
+
+test="named_dig1"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+fi
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+fi
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+fi
+
+mv /etc/resolv.conf /etc/resolv.conf_bak
+cp data/bind9/resolv.conf /etc/resolv.conf
+cp data/bind9/sysconfig/named.nochroot /etc/sysconfig/named
+
+mv /etc/bind/named.conf /etc/bind/named.conf_bak
+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 ]
+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

engine/tests/Functional.bind/tests/bind_named_dig1.sh new file +12 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+mv /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+exec_service_on_target named start
+
+if dig linux-test.com | grep $remotehost
+then
+    echo " -> $test: TEST-PASS"

engine/tests/Functional.bind/tests/bind_named_dig1.sh line 67

Quoted 10 lines
engine/tests/Functional.bind/tests/bind_named_dig1.sh new file +10 -0
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+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
+rm -fr /var/named

Are we deleting anything here that we didn't put on the board ourselves for the test? This is a little frightening.

Quoted 84 lines
engine/tests/Functional.bind/tests/bind_named_dig1.sh new file +1 -0
+mv /etc/hosts_bak /etc/hosts
engine/tests/Functional.bind/tests/bind_named_dig2.sh new file +58 -0
new file mode 100644
index 0000000..1259f3e
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# Start the named on target.
+# Check the IP address.
+
+test="named_dig2"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ ! -f /etc/bind/named.conf ]
+then
+    touch /etc/bind/named.conf
+fi
+
+if [ ! -f /etc/bind/rndc.conf ]
+then
+    touch /etc/bind/rndc.conf
+fi
+
+if [ ! -f /etc/resolv.conf ]
+then
+    touch /etc/resolv.conf
+fi
+
+mv /etc/resolv.conf /etc/resolv.conf_bak
+cp data/bind9/resolv.conf /etc/resolv.conf
+cp data/bind9/sysconfig/named.nochroot /etc/sysconfig/named
+
+mv /etc/bind/named.conf /etc/bind/named.conf_bak
+cp data/bind9/named.conf /etc/bind/named.conf
+
+cp data/bind9/x86_64_named.conf /etc/bind/x86_64_named.conf
+if [ -d /lib64/ ]
+then
+    cp -a /etc/bind/x86_64_named.conf /etc/bind/named.conf
+fi
+
+mv /etc/bind/rndc.conf /etc/bind/rndc.conf_bak
+cp data/bind9/rndc.conf /etc/bind/rndc.conf
+
+if [ ! -f /etc/bind/rndc.key ]
+then
+    touch /etc/bind/rndc.key
+fi
+mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
+cp data/bind9/rndc.key /etc/bind/rndc.key
+
+if [ ! -d /var/named ]
+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

engine/tests/Functional.bind/tests/bind_named_dig2.sh new file +17 -0
+if [ ! -f /etc/hosts ]
+then
+    touch /etc/hosts
+fi
+mv /etc/hosts /etc/hosts_bak
+cp data/bind9/hosts /etc/hosts
+
+exec_service_on_target named start
+
+sleep 5
+
+if dig -x $remotehost | grep "linux-test.com"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi

engine/tests/Functional.bind/tests/bind_named_dig2.sh line 85

Quoted 10 lines
engine/tests/Functional.bind/tests/bind_named_dig2.sh new file +10 -0
+
+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 /etc/bind/rndc.key_bak /etc/bind/rndc.key
+
+rm -fr /var/named
+mv /etc/hosts_bak /etc/hosts

Is named supposed to be running or not at the end of this test?

Quoted 269 lines
engine/tests/Functional.bind/tests/bind_named_lport.sh new file +46 -0
new file mode 100644
index 0000000..0a171a6
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Start the named on target.
+# Check the listening port.
+
+test="named_lport"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+if [ -f /etc/bind/rndc.key ]
+then
+    rm -f /etc/bind/rndc.key
+fi
+
+exec_service_on_target named stop
+
+if exec_service_on_target named start
+then
+    echo " -> start of named succeeded."
+else
+    echo " -> start of named failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if netstat -ln | grep ":53"
+then
+    echo " -> port 53 is exist."
+else
+    echo " -> port 53 is not exist."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target named stop
+    exit
+fi
+
+if netstat -ln | grep ":953"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> port 953 is not exist."
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target named stop
engine/tests/Functional.bind/tests/bind_named_pidfile.sh new file +52 -0
new file mode 100644
index 0000000..be2fc89
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# Start the named on target.
+# Check the pid file.
+
+test="named_pidfile"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+if [ -f /etc/bind/rndc.key ]
+then
+    rm -f /etc/bind/rndc.key
+fi
+
+exec_service_on_target named stop
+
+if exec_service_on_target named start
+then
+    echo " -> start of named succeeded."
+else
+    echo " -> start of named failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if ls /var/run/named/named.pid
+then
+    echo " -> pid file of named is exist."
+else
+    echo " -> pid file of named is not exist."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target named stop
+    exit
+fi
+
+if exec_service_on_target named stop
+then
+    echo " -> stop of named succeeded."
+else
+    echo " -> stop of named failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if test ! -f /var/run/named/named.pid
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.bind/tests/bind_named_ps.sh new file +3 -0
new file mode 100644
index 0000000..cd5fcc0
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#  In the target start bind, and confirm the process condition by command

ps.

engine/tests/Functional.bind/tests/bind_named_ps.sh new file +38 -0
+
+test="named_ps"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if exec_service_on_target named start
+then
+    echo " -> start of named succeeded."
+else
+    echo " -> start of named failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+sleep 5
+
+if ps aux | grep "[/]usr/sbin/named"
+then
+    echo " -> get the process of named."
+else
+    echo " -> can't get the process of named."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target named stop
+    exit
+fi
+
+exec_service_on_target named stop
+
+if ps aux | grep "[/]usr/sbin/named"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
engine/tests/Functional.bind/tests/bind_named_syslog.sh new file +57 -0
new file mode 100644
index 0000000..0b7c690
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# Start the named on target.
+# Check the log of named.
+
+test="named_syslog"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+logger_service=$(detect_logger_service)
+
+if [ -f /etc/bind/rndc.key ]
+then
+    rm -f /etc/bind/rndc.key
+fi
+
+exec_service_on_target named stop
+exec_service_on_target syslog.socket stop
+exec_service_on_target $logger_service stop
+
+if [ -f /var/log/syslog ]
+then
+    mv /var/log/syslog /var/log/syslog_bak
+fi
+
+exec_service_on_target $logger_service restart
+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"
+    exec_service_on_target named stop
+    if [ -f /var/log/syslog_bak ]
+    then
+        mv /var/log/syslog_bak /var/log/syslog
+    fi
+    exit
+fi
+
+if cat /var/log/syslog | grep "starting up"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> log is not generated."
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target named stop
+if [ -f /var/log/syslog_bak ]
+then
+    mv /var/log/syslog_bak /var/log/syslog
+fi
+
engine/tests/Functional.bind/tests/bind_rndc-confgen.sh new file +3 -0
new file mode 100644
index 0000000..adc38ca
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#  In the target execute command rndc-confgen, and confirm the file

rndc.key.

engine/tests/Functional.bind/tests/bind_rndc-confgen.sh new file +32 -1
+
+test="rndc-confgen"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+exec_service_on_target named stop
+
+if [ -f /etc/bind/rndc.key ]
+then
+    mv /etc/bind/rndc.key /etc/bind/rndc.key_bak
+fi
+
+rndc-confgen -a -k rndckey -r /dev/urandom
+
+echo "sleep 60 seconds"
+sleep 60
+
+if ls /etc/bind/rndc.key
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ -f /etc/bind/rndc.key_bak ]
+then
+    mv /etc/bind/rndc.key_bak /etc/bind/rndc.key
+else
+    rm -f /etc/bind/rndc.key
+fi
--
Quoted 1 line

1.8.3.1

OK. I applied this, but I have a few concerns that the board being tested is not left in the same condition as when we started the test. In particular, I'm concerned about removing files that were present before the test started, and about restoring named to the operational status (running or not running) it was in before the test started.

Can you check this and suggest a patch on top of this to solve these issues?

Thanks,
-- Tim

#9 lore raw

PATCH 1/1 lm_sensors: Add test cases for command lm_sensors.

In reply to Wang Mingyu
---
 engine/tests/Functional.lm_sensors/fuego_test.sh   | 20 +++++++
 .../tests/Functional.lm_sensors/lm_sensors_test.sh |  4 ++
 engine/tests/Functional.lm_sensors/parser.py       | 22 ++++++++
 engine/tests/Functional.lm_sensors/spec.json       |  7 +++
 .../tests/lm_sensors_detect.sh                     | 61 ++++++++++++++++++++++
 .../Functional.lm_sensors/tests/lm_sensors_help.sh | 13 +++++
 6 files changed, 127 insertions(+)
 create mode 100644 engine/tests/Functional.lm_sensors/fuego_test.sh
 create mode 100755 engine/tests/Functional.lm_sensors/lm_sensors_test.sh
 create mode 100644 engine/tests/Functional.lm_sensors/parser.py
 create mode 100644 engine/tests/Functional.lm_sensors/spec.json
 create mode 100644 engine/tests/Functional.lm_sensors/tests/lm_sensors_detect.sh
 create mode 100644 engine/tests/Functional.lm_sensors/tests/lm_sensors_help.sh
engine/tests/Functional.lm_sensors/fuego_test.sh new file +20 -0
new file mode 100644
index 0000000..e48d012
@@ -0,0 +1,20 @@
+function test_pre_check {
+    is_on_target_path sensors PROGRAM_SENSORS
+    assert_define PROGRAM_SENSORS "Missing 'sensors' program on target board"
+    is_on_target_path sensors-detect PROGRAM_SENSORSDETECT
+    assert_define PROGRAM_SENSORSDETECT "Missing 'sensors-detect' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/lm_sensors_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./lm_sensors_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.lm_sensors/lm_sensors_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
engine/tests/Functional.lm_sensors/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.lm_sensors/spec.json new file +7 -0
new file mode 100644
index 0000000..f1d295e
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.lm_sensors",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.lm_sensors/tests/lm_sensors_detect.sh new file +61 -0

61 lines not on this page · raw message

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

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

In reply to Wang Mingyu
---
 engine/tests/Functional.atmtcp/atmtcp_test.sh      |  4 ++++
 engine/tests/Functional.atmtcp/fuego_test.sh       | 18 ++++++++++++++++
 engine/tests/Functional.atmtcp/parser.py           | 22 ++++++++++++++++++++
 engine/tests/Functional.atmtcp/spec.json           |  7 +++++++
 .../tests/Functional.atmtcp/tests/atmtcp_help.sh   | 16 +++++++++++++++
 .../Functional.atmtcp/tests/atmtcp_virtual.sh      | 24 ++++++++++++++++++++++
 6 files changed, 91 insertions(+)
 create mode 100755 engine/tests/Functional.atmtcp/atmtcp_test.sh
 create mode 100644 engine/tests/Functional.atmtcp/fuego_test.sh
 create mode 100644 engine/tests/Functional.atmtcp/parser.py
 create mode 100644 engine/tests/Functional.atmtcp/spec.json
 create mode 100644 engine/tests/Functional.atmtcp/tests/atmtcp_help.sh
 create mode 100644 engine/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
engine/tests/Functional.atmtcp/atmtcp_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
engine/tests/Functional.atmtcp/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..229c506
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path atmtcp PROGRAM_ATMTCP
+    assert_define PROGRAM_ATMTCP "Missing 'atmtcp' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/atmtcp_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./atmtcp_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.atmtcp/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.atmtcp/spec.json new file +7 -0
new file mode 100644
index 0000000..aff88cd
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.atmtcp",
+    "specs": {
+        "default": {}
+    }
+}
+
engine/tests/Functional.atmtcp/tests/atmtcp_help.sh new file +16 -0
new file mode 100644
index 0000000..e019355
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: -h
+
+test="help"
+
+expect <<-EOF
+spawn atmtcp -h
+expect {
+ "usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF
engine/tests/Functional.atmtcp/tests/atmtcp_virtual.sh new file +24 -0
new file mode 100644
index 0000000..8b7c55d
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#  In target, run command atmtcp.
+#  option: virtual
+
+test="virtual"
+
+if modprobe -v atmtcp
+then
+    echo " -> $test: modprobe atmtcp execution succeeded."
+else
+    echo " -> $test: modprobe atmtcp execution failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if [ ! -n "$(atmtcp virtual connect 127.0.0.1 | grep "virtual interface 0")" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+killall atmtcp
Signature · 1 line
1.8.3.1
#11 lore raw

PATCH 1/1 dovecot: fix test of logfile and ps.

In reply to Wang Mingyu
---
 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh | 8 ++++++--
 engine/tests/Functional.dovecot/tests/dovecot_ps.sh      | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +6 -2
index 7489103..89fc199 100644
@@ -5,16 +5,18 @@
 
 
 test="logfile"
-service_name=""
 
 . "./fuego_board_function_lib.sh"
 
 set_init_manager
+logger_service=$(detect_logger_service)
 
 exec_service_on_target dovecot stop
 rm -f /var/log/mail.log
 
-exec_service_on_target $service_name restart
+exec_service_on_target $logger_service restart
+
+sleep 3
 
 if exec_service_on_target dovecot start
 then
@@ -24,6 +26,8 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
+sleep 3
+
 if tail /var/log/mail.log | grep "dovecot"
 then
     echo " -> $test: TEST-PASS"
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +2 -2
index 2c627bb..0585cf2 100644
@@ -19,7 +19,7 @@ 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
@@ -38,7 +38,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
Signature · 1 line
1.8.3.1
#12 lore raw

Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Question inline below.

Quoted 2 lines

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

There is no explanation in the body of the commit message, explaining the rationale for these changes. I'm going to need such information to be included in the commit body from now on.

Quoted 19 lines
---
 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh | 8 ++++++--
 engine/tests/Functional.dovecot/tests/dovecot_ps.sh      | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +0 -1
index 7489103..89fc199 100644
@@ -5,16 +5,18 @@
 
 
 test="logfile"
-service_name=""
 
 . "./fuego_board_function_lib.sh"
 

engine/tests/Functional.dovecot/tests/dovecot_logfile.sh line 19

Quoted 10 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +4 -1
 set_init_manager
+logger_service=$(detect_logger_service)
 
 exec_service_on_target dovecot stop
 rm -f /var/log/mail.log
 
-exec_service_on_target $service_name restart
+exec_service_on_target $logger_service restart
+
+sleep 3

I'm not sure I'm following this. Is the board logger service writing the data to /var/log/mail.log? I would have thought that messages going through the board's system logger would show up in /var/log/messages. I'm not familiar with dovecot, but is it using the system logger, or doing its own logging to /var/log/mail.log?

I'm just trying to clarify this.

Quoted 18 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +2 -0
 if exec_service_on_target dovecot start
 then
@@ -24,6 +26,8 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
+sleep 3
+
 if tail /var/log/mail.log | grep "dovecot"
 then
     echo " -> $test: TEST-PASS"
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +0 -0
index 2c627bb..0585cf2 100644

engine/tests/Functional.dovecot/tests/dovecot_ps.sh else · line 22

Quoted 5 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -1
@@ -19,7 +19,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'.

Are there more than one dovecot processes started, and you only want to match one?

Quoted 14 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -2
 then
     echo " -> get the pid of dovecot."
 else
@@ -38,7 +38,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
--

1.8.3.1

#13 lore raw

Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Hi Tim

Quoted 5 lines

I'm not sure I'm following this. Is the board logger service writing the data to /var/log/mail.log? I would have thought that messages going through the board's system logger would show up in /var/log/messages. I'm not familiar with dovecot, but is it using the system logger, or doing its own logging to /var/log/mail.log?
I'm just trying to clarify this.

I tried the test on different boards and found that some of them generated mail.log, and the others did not. So I want to change /var/log/mail.log to /var/log/messages.

Quoted 3 lines

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'. Are there more than one dovecot processes started, and you only want to match one?

In the test, because there are other processes are running, there will be other results containing the keyword dovecot. Log information is as follows:

-> stop of dovecot succeeded.

15011 ?        Ss     0:00 sh -c { cd /home/a/fuego.Functional.dovecot;    ./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15012 ?        S      0:00 sh -c { cd /home/a/fuego.Functional.dovecot;    ./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15013 ?        S      0:00 tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15014 ?        S      0:00 /bin/sh ./dovecot_test.sh
15077 ?        S      0:00 sh tests/dovecot_ps.sh

In order to avoid grep the non dovecot commands, I think it's need to match /usr/sbin/dovecot strictly.

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 10, 2018 2:42 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Question inline below.

Quoted 2 lines

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

There is no explanation in the body of the commit message, explaining the rationale for these changes. I'm going to need such information to be included in the commit body from now on.

Quoted 19 lines
---
 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh | 8 ++++++--
 engine/tests/Functional.dovecot/tests/dovecot_ps.sh      | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +0 -1
index 7489103..89fc199 100644
@@ -5,16 +5,18 @@
 
 
 test="logfile"
-service_name=""
 
 . "./fuego_board_function_lib.sh"
 

engine/tests/Functional.dovecot/tests/dovecot_logfile.sh line 19

Quoted 10 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +4 -1
 set_init_manager
+logger_service=$(detect_logger_service)
 
 exec_service_on_target dovecot stop
 rm -f /var/log/mail.log
 
-exec_service_on_target $service_name restart
+exec_service_on_target $logger_service restart
+
+sleep 3

I'm not sure I'm following this. Is the board logger service writing the data to /var/log/mail.log? I would have thought that messages going through the board's system logger would show up in /var/log/messages. I'm not familiar with dovecot, but is it using the system logger, or doing its own logging to /var/log/mail.log?

I'm just trying to clarify this.

Quoted 16 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +2 -0
 if exec_service_on_target dovecot start  then @@ -24,6 +26,8 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
+sleep 3
+
 if tail /var/log/mail.log | grep "dovecot"
 then
     echo " -> $test: TEST-PASS"
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +0 -0
index 2c627bb..0585cf2 100644

engine/tests/Functional.dovecot/tests/dovecot_ps.sh else · line 22

Quoted 5 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -1
@@ -19,7 +19,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'.

Are there more than one dovecot processes started, and you only want to match one?

Quoted 14 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -2
 then
     echo " -> get the pid of dovecot."
 else
@@ -38,7 +38,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
--

1.8.3.1

#14 lore raw

Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Quoted 9 lines

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

Hi Tim

Quoted 1 line

I'm not sure I'm following this. Is the board logger service writing the data

to /var/log/mail.log?

Quoted 1 line

I would have thought that messages going through the board's system

logger would show up in

Quoted 8 lines
Quoted 1 line

/var/log/messages. I'm not familiar with dovecot, but is it using the system

logger, or doing its own

Quoted 2 lines

logging to /var/log/mail.log?
I'm just trying to clarify this.

I tried the test on different boards and found that some of them generated mail.log, and the others did not.
So I want to change /var/log/mail.log to /var/log/messages.

OK - I see. Is there any pattern to this? I did a bit more research, and it looks like the logging in dovecot is configurable. It says it can be configured to use syslog, issues it's messages with the 'mail' facility. Maybe on some logging systems, the system logger automatically puts the messages into mail.log, but on other systems the facility doesn't matter and they just go into /var/log/messages.

I suppose you could always check both, just to be sure. Or, if you find out that the log file used is related to the logger used, then you could use the value returned by detect_logger_service() to determine which file to check.

Quoted 19 lines
Quoted 4 lines

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'. Are there more than one dovecot processes started, and you only want to

match one?

In the test, because there are other processes are running, there will be other results containing the keyword dovecot.
Log information is as follows:

-> stop of dovecot succeeded.
15011 ? Ss 0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15012 ? S 0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15013 ? S 0:00 tee
/home/a/fuego.Functional.dovecot/Functional.dovecot.log

Quoted 5 lines
15014 ?        S      0:00 /bin/sh ./dovecot_test.sh
15077 ?        S      0:00 sh tests/dovecot_ps.sh

In order to avoid grep the non dovecot commands, I think it's need to match /usr/sbin/dovecot strictly.

Ok - that makes perfect sense. I forgot about all the fuego test processes running with 'dovecot' in their name.

Do you plan to re-submit this, or would you prefer I apply what you sent, and do a patch on top of that for any new changes?

Thanks,
-- Tim

Quoted 103 lines

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 10, 2018 2:42 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Question inline below.

Quoted 2 lines

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

There is no explanation in the body of the commit message, explaining the rationale for these changes. I'm going to need such information to be included in the commit body from now on.

Quoted 19 lines
---
 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh | 8 ++++++--
 engine/tests/Functional.dovecot/tests/dovecot_ps.sh      | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +0 -1
index 7489103..89fc199 100644
@@ -5,16 +5,18 @@
 
 
 test="logfile"
-service_name=""
 
 . "./fuego_board_function_lib.sh"
 

engine/tests/Functional.dovecot/tests/dovecot_logfile.sh line 19

Quoted 10 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +4 -1
 set_init_manager
+logger_service=$(detect_logger_service)
 
 exec_service_on_target dovecot stop
 rm -f /var/log/mail.log
 
-exec_service_on_target $service_name restart
+exec_service_on_target $logger_service restart
+
+sleep 3

I'm not sure I'm following this. Is the board logger service writing the data to /var/log/mail.log? I would have thought that messages going through the board's system logger would show up in /var/log/messages. I'm not familiar with dovecot, but is it using the system logger, or doing its own logging to /var/log/mail.log?

I'm just trying to clarify this.

Quoted 16 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +2 -0
 if exec_service_on_target dovecot start  then @@ -24,6 +26,8 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
+sleep 3
+
 if tail /var/log/mail.log | grep "dovecot"
 then
     echo " -> $test: TEST-PASS"
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +0 -0
index 2c627bb..0585cf2 100644

engine/tests/Functional.dovecot/tests/dovecot_ps.sh else · line 22

Quoted 5 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -1
@@ -19,7 +19,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'.

Are there more than one dovecot processes started, and you only want to match one?

Quoted 14 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -2
 then
     echo " -> get the pid of dovecot."
 else
@@ -38,7 +38,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
--

1.8.3.1

#15 lore raw

Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Hi Tim

Quoted 9 lines

OK - I see. Is there any pattern to this? I did a bit more research, and it looks like the logging in dovecot is configurable. It says it can be configured to use syslog, issues it's messages with the 'mail' facility. Maybe on some logging systems, the system logger automatically puts the messages into mail.log, but on other systems the facility doesn't matter and they just go into /var/log/messages.

I suppose you could always check both, just to be sure. Or, if you find out that the log file used is related to the logger used, then you could use the value returned by detect_logger_service() to determine which file to check.

After investigation, it was found that even on systems that all use syslog-ng, some generated mail.log, and some did not generate this file. This should be related to the settings of the syslog service and the rules of the generation of log file. But no matter what circumstances, messages files will be generated.

So I think it can be check both. If mail.log exists, check the keyword "dovecot". If mail.log does not exist, only check the content of messages.

If you agree with me, I will resubmit the patch .

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 10, 2018 11:34 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Quoted 12 lines

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

Hi Tim

Quoted 2 lines

I'm not sure I'm following this. Is the board logger service writing the data

to /var/log/mail.log?

Quoted 1 line

I would have thought that messages going through the board's system

logger would show up in

Quoted 2 lines

/var/log/messages. I'm not familiar with dovecot, but is it using the system

Quoted 7 lines

logger, or doing its own

Quoted 2 lines

logging to /var/log/mail.log?
I'm just trying to clarify this.

I tried the test on different boards and found that some of them generated mail.log, and the others did not.
So I want to change /var/log/mail.log to /var/log/messages.

OK - I see. Is there any pattern to this? I did a bit more research, and it looks like the logging in dovecot is configurable. It says it can be configured to use syslog, issues it's messages with the 'mail' facility. Maybe on some logging systems, the system logger automatically puts the messages into mail.log, but on other systems the facility doesn't matter and they just go into /var/log/messages.

I suppose you could always check both, just to be sure. Or, if you find out that the log file used is related to the logger used, then you could use the value returned by detect_logger_service() to determine which file to check.

Quoted 20 lines
Quoted 5 lines

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'. Are there more than one dovecot processes started, and you only want to

match one?

In the test, because there are other processes are running, there will be other results containing the keyword dovecot.
Log information is as follows:

-> stop of dovecot succeeded.
15011 ? Ss 0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15012 ? S 0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15013 ? S 0:00 tee
/home/a/fuego.Functional.dovecot/Functional.dovecot.log

Quoted 5 lines
15014 ?        S      0:00 /bin/sh ./dovecot_test.sh
15077 ?        S      0:00 sh tests/dovecot_ps.sh

In order to avoid grep the non dovecot commands, I think it's need to match /usr/sbin/dovecot strictly.

Ok - that makes perfect sense. I forgot about all the fuego test processes running with 'dovecot' in their name.

Do you plan to re-submit this, or would you prefer I apply what you sent, and do a patch on top of that for any new changes?

Thanks,
-- Tim

Quoted 103 lines

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 10, 2018 2:42 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Question inline below.

Quoted 2 lines

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

There is no explanation in the body of the commit message, explaining the rationale for these changes. I'm going to need such information to be included in the commit body from now on.

Quoted 19 lines
---
 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh | 8 ++++++--
 engine/tests/Functional.dovecot/tests/dovecot_ps.sh      | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh index 7489103..89fc199 100644

engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +0 -1
@@ -5,16 +5,18 @@
 
 
 test="logfile"
-service_name=""
 
 . "./fuego_board_function_lib.sh"

engine/tests/Functional.dovecot/tests/dovecot_logfile.sh line 18

Quoted 10 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +4 -1
 
 set_init_manager
+logger_service=$(detect_logger_service)
 
 exec_service_on_target dovecot stop  rm -f /var/log/mail.log
 
-exec_service_on_target $service_name restart
+exec_service_on_target $logger_service restart
+
+sleep 3

I'm not sure I'm following this. Is the board logger service writing the data to /var/log/mail.log? I would have thought that messages going through the board's system logger would show up in /var/log/messages. I'm not familiar with dovecot, but is it using the system logger, or doing its own logging to /var/log/mail.log?

I'm just trying to clarify this.

Quoted 16 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +2 -0
 if exec_service_on_target dovecot start  then @@ -24,6 +26,8 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
+sleep 3
+
 if tail /var/log/mail.log | grep "dovecot"
 then
     echo " -> $test: TEST-PASS"
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +0 -0
index 2c627bb..0585cf2 100644

engine/tests/Functional.dovecot/tests/dovecot_ps.sh else · line 22

Quoted 5 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -1
@@ -19,7 +19,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'.

Are there more than one dovecot processes started, and you only want to match one?

Quoted 14 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -2
 then
     echo " -> get the pid of dovecot."
 else
@@ -38,7 +38,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
--

1.8.3.1

#16 lore raw

Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Quoted 29 lines

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

Hi Tim

Quoted 1 line

OK - I see. Is there any pattern to this? I did a bit more research, and it

looks like the logging in

Quoted 1 line

dovecot is configurable. It says it can be configured to use syslog, issues it's

messages with the

Quoted 1 line

'mail' facility. Maybe on some logging systems, the system logger

automatically puts the messages

Quoted 1 line

into mail.log, but on other systems the facility doesn't matter and they just

go into

Quoted 3 lines

/var/log/messages.

I suppose you could always check both, just to be sure. Or, if you find out

that the log file used is

Quoted 1 line

related to the logger used, then you could use the value returned by

detect_logger_service() to

Quoted 1 line

determine which file to check.

After investigation, it was found that even on systems that all use syslog-ng, some generated mail.log, and some did not generate this file. This should be related to the settings of the syslog service and the rules of the generation of log file.
But no matter what circumstances, messages files will be generated.

Quoted 4 lines

So I think it can be check both. If mail.log exists, check the keyword "dovecot". If mail.log does not exist, only check the content of messages.

If you agree with me, I will resubmit the patch .

That sounds like a good approach. Please do that and re-submit the patch. Thanks,
-- Tim

Quoted 180 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 10, 2018 11:34 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Quoted 12 lines

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

Hi Tim

Quoted 2 lines

I'm not sure I'm following this. Is the board logger service writing the data

to /var/log/mail.log?

Quoted 1 line

I would have thought that messages going through the board's system

logger would show up in

Quoted 2 lines

/var/log/messages. I'm not familiar with dovecot, but is it using the system

Quoted 7 lines

logger, or doing its own

Quoted 2 lines

logging to /var/log/mail.log?
I'm just trying to clarify this.

I tried the test on different boards and found that some of them generated mail.log, and the others did not.
So I want to change /var/log/mail.log to /var/log/messages.

OK - I see. Is there any pattern to this? I did a bit more research, and it looks like the logging in dovecot is configurable. It says it can be configured to use syslog, issues it's messages with the 'mail'
facility. Maybe on some logging systems, the system logger automatically puts the messages into mail.log, but on other systems the facility doesn't matter and they just go into /var/log/messages.

I suppose you could always check both, just to be sure. Or, if you find out that the log file used is related to the logger used, then you could use the value returned by detect_logger_service() to determine which file to check.

Quoted 20 lines
Quoted 5 lines

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'. Are there more than one dovecot processes started, and you only want to

match one?

In the test, because there are other processes are running, there will be other results containing the keyword dovecot.
Log information is as follows:

-> stop of dovecot succeeded.
15011 ? Ss 0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15012 ? S 0:00 sh -c { cd /home/a/fuego.Functional.dovecot;
./dovecot_test.sh; echo $? > /tmp/6583-22266; } 2>&1 | tee /home/a/fuego.Functional.dovecot/Functional.dovecot.log
15013 ? S 0:00 tee
/home/a/fuego.Functional.dovecot/Functional.dovecot.log

Quoted 5 lines
15014 ?        S      0:00 /bin/sh ./dovecot_test.sh
15077 ?        S      0:00 sh tests/dovecot_ps.sh

In order to avoid grep the non dovecot commands, I think it's need to match /usr/sbin/dovecot strictly.

Ok - that makes perfect sense. I forgot about all the fuego test processes running with 'dovecot' in their name.

Do you plan to re-submit this, or would you prefer I apply what you sent, and do a patch on top of that for any new changes?

Thanks,
-- Tim

Quoted 103 lines

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, October 10, 2018 2:42 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps.

Question inline below.

Quoted 2 lines

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

There is no explanation in the body of the commit message, explaining the rationale for these changes. I'm going to need such information to be included in the commit body from now on.

Quoted 19 lines
---
 engine/tests/Functional.dovecot/tests/dovecot_logfile.sh | 8 ++++++--
 engine/tests/Functional.dovecot/tests/dovecot_ps.sh      | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh index 7489103..89fc199 100644

engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +0 -1
@@ -5,16 +5,18 @@
 
 
 test="logfile"
-service_name=""
 
 . "./fuego_board_function_lib.sh"

engine/tests/Functional.dovecot/tests/dovecot_logfile.sh line 18

Quoted 10 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +4 -1
 
 set_init_manager
+logger_service=$(detect_logger_service)
 
 exec_service_on_target dovecot stop  rm -f /var/log/mail.log
 
-exec_service_on_target $service_name restart
+exec_service_on_target $logger_service restart
+
+sleep 3

I'm not sure I'm following this. Is the board logger service writing the data to /var/log/mail.log? I would have thought that messages going through the board's system logger would show up in /var/log/messages. I'm not familiar with dovecot, but is it using the system logger, or doing its own logging to /var/log/mail.log?

I'm just trying to clarify this.

Quoted 16 lines
engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +2 -0
 if exec_service_on_target dovecot start  then @@ -24,6 +26,8 @@ else
     echo " -> $test: TEST-FAIL"
 fi
 
+sleep 3
+
 if tail /var/log/mail.log | grep "dovecot"
 then
     echo " -> $test: TEST-PASS"
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +0 -0
index 2c627bb..0585cf2 100644

engine/tests/Functional.dovecot/tests/dovecot_ps.sh else · line 22

Quoted 5 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -1
@@ -19,7 +19,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"

Why is it preferred to include the path?
'grep [d]ovecot' would catch ps output that included '/usr/sbin/dovecot'.

Are there more than one dovecot processes started, and you only want to match one?

Quoted 14 lines
engine/tests/Functional.dovecot/tests/dovecot_ps.sh +1 -2
 then
     echo " -> get the pid of dovecot."
 else
@@ -38,7 +38,7 @@ else
     exit
 fi
 
-if ps -N a | grep [d]ovecot
+if ps -N a | grep "[/]usr/sbin/dovecot"
 then
     echo " -> $test: TEST-FAIL"
 else
--

1.8.3.1

#17 lore raw
In reply to Wang Mingyu

See comments inline below.

Quoted 2 lines

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

This is missing a description in the commit body. Please add something about the kbd-related programs that are checked for and tested.

Quoted 132 lines
---
 engine/tests/Functional.kbd/fuego_test.sh          | 56
++++++++++++++++++++++
 engine/tests/Functional.kbd/kbd_test.sh            |  4 ++
 engine/tests/Functional.kbd/parser.py              | 22 +++++++++
 engine/tests/Functional.kbd/spec.json              |  6 +++
 engine/tests/Functional.kbd/tests/chvt.sh          | 30 ++++++++++++
 engine/tests/Functional.kbd/tests/deallocvt.sh     | 14 ++++++
 engine/tests/Functional.kbd/tests/dumpkeys1.sh     | 12 +++++
 engine/tests/Functional.kbd/tests/dumpkeys2.sh     | 13 +++++
 engine/tests/Functional.kbd/tests/dumpkeys3.sh     | 22 +++++++++
 engine/tests/Functional.kbd/tests/fgconsole.sh     | 12 +++++
 engine/tests/Functional.kbd/tests/kbd_mode1.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode2.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode3.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode4.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbdrate1.sh      | 12 +++++
 engine/tests/Functional.kbd/tests/kbdrate2.sh      | 13 +++++
 engine/tests/Functional.kbd/tests/loadkeys.sh      | 13 +++++
 engine/tests/Functional.kbd/tests/loadunimap.sh    | 15 ++++++
 engine/tests/Functional.kbd/tests/mapscrn.sh       | 15 ++++++
 engine/tests/Functional.kbd/tests/openvt.sh        | 25 ++++++++++
 engine/tests/Functional.kbd/tests/psfaddtable.sh   | 15 ++++++
 engine/tests/Functional.kbd/tests/psfgettable.sh   | 15 ++++++
 engine/tests/Functional.kbd/tests/psfxtable.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/resizecons.sh    | 15 ++++++
 engine/tests/Functional.kbd/tests/setfont.sh       | 16 +++++++
 engine/tests/Functional.kbd/tests/setkeycodes.sh   | 16 +++++++
 engine/tests/Functional.kbd/tests/setleds.sh       | 13 +++++
 .../tests/Functional.kbd/tests/showconsolefont.sh  | 12 +++++
 engine/tests/Functional.kbd/tests/showkey.sh       | 17 +++++++
 engine/tests/Functional.kbd/tests/unicode_start.sh | 15 ++++++
 30 files changed, 493 insertions(+)
 create mode 100644 engine/tests/Functional.kbd/fuego_test.sh
 create mode 100755 engine/tests/Functional.kbd/kbd_test.sh
 create mode 100644 engine/tests/Functional.kbd/parser.py
 create mode 100644 engine/tests/Functional.kbd/spec.json
 create mode 100644 engine/tests/Functional.kbd/tests/chvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/deallocvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys3.sh
 create mode 100644 engine/tests/Functional.kbd/tests/fgconsole.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode3.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode4.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbdrate1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbdrate2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/loadkeys.sh
 create mode 100644 engine/tests/Functional.kbd/tests/loadunimap.sh
 create mode 100644 engine/tests/Functional.kbd/tests/mapscrn.sh
 create mode 100644 engine/tests/Functional.kbd/tests/openvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfaddtable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfgettable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfxtable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/resizecons.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setfont.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setkeycodes.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setleds.sh
 create mode 100644 engine/tests/Functional.kbd/tests/showconsolefont.sh
 create mode 100644 engine/tests/Functional.kbd/tests/showkey.sh
 create mode 100644 engine/tests/Functional.kbd/tests/unicode_start.sh
engine/tests/Functional.kbd/fuego_test.sh new file +5 -0
new file mode 100644
index 0000000..fd5084f
@@ -0,0 +1,56 @@
+function test_pre_check {
+    is_on_target_path chvt PROGRAM_CHVT
+    assert_define PROGRAM_CHVT "Missing 'chvt' program on target board"
+    is_on_target_path deallocvt PROGRAM_DEALLOCVT
+    assert_define PROGRAM_DEALLOCVT "Missing 'deallocvt' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path dumpkeys PROGRAM_DUMPKEYS
+    assert_define PROGRAM_DUMPKEYS "Missing 'dumpkeys' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path fgconsole PROGRAM_FGCONSOLE
+    assert_define PROGRAM_FGCONSOLE "Missing 'fgconsole' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path kbd_mode PROGRAM_KBD_MODE
+    assert_define PROGRAM_KBD_MODE "Missing 'kbd_mode' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path kbdrate PROGRAM_KBDRATE
+    assert_define PROGRAM_KBDRATE "Missing 'kbdrate' program on target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path loadkeys PROGRAM_LOADKEYS
+    assert_define PROGRAM_LOADKEYS "Missing 'loadkeys' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path loadunimap PROGRAM_LOADUNIMAP
+    assert_define PROGRAM_LOADUNIMAP "Missing 'loadunimap' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path mapscrn PROGRAM_MAPSCRN
+    assert_define PROGRAM_MAPSCRN "Missing 'mapscrn' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path openvt PROGRAM_OPENVT
+    assert_define PROGRAM_OPENVT "Missing 'openvt' program on target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path psfaddtable PROGRAM_PSFADDTABLE
+    assert_define PROGRAM_PSFADDTABLE "Missing 'psfaddtable' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path psfgettable PROGRAM_PSFGETTABLE
+    assert_define PROGRAM_PSFGETTABLE "Missing 'psfgettable' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path psfxtable PROGRAM_PSFXTABLE
+    assert_define PROGRAM_PSFXTABLE "Missing 'psfxtable' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path resizecons PROGRAM_RESIZECONS
+    assert_define PROGRAM_RESIZECONS "Missing 'resizecons' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path setfont PROGRAM_SETFONT
+    assert_define PROGRAM_SETFONT "Missing 'setfont' program on target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path setkeycodes PROGRAM_SETKEYCODES
+    assert_define PROGRAM_SETKEYCODES "Missing 'setkeycodes' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path setleds PROGRAM_SETLEDS
+    assert_define PROGRAM_SETLEDS "Missing 'setleds' program on target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path showconsolefont PROGRAM_SHOWCONSOLEFONT
+    assert_define PROGRAM_SHOWCONSOLEFONT "Missing

'showconsolefont' program on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path showkey PROGRAM_SHOWKEY
+    assert_define PROGRAM_SHOWKEY "Missing 'showkey' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path unicode_start PROGRAM_UNICODE_START
+    assert_define PROGRAM_UNICODE_START "Missing 'unicode_start'
Quoted 1 line

program on target board"

'expect' is used in some subtests below. I'd prefer to avoid using that if possible, but if it's absolutely required, then there should be a check for 'expect' on the board here.

Quoted 75 lines
engine/tests/Functional.kbd/fuego_test.sh new file +15 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/kbd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./kbd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.kbd/kbd_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
engine/tests/Functional.kbd/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.kbd/spec.json new file +6 -0
new file mode 100644
index 0000000..0a85fef
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.kbd",
+    "specs": {
+        "default": {}
+    }
+}
engine/tests/Functional.kbd/tests/chvt.sh new file +0 -0
new file mode 100644
index 0000000..7bdeaf0

engine/tests/Functional.kbd/tests/chvt.sh line 9

Quoted 9 lines
engine/tests/Functional.kbd/tests/chvt.sh new file +9 -0
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  In the target to execute command chvt and confirm the result.
+
+test="chvt"
+
+if tty | grep "^not" ; then
+    echo " -> $test: test script not running in a changable tty"
+    echo " -> $test: TEST-SKIP"

Good use of SKIP here!!

Quoted 288 lines
engine/tests/Functional.kbd/tests/chvt.sh new file +21 -0
+    exit 0
+fi
+
+tty_path=$(tty)
+# use shell variable sub-string removal to isolate the tty number
+anum=${tty_path##*/}
+if [ $anum -eq 1 ]
+then
+    bnum=$(($anum+1))
+else
+    bnum=$(($anum-1))
+fi
+echo "$test: Changing to VT $bnum"
+if chvt $bnum
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+echo "$test: Changing back to VT $bnum"
+chvt $anum
engine/tests/Functional.kbd/tests/deallocvt.sh new file +14 -0
new file mode 100644
index 0000000..26bb2d0
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  In the target to execute command deallocvt and confirm the result.
+
+test="deallocvt"
+
+openvt -f -c 4 ls
+sleep 1
+if deallocvt 4
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys1.sh new file +12 -0
new file mode 100644
index 0000000..96e0d5c
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result .
+
+test="dumpkeys1"
+
+if dumpkeys > /dev/null
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys2.sh new file +13 -0
new file mode 100644
index 0000000..511a6bc
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result.
+#  option : -i
+
+test="dumpkeys2"
+
+if dumpkeys -i | grep "keycode range supported by kernel"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys3.sh new file +22 -0
new file mode 100644
index 0000000..e2db65a
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result .
+#  option : -n
+
+test="dumpkeys3"
+
+if [ -f dumpkeys_test ]
+then
+    rm -f dumpkeys_test
+fi
+
+dumpkeys -n > dumpkeys_test
+
+if cat dumpkeys_test | grep "keymaps"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm dumpkeys_test
engine/tests/Functional.kbd/tests/fgconsole.sh new file +12 -0
new file mode 100644
index 0000000..9fa4410
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command fgconsole and confirm the result.
+
+test="fgconsole"
+
+if fgconsole
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/kbd_mode1.sh new file +15 -0
new file mode 100644
index 0000000..d86c224
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -s
+
+test="kbd_mode1"
+
+kbd_mode -s
+if kbd_mode | grep scancode
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode2.sh new file +15 -0
new file mode 100644
index 0000000..6f43ae6
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -k
+
+test="kbd_mode2"
+
+kbd_mode -k
+if kbd_mode | grep mediumraw
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode3.sh new file +15 -0
new file mode 100644
index 0000000..bbb8f0b
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -a
+
+test="kbd_mode3"
+
+kbd_mode -a
+if kbd_mode | grep ASCII
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode4.sh new file +15 -0
new file mode 100644
index 0000000..ce4132f
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -u
+
+test="kbd_mode4"
+
+kbd_mode -u
+if kbd_mode | grep UTF-8
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbdrate1.sh new file +12 -0
new file mode 100644
index 0000000..a16150e
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command kbdrate and confirm the result.
+
+test="kbdrate1"
+
+if kbdrate | grep Typematic
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/kbdrate2.sh new file +13 -0
new file mode 100644
index 0000000..33d3b37
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command kbdrate and confirm the result.
+#  option : -r
+
+test="kbdrate2"
+
+if kbdrate -r 15 -d 250
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/loadkeys.sh new file +13 -0
new file mode 100644
index 0000000..5458630
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command loadkeys and confirm the result.
+#  option : -d
+
+test="loadkeys"
+
+if loadkeys -d
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/loadunimap.sh new file +5 -0
new file mode 100644
index 0000000..ce2a24c
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command loadunimap and confirm the result.
+
+test="loadunimap"

engine/tests/Functional.kbd/tests/loadunimap.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/loadunimap.sh new file +10 -0
+
+expect <<-EOF
+spawn loadunimap
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

There must be a way to check the Usage line for loadunimap besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 12 lines
engine/tests/Functional.kbd/tests/mapscrn.sh new file +5 -0
new file mode 100644
index 0000000..5a9cfd5
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command mapscrn and confirm the result.
+
+test="mapscrn"

engine/tests/Functional.kbd/tests/mapscrn.sh line 15

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

There must be a way to check the Usage line for mapscrn besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 44 lines
engine/tests/Functional.kbd/tests/openvt.sh new file +25 -0
new file mode 100644
index 0000000..7a70dc6
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  In the target to execute command openvt and confirm the result.
+#  option : -f
+
+test="openvt"
+
+killall sleep
+openvt -f -c 2 sleep 15732
+if  ps aux | grep "[s]leep 15732"
+then
+    echo " -> $test: ps aux | grep "[s]leep 15732" executed."
+else
+    echo " -> $test: ps aux | grep "[s]leep 15732" failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi;
+
+kill $(pgrep -f "[s]leep 15732")
+if ps aux | grep "[s]leep 15732"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
engine/tests/Functional.kbd/tests/psfaddtable.sh new file +5 -0
new file mode 100644
index 0000000..79449d2
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfaddtable and confirm the result.
+
+test="psfaddtable"

engine/tests/Functional.kbd/tests/psfaddtable.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfaddtable.sh new file +10 -0
+
+expect <<-EOF
+spawn psfaddtable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

There must be a way to check the Usage line for psfaddtable besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 12 lines
engine/tests/Functional.kbd/tests/psfgettable.sh new file +5 -0
new file mode 100644
index 0000000..4c8d201
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfgettable and confirm the result.
+
+test="psfgettable"

engine/tests/Functional.kbd/tests/psfgettable.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfgettable.sh new file +10 -0
+
+expect <<-EOF
+spawn psfgettable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

There must be a way to check the Usage line for psfgettable besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 12 lines
engine/tests/Functional.kbd/tests/psfxtable.sh new file +5 -0
new file mode 100644
index 0000000..49e7316
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfxtable and confirm the result.
+
+test="psfxtable"

engine/tests/Functional.kbd/tests/psfxtable.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfxtable.sh new file +10 -0
+
+expect <<-EOF
+spawn psfxtable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

ditto

Quoted 12 lines
engine/tests/Functional.kbd/tests/resizecons.sh new file +5 -0
new file mode 100644
index 0000000..7002e6a
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command resizecons and confirm the result.
+
+test="resizecons"

engine/tests/Functional.kbd/tests/resizecons.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/resizecons.sh new file +10 -0
+
+expect <<-EOF
+spawn resizecons
+expect {
+ "COLSxROWS" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

ditto

Quoted 13 lines
engine/tests/Functional.kbd/tests/setfont.sh new file +6 -0
new file mode 100644
index 0000000..e97d504
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command setfont and confirm the result.
+#  option : -h
+
+test="setfont"

engine/tests/Functional.kbd/tests/setfont.sh line 16

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

ditto

Quoted 13 lines
engine/tests/Functional.kbd/tests/setkeycodes.sh new file +6 -0
new file mode 100644
index 0000000..3300318
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command setkeycodes and confirm the result.
+#  option : -h
+
+test="setkeycodes"

engine/tests/Functional.kbd/tests/setkeycodes.sh line 16

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

ditto

Quoted 54 lines
engine/tests/Functional.kbd/tests/setleds.sh new file +13 -0
new file mode 100644
index 0000000..1d97700
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command setleds and confirm the result.
+#  option : -V
+
+test="setleds"
+
+if setleds -V | grep "setleds from"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/showconsolefont.sh new file +3 -0
new file mode 100644
index 0000000..aadbeab
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command showconsolefont and confirm the

result.

engine/tests/Functional.kbd/tests/showconsolefont.sh new file +9 -0
+
+test="showconsolefont"
+
+if showconsolefont
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/showkey.sh new file +7 -0
new file mode 100644
index 0000000..e064077
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In the target to execute command showkey and confirm the result.
+#  option : -h
+
+test="showkey"
+

engine/tests/Functional.kbd/tests/showkey.sh line 17

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

There must be a way to check the Usage line for showkey besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 12 lines
engine/tests/Functional.kbd/tests/unicode_start.sh new file +5 -0
new file mode 100644
index 0000000..6af7c2f
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command unicode_start and confirm the result.
+
+test="unicode_start"

engine/tests/Functional.kbd/tests/unicode_start.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/unicode_start.sh new file +10 -0
+
+expect <<-EOF
+spawn unicode_start
+expect {
+ "skipped" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

There must be a way to check the Usage line for mapscrn besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 2 lines

--
1.8.3.1

Please remove these uses of 'expect' and resubmit.

Thanks,
-- Tim

#18 lore raw

hi Tim

Quoted 2 lines

This is missing a description in the commit body. Please add something about the kbd-related programs that are checked for and tested.

About this comment, my understanding is as follows, please confirm if it is correct or not:
1. in commit's information, need to add instructions about the kbd.
2. kbd-related programs are not enough, need to add more.
3. the tests of kbd-related programs are too simple, need to add some functional related tests.

by Wangmy

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, October 12, 2018 8:34 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] kbd: Add test cases for commands of kbd.

See comments inline below.

Quoted 2 lines

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

This is missing a description in the commit body. Please add something about the kbd-related programs that are checked for and tested.

Quoted 136 lines
---
 engine/tests/Functional.kbd/fuego_test.sh          | 56
++++++++++++++++++++++
 engine/tests/Functional.kbd/kbd_test.sh            |  4 ++
 engine/tests/Functional.kbd/parser.py              | 22 +++++++++
 engine/tests/Functional.kbd/spec.json              |  6 +++
 engine/tests/Functional.kbd/tests/chvt.sh          | 30 ++++++++++++
 engine/tests/Functional.kbd/tests/deallocvt.sh     | 14 ++++++
 engine/tests/Functional.kbd/tests/dumpkeys1.sh     | 12 +++++
 engine/tests/Functional.kbd/tests/dumpkeys2.sh     | 13 +++++
 engine/tests/Functional.kbd/tests/dumpkeys3.sh     | 22 +++++++++
 engine/tests/Functional.kbd/tests/fgconsole.sh     | 12 +++++
 engine/tests/Functional.kbd/tests/kbd_mode1.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode2.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode3.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbd_mode4.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/kbdrate1.sh      | 12 +++++
 engine/tests/Functional.kbd/tests/kbdrate2.sh      | 13 +++++
 engine/tests/Functional.kbd/tests/loadkeys.sh      | 13 +++++
 engine/tests/Functional.kbd/tests/loadunimap.sh    | 15 ++++++
 engine/tests/Functional.kbd/tests/mapscrn.sh       | 15 ++++++
 engine/tests/Functional.kbd/tests/openvt.sh        | 25 ++++++++++
 engine/tests/Functional.kbd/tests/psfaddtable.sh   | 15 ++++++
 engine/tests/Functional.kbd/tests/psfgettable.sh   | 15 ++++++
 engine/tests/Functional.kbd/tests/psfxtable.sh     | 15 ++++++
 engine/tests/Functional.kbd/tests/resizecons.sh    | 15 ++++++
 engine/tests/Functional.kbd/tests/setfont.sh       | 16 +++++++
 engine/tests/Functional.kbd/tests/setkeycodes.sh   | 16 +++++++
 engine/tests/Functional.kbd/tests/setleds.sh       | 13 +++++
 .../tests/Functional.kbd/tests/showconsolefont.sh  | 12 +++++
 engine/tests/Functional.kbd/tests/showkey.sh       | 17 +++++++
 engine/tests/Functional.kbd/tests/unicode_start.sh | 15 ++++++
 30 files changed, 493 insertions(+)
 create mode 100644 engine/tests/Functional.kbd/fuego_test.sh
 create mode 100755 engine/tests/Functional.kbd/kbd_test.sh
 create mode 100644 engine/tests/Functional.kbd/parser.py
 create mode 100644 engine/tests/Functional.kbd/spec.json
 create mode 100644 engine/tests/Functional.kbd/tests/chvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/deallocvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/dumpkeys3.sh
 create mode 100644 engine/tests/Functional.kbd/tests/fgconsole.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode3.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbd_mode4.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbdrate1.sh
 create mode 100644 engine/tests/Functional.kbd/tests/kbdrate2.sh
 create mode 100644 engine/tests/Functional.kbd/tests/loadkeys.sh
 create mode 100644 engine/tests/Functional.kbd/tests/loadunimap.sh
 create mode 100644 engine/tests/Functional.kbd/tests/mapscrn.sh
 create mode 100644 engine/tests/Functional.kbd/tests/openvt.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfaddtable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfgettable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/psfxtable.sh
 create mode 100644 engine/tests/Functional.kbd/tests/resizecons.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setfont.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setkeycodes.sh
 create mode 100644 engine/tests/Functional.kbd/tests/setleds.sh
 create mode 100644 
engine/tests/Functional.kbd/tests/showconsolefont.sh
 create mode 100644 engine/tests/Functional.kbd/tests/showkey.sh
 create mode 100644 engine/tests/Functional.kbd/tests/unicode_start.sh
engine/tests/Functional.kbd/fuego_test.sh new file +5 -0
new file mode 100644
index 0000000..fd5084f
@@ -0,0 +1,56 @@
+function test_pre_check {
+    is_on_target_path chvt PROGRAM_CHVT
+    assert_define PROGRAM_CHVT "Missing 'chvt' program on target board"
+    is_on_target_path deallocvt PROGRAM_DEALLOCVT
+    assert_define PROGRAM_DEALLOCVT "Missing 'deallocvt' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path dumpkeys PROGRAM_DUMPKEYS
+    assert_define PROGRAM_DUMPKEYS "Missing 'dumpkeys' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path fgconsole PROGRAM_FGCONSOLE
+    assert_define PROGRAM_FGCONSOLE "Missing 'fgconsole' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path kbd_mode PROGRAM_KBD_MODE
+    assert_define PROGRAM_KBD_MODE "Missing 'kbd_mode' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +3 -0
+    is_on_target_path kbdrate PROGRAM_KBDRATE
+    assert_define PROGRAM_KBDRATE "Missing 'kbdrate' program on 
+ target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path loadkeys PROGRAM_LOADKEYS
+    assert_define PROGRAM_LOADKEYS "Missing 'loadkeys' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path loadunimap PROGRAM_LOADUNIMAP
+    assert_define PROGRAM_LOADUNIMAP "Missing 'loadunimap' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path mapscrn PROGRAM_MAPSCRN
+    assert_define PROGRAM_MAPSCRN "Missing 'mapscrn' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path openvt PROGRAM_OPENVT
+    assert_define PROGRAM_OPENVT "Missing 'openvt' program on target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path psfaddtable PROGRAM_PSFADDTABLE
+    assert_define PROGRAM_PSFADDTABLE "Missing 'psfaddtable' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path psfgettable PROGRAM_PSFGETTABLE
+    assert_define PROGRAM_PSFGETTABLE "Missing 'psfgettable' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path psfxtable PROGRAM_PSFXTABLE
+    assert_define PROGRAM_PSFXTABLE "Missing 'psfxtable' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path resizecons PROGRAM_RESIZECONS
+    assert_define PROGRAM_RESIZECONS "Missing 'resizecons' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +3 -0
+    is_on_target_path setfont PROGRAM_SETFONT
+    assert_define PROGRAM_SETFONT "Missing 'setfont' program on 
+ target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path setkeycodes PROGRAM_SETKEYCODES
+    assert_define PROGRAM_SETKEYCODES "Missing 'setkeycodes' program

on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +3 -0
+    is_on_target_path setleds PROGRAM_SETLEDS
+    assert_define PROGRAM_SETLEDS "Missing 'setleds' program on 
+ target

board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path showconsolefont PROGRAM_SHOWCONSOLEFONT
+    assert_define PROGRAM_SHOWCONSOLEFONT "Missing

'showconsolefont' program on target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path showkey PROGRAM_SHOWKEY
+    assert_define PROGRAM_SHOWKEY "Missing 'showkey' program on

target board"

engine/tests/Functional.kbd/fuego_test.sh new file +2 -0
+    is_on_target_path unicode_start PROGRAM_UNICODE_START
+    assert_define PROGRAM_UNICODE_START "Missing 'unicode_start'
Quoted 1 line

program on target board"

'expect' is used in some subtests below. I'd prefer to avoid using that if possible, but if it's absolutely required, then there should be a check for 'expect' on the board here.

Quoted 74 lines
engine/tests/Functional.kbd/fuego_test.sh new file +14 -0
+}
+
+function test_deploy {
+    put $TEST_HOME/kbd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ }
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./kbd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
engine/tests/Functional.kbd/kbd_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
engine/tests/Functional.kbd/parser.py new file +22 -0
new file mode 100644
index 0000000..d85abd7
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + 
+'/engine/scripts/parser') import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
engine/tests/Functional.kbd/spec.json new file +6 -0
new file mode 100644
index 0000000..0a85fef
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.kbd",
+    "specs": {
+        "default": {}
+    }
+}
engine/tests/Functional.kbd/tests/chvt.sh new file +0 -0
new file mode 100644
index 0000000..7bdeaf0

engine/tests/Functional.kbd/tests/chvt.sh line 9

Quoted 9 lines
engine/tests/Functional.kbd/tests/chvt.sh new file +9 -0
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#  In the target to execute command chvt and confirm the result.
+
+test="chvt"
+
+if tty | grep "^not" ; then
+    echo " -> $test: test script not running in a changable tty"
+    echo " -> $test: TEST-SKIP"

Good use of SKIP here!!

Quoted 284 lines
engine/tests/Functional.kbd/tests/chvt.sh new file +19 -0
+    exit 0
+fi
+
+tty_path=$(tty)
+# use shell variable sub-string removal to isolate the tty number 
+anum=${tty_path##*/} if [ $anum -eq 1 ] then
+    bnum=$(($anum+1))
+else
+    bnum=$(($anum-1))
+fi
+echo "$test: Changing to VT $bnum"
+if chvt $bnum
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+echo "$test: Changing back to VT $bnum"
+chvt $anum
engine/tests/Functional.kbd/tests/deallocvt.sh new file +14 -0
new file mode 100644
index 0000000..26bb2d0
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  In the target to execute command deallocvt and confirm the result.
+
+test="deallocvt"
+
+openvt -f -c 4 ls
+sleep 1
+if deallocvt 4
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys1.sh new file +12 -0
new file mode 100644
index 0000000..96e0d5c
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result .
+
+test="dumpkeys1"
+
+if dumpkeys > /dev/null
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys2.sh new file +13 -0
new file mode 100644
index 0000000..511a6bc
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result.
+#  option : -i
+
+test="dumpkeys2"
+
+if dumpkeys -i | grep "keycode range supported by kernel"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/dumpkeys3.sh new file +22 -0
new file mode 100644
index 0000000..e2db65a
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  In the target to execute command dumpkeys and confirm the result .
+#  option : -n
+
+test="dumpkeys3"
+
+if [ -f dumpkeys_test ]
+then
+    rm -f dumpkeys_test
+fi
+
+dumpkeys -n > dumpkeys_test
+
+if cat dumpkeys_test | grep "keymaps"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm dumpkeys_test
engine/tests/Functional.kbd/tests/fgconsole.sh new file +12 -0
new file mode 100644
index 0000000..9fa4410
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command fgconsole and confirm the result.
+
+test="fgconsole"
+
+if fgconsole
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/kbd_mode1.sh new file +15 -0
new file mode 100644
index 0000000..d86c224
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -s
+
+test="kbd_mode1"
+
+kbd_mode -s
+if kbd_mode | grep scancode
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode2.sh new file +15 -0
new file mode 100644
index 0000000..6f43ae6
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -k
+
+test="kbd_mode2"
+
+kbd_mode -k
+if kbd_mode | grep mediumraw
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode3.sh new file +15 -0
new file mode 100644
index 0000000..bbb8f0b
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -a
+
+test="kbd_mode3"
+
+kbd_mode -a
+if kbd_mode | grep ASCII
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbd_mode4.sh new file +15 -0
new file mode 100644
index 0000000..ce4132f
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command kbd_mode and confirm the result.
+#  option : -u
+
+test="kbd_mode4"
+
+kbd_mode -u
+if kbd_mode | grep UTF-8
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+kbd_mode -a
engine/tests/Functional.kbd/tests/kbdrate1.sh new file +12 -0
new file mode 100644
index 0000000..a16150e
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command kbdrate and confirm the result.
+
+test="kbdrate1"
+
+if kbdrate | grep Typematic
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/kbdrate2.sh new file +13 -0
new file mode 100644
index 0000000..33d3b37
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command kbdrate and confirm the result.
+#  option : -r
+
+test="kbdrate2"
+
+if kbdrate -r 15 -d 250
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/loadkeys.sh new file +13 -0
new file mode 100644
index 0000000..5458630
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command loadkeys and confirm the result.
+#  option : -d
+
+test="loadkeys"
+
+if loadkeys -d
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/loadunimap.sh new file +3 -0
new file mode 100644
index 0000000..ce2a24c
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command loadunimap and confirm the result.

engine/tests/Functional.kbd/tests/loadunimap.sh line 13

Quoted 10 lines
engine/tests/Functional.kbd/tests/loadunimap.sh new file +10 -0
+
+test="loadunimap"
+
+expect <<-EOF
+spawn loadunimap
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" } } EOF

There must be a way to check the Usage line for loadunimap besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 10 lines
engine/tests/Functional.kbd/tests/mapscrn.sh new file +3 -0
new file mode 100644
index 0000000..5a9cfd5
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command mapscrn and confirm the result.

engine/tests/Functional.kbd/tests/mapscrn.sh line 13

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

There must be a way to check the Usage line for mapscrn besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 42 lines
engine/tests/Functional.kbd/tests/openvt.sh new file +25 -0
new file mode 100644
index 0000000..7a70dc6
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  In the target to execute command openvt and confirm the result.
+#  option : -f
+
+test="openvt"
+
+killall sleep
+openvt -f -c 2 sleep 15732
+if  ps aux | grep "[s]leep 15732"
+then
+    echo " -> $test: ps aux | grep "[s]leep 15732" executed."
+else
+    echo " -> $test: ps aux | grep "[s]leep 15732" failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi;
+
+kill $(pgrep -f "[s]leep 15732")
+if ps aux | grep "[s]leep 15732"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
engine/tests/Functional.kbd/tests/psfaddtable.sh new file +3 -0
new file mode 100644
index 0000000..79449d2
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfaddtable and confirm the result.

engine/tests/Functional.kbd/tests/psfaddtable.sh line 13

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfaddtable.sh new file +10 -0
+
+test="psfaddtable"
+
+expect <<-EOF
+spawn psfaddtable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" } } EOF

There must be a way to check the Usage line for psfaddtable besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfgettable.sh new file +3 -0
new file mode 100644
index 0000000..4c8d201
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfgettable and confirm the result.

engine/tests/Functional.kbd/tests/psfgettable.sh line 13

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfgettable.sh new file +10 -0
+
+test="psfgettable"
+
+expect <<-EOF
+spawn psfgettable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" } } EOF

There must be a way to check the Usage line for psfgettable besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfxtable.sh new file +3 -0
new file mode 100644
index 0000000..49e7316
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command psfxtable and confirm the result.

engine/tests/Functional.kbd/tests/psfxtable.sh line 13

Quoted 10 lines
engine/tests/Functional.kbd/tests/psfxtable.sh new file +10 -0
+
+test="psfxtable"
+
+expect <<-EOF
+spawn psfxtable
+expect {
+ "Usage:" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" } } EOF

ditto

Quoted 12 lines
engine/tests/Functional.kbd/tests/resizecons.sh new file +5 -0
new file mode 100644
index 0000000..7002e6a
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command resizecons and confirm the result.
+
+test="resizecons"

engine/tests/Functional.kbd/tests/resizecons.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/resizecons.sh new file +10 -0
+
+expect <<-EOF
+spawn resizecons
+expect {
+ "COLSxROWS" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

ditto

Quoted 13 lines
engine/tests/Functional.kbd/tests/setfont.sh new file +6 -0
new file mode 100644
index 0000000..e97d504
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command setfont and confirm the result.
+#  option : -h
+
+test="setfont"

engine/tests/Functional.kbd/tests/setfont.sh line 16

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

ditto

Quoted 13 lines
engine/tests/Functional.kbd/tests/setkeycodes.sh new file +6 -0
new file mode 100644
index 0000000..3300318
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In the target to execute command setkeycodes and confirm the result.
+#  option : -h
+
+test="setkeycodes"

engine/tests/Functional.kbd/tests/setkeycodes.sh line 16

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

ditto

Quoted 54 lines
engine/tests/Functional.kbd/tests/setleds.sh new file +13 -0
new file mode 100644
index 0000000..1d97700
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In the target to execute command setleds and confirm the result.
+#  option : -V
+
+test="setleds"
+
+if setleds -V | grep "setleds from"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/showconsolefont.sh new file +3 -0
new file mode 100644
index 0000000..aadbeab
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#  In the target to execute command showconsolefont and confirm the

result.

engine/tests/Functional.kbd/tests/showconsolefont.sh new file +9 -0
+
+test="showconsolefont"
+
+if showconsolefont
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
engine/tests/Functional.kbd/tests/showkey.sh new file +7 -0
new file mode 100644
index 0000000..e064077
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In the target to execute command showkey and confirm the result.
+#  option : -h
+
+test="showkey"
+

engine/tests/Functional.kbd/tests/showkey.sh line 17

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

There must be a way to check the Usage line for showkey besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 12 lines
engine/tests/Functional.kbd/tests/unicode_start.sh new file +5 -0
new file mode 100644
index 0000000..6af7c2f
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In the target to execute command unicode_start and confirm the result.
+
+test="unicode_start"

engine/tests/Functional.kbd/tests/unicode_start.sh line 15

Quoted 10 lines
engine/tests/Functional.kbd/tests/unicode_start.sh new file +10 -0
+
+expect <<-EOF
+spawn unicode_start
+expect {
+ "skipped" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }
+}
+EOF

There must be a way to check the Usage line for mapscrn besides using 'expect'. Please rework this to use 'grep', possibly saving to a temp file if needed. Using 'expect', when there is no interactive control of the program needed, is not the right approach.

Quoted 2 lines

--
1.8.3.1

Please remove these uses of 'expect' and resubmit.

Thanks,
-- Tim

#19 lore raw
Quoted 5 lines

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

Quoted 8 lines

hi Tim

Quoted 1 line

This is missing a description in the commit body. Please add something

about the kbd-related

Quoted 1 line

programs that are checked for and tested.

About this comment, my understanding is as follows, please confirm if it is correct or not:
1. in commit's information, need to add instructions about the kbd.

Yes. There should be something in the commit message body. You can put an overview of the type of things that are being tested, or list the different programs, or something like that.

Quoted 1 line

2. kbd-related programs are not enough, need to add more.

I'm not sure what you mean. But if you mean that just listing the programs is not enough, then yes. It would be nice to give an overview of the tests (e.g. "Most of these tests check that the test is executable, by getting the program's usage help. Some other sub-tests check that some basic text is output by the program.")

Quoted 2 lines

3. the tests of kbd-related programs are too simple, need to add some functional related tests.

That would be good. The current sub-tests are good for:
1) verifying that the binary program can be executed
2) showing that the most basic operation of the program is working (usage, or default output in simple case)

This is useful, but it would be more useful to actually perform some test of program functionality, for each command, like what is done in the tar and bind tests.

However, I will take this patch as is, with the modification to remove the use of expect where it is not needed.
-- Tim