* [Fuego] [PATCH] kbd: Add test cases for commands of kbd. @ 2018-10-09 6:43 Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] mcelog: Add test cases for command mcelog Wang Mingyu ` (6 more replies) 0 siblings, 7 replies; 20+ messages in thread From: Wang Mingyu @ 2018-10-09 6:43 UTC (permalink / raw) To: fuego Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> --- 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 diff --git a/engine/tests/Functional.kbd/fuego_test.sh b/engine/tests/Functional.kbd/fuego_test.sh new file mode 100644 index 0000000..fd5084f --- /dev/null +++ b/engine/tests/Functional.kbd/fuego_test.sh @@ -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" +} diff --git a/engine/tests/Functional.kbd/kbd_test.sh b/engine/tests/Functional.kbd/kbd_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/engine/tests/Functional.kbd/kbd_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/engine/tests/Functional.kbd/parser.py b/engine/tests/Functional.kbd/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.kbd/parser.py @@ -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)) diff --git a/engine/tests/Functional.kbd/spec.json b/engine/tests/Functional.kbd/spec.json new file mode 100644 index 0000000..0a85fef --- /dev/null +++ b/engine/tests/Functional.kbd/spec.json @@ -0,0 +1,6 @@ +{ + "testName": "Functional.kbd", + "specs": { + "default": {} + } +} diff --git a/engine/tests/Functional.kbd/tests/chvt.sh b/engine/tests/Functional.kbd/tests/chvt.sh new file mode 100644 index 0000000..7bdeaf0 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/chvt.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/deallocvt.sh b/engine/tests/Functional.kbd/tests/deallocvt.sh new file mode 100644 index 0000000..26bb2d0 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/deallocvt.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/dumpkeys1.sh b/engine/tests/Functional.kbd/tests/dumpkeys1.sh new file mode 100644 index 0000000..96e0d5c --- /dev/null +++ b/engine/tests/Functional.kbd/tests/dumpkeys1.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/dumpkeys2.sh b/engine/tests/Functional.kbd/tests/dumpkeys2.sh new file mode 100644 index 0000000..511a6bc --- /dev/null +++ b/engine/tests/Functional.kbd/tests/dumpkeys2.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/dumpkeys3.sh b/engine/tests/Functional.kbd/tests/dumpkeys3.sh new file mode 100644 index 0000000..e2db65a --- /dev/null +++ b/engine/tests/Functional.kbd/tests/dumpkeys3.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/fgconsole.sh b/engine/tests/Functional.kbd/tests/fgconsole.sh new file mode 100644 index 0000000..9fa4410 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/fgconsole.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/kbd_mode1.sh b/engine/tests/Functional.kbd/tests/kbd_mode1.sh new file mode 100644 index 0000000..d86c224 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/kbd_mode1.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/kbd_mode2.sh b/engine/tests/Functional.kbd/tests/kbd_mode2.sh new file mode 100644 index 0000000..6f43ae6 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/kbd_mode2.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/kbd_mode3.sh b/engine/tests/Functional.kbd/tests/kbd_mode3.sh new file mode 100644 index 0000000..bbb8f0b --- /dev/null +++ b/engine/tests/Functional.kbd/tests/kbd_mode3.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/kbd_mode4.sh b/engine/tests/Functional.kbd/tests/kbd_mode4.sh new file mode 100644 index 0000000..ce4132f --- /dev/null +++ b/engine/tests/Functional.kbd/tests/kbd_mode4.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/kbdrate1.sh b/engine/tests/Functional.kbd/tests/kbdrate1.sh new file mode 100644 index 0000000..a16150e --- /dev/null +++ b/engine/tests/Functional.kbd/tests/kbdrate1.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/kbdrate2.sh b/engine/tests/Functional.kbd/tests/kbdrate2.sh new file mode 100644 index 0000000..33d3b37 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/kbdrate2.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/loadkeys.sh b/engine/tests/Functional.kbd/tests/loadkeys.sh new file mode 100644 index 0000000..5458630 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/loadkeys.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/loadunimap.sh b/engine/tests/Functional.kbd/tests/loadunimap.sh new file mode 100644 index 0000000..ce2a24c --- /dev/null +++ b/engine/tests/Functional.kbd/tests/loadunimap.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/mapscrn.sh b/engine/tests/Functional.kbd/tests/mapscrn.sh new file mode 100644 index 0000000..5a9cfd5 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/mapscrn.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/openvt.sh b/engine/tests/Functional.kbd/tests/openvt.sh new file mode 100644 index 0000000..7a70dc6 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/openvt.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/psfaddtable.sh b/engine/tests/Functional.kbd/tests/psfaddtable.sh new file mode 100644 index 0000000..79449d2 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/psfaddtable.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/psfgettable.sh b/engine/tests/Functional.kbd/tests/psfgettable.sh new file mode 100644 index 0000000..4c8d201 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/psfgettable.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/psfxtable.sh b/engine/tests/Functional.kbd/tests/psfxtable.sh new file mode 100644 index 0000000..49e7316 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/psfxtable.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/resizecons.sh b/engine/tests/Functional.kbd/tests/resizecons.sh new file mode 100644 index 0000000..7002e6a --- /dev/null +++ b/engine/tests/Functional.kbd/tests/resizecons.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/setfont.sh b/engine/tests/Functional.kbd/tests/setfont.sh new file mode 100644 index 0000000..e97d504 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/setfont.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/setkeycodes.sh b/engine/tests/Functional.kbd/tests/setkeycodes.sh new file mode 100644 index 0000000..3300318 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/setkeycodes.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/setleds.sh b/engine/tests/Functional.kbd/tests/setleds.sh new file mode 100644 index 0000000..1d97700 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/setleds.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/showconsolefont.sh b/engine/tests/Functional.kbd/tests/showconsolefont.sh new file mode 100644 index 0000000..aadbeab --- /dev/null +++ b/engine/tests/Functional.kbd/tests/showconsolefont.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/showkey.sh b/engine/tests/Functional.kbd/tests/showkey.sh new file mode 100644 index 0000000..e064077 --- /dev/null +++ b/engine/tests/Functional.kbd/tests/showkey.sh @@ -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 diff --git a/engine/tests/Functional.kbd/tests/unicode_start.sh b/engine/tests/Functional.kbd/tests/unicode_start.sh new file mode 100644 index 0000000..6af7c2f --- /dev/null +++ b/engine/tests/Functional.kbd/tests/unicode_start.sh @@ -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 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Fuego] [PATCH] mcelog: Add test cases for command mcelog. 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu @ 2018-10-09 6:43 ` Wang Mingyu 2018-10-12 0:37 ` Tim.Bird 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot) Wang Mingyu ` (5 subsequent siblings) 6 siblings, 1 reply; 20+ messages in thread From: Wang Mingyu @ 2018-10-09 6:43 UTC (permalink / raw) To: fuego Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> --- 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 diff --git a/engine/tests/Functional.mcelog/fuego_test.sh b/engine/tests/Functional.mcelog/fuego_test.sh new file mode 100644 index 0000000..1950cb8 --- /dev/null +++ b/engine/tests/Functional.mcelog/fuego_test.sh @@ -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" +} diff --git a/engine/tests/Functional.mcelog/mcelog_test.sh b/engine/tests/Functional.mcelog/mcelog_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/engine/tests/Functional.mcelog/mcelog_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/engine/tests/Functional.mcelog/parser.py b/engine/tests/Functional.mcelog/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.mcelog/parser.py @@ -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)) diff --git a/engine/tests/Functional.mcelog/spec.json b/engine/tests/Functional.mcelog/spec.json new file mode 100644 index 0000000..2ccad89 --- /dev/null +++ b/engine/tests/Functional.mcelog/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.mcelog", + "specs": { + "default": {} + } +} + diff --git a/engine/tests/Functional.mcelog/tests/mcelog_01.sh b/engine/tests/Functional.mcelog/tests/mcelog_01.sh new file mode 100644 index 0000000..8276ebb --- /dev/null +++ b/engine/tests/Functional.mcelog/tests/mcelog_01.sh @@ -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 diff --git a/engine/tests/Functional.mcelog/tests/mcelog_02.sh b/engine/tests/Functional.mcelog/tests/mcelog_02.sh new file mode 100644 index 0000000..9a80ff9 --- /dev/null +++ b/engine/tests/Functional.mcelog/tests/mcelog_02.sh @@ -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 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] mcelog: Add test cases for command mcelog. 2018-10-09 6:43 ` [Fuego] [PATCH] mcelog: Add test cases for command mcelog Wang Mingyu @ 2018-10-12 0:37 ` Tim.Bird 0 siblings, 0 replies; 20+ messages in thread From: Tim.Bird @ 2018-10-12 0:37 UTC (permalink / raw) To: wangmy, fuego Applied. Thanks, -- Tim > -----Original Message----- > From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego- > bounces@lists.linuxfoundation.org] On Behalf Of Wang Mingyu > Sent: Monday, October 08, 2018 11:43 PM > To: fuego@lists.linuxfoundation.org > Subject: [Fuego] [PATCH] mcelog: Add test cases for command mcelog. > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > 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 > > diff --git a/engine/tests/Functional.mcelog/fuego_test.sh > b/engine/tests/Functional.mcelog/fuego_test.sh > new file mode 100644 > index 0000000..1950cb8 > --- /dev/null > +++ b/engine/tests/Functional.mcelog/fuego_test.sh > @@ -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" > +} > diff --git a/engine/tests/Functional.mcelog/mcelog_test.sh > b/engine/tests/Functional.mcelog/mcelog_test.sh > new file mode 100755 > index 0000000..dd5ce37 > --- /dev/null > +++ b/engine/tests/Functional.mcelog/mcelog_test.sh > @@ -0,0 +1,4 @@ > +#!/bin/sh > +for i in tests/*.sh; do > + sh $i > +done > diff --git a/engine/tests/Functional.mcelog/parser.py > b/engine/tests/Functional.mcelog/parser.py > new file mode 100644 > index 0000000..d85abd7 > --- /dev/null > +++ b/engine/tests/Functional.mcelog/parser.py > @@ -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)) > diff --git a/engine/tests/Functional.mcelog/spec.json > b/engine/tests/Functional.mcelog/spec.json > new file mode 100644 > index 0000000..2ccad89 > --- /dev/null > +++ b/engine/tests/Functional.mcelog/spec.json > @@ -0,0 +1,7 @@ > +{ > + "testName": "Functional.mcelog", > + "specs": { > + "default": {} > + } > +} > + > diff --git a/engine/tests/Functional.mcelog/tests/mcelog_01.sh > b/engine/tests/Functional.mcelog/tests/mcelog_01.sh > new file mode 100644 > index 0000000..8276ebb > --- /dev/null > +++ b/engine/tests/Functional.mcelog/tests/mcelog_01.sh > @@ -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 > diff --git a/engine/tests/Functional.mcelog/tests/mcelog_02.sh > b/engine/tests/Functional.mcelog/tests/mcelog_02.sh > new file mode 100644 > index 0000000..9a80ff9 > --- /dev/null > +++ b/engine/tests/Functional.mcelog/tests/mcelog_02.sh > @@ -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 > -- > 1.8.3.1 > > > > _______________________________________________ > Fuego mailing list > Fuego@lists.linuxfoundation.org > 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= ^ permalink raw reply [flat|nested] 20+ messages in thread
* [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot). 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] mcelog: Add test cases for command mcelog Wang Mingyu @ 2018-10-09 6:43 ` Wang Mingyu 2018-10-12 4:35 ` Tim.Bird 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(named) Wang Mingyu ` (4 subsequent siblings) 6 siblings, 1 reply; 20+ messages in thread From: Wang Mingyu @ 2018-10-09 6:43 UTC (permalink / raw) To: fuego Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> --- 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 diff --git a/engine/tests/Functional.bind/bind_test.sh b/engine/tests/Functional.bind/bind_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/engine/tests/Functional.bind/bind_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db b/engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db new file mode 100644 index 0000000..3100047 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db @@ -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. diff --git a/engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db b/engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db new file mode 100644 index 0000000..3100047 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db @@ -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. diff --git a/engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db b/engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db new file mode 100644 index 0000000..3100047 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db @@ -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. diff --git a/engine/tests/Functional.bind/data/bind9/fjelinux.com.db b/engine/tests/Functional.bind/data/bind9/fjelinux.com.db new file mode 100644 index 0000000..45d3d19 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/fjelinux.com.db @@ -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 diff --git a/engine/tests/Functional.bind/data/bind9/hosts b/engine/tests/Functional.bind/data/bind9/hosts new file mode 100644 index 0000000..c7b9f21 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/hosts @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 @@ -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 diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC new file mode 100644 index 0000000..02b6086 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 @@ -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 @@ -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 diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 new file mode 100644 index 0000000..7846fd5 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq @@ -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 diff --git a/engine/tests/Functional.bind/data/bind9/named b/engine/tests/Functional.bind/data/bind9/named new file mode 100644 index 0000000..82e6b6b --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/named @@ -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/named.conf b/engine/tests/Functional.bind/data/bind9/named.conf new file mode 100644 index 0000000..cbe9b3b --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/named.conf @@ -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"; diff --git a/engine/tests/Functional.bind/data/bind9/resolv.conf b/engine/tests/Functional.bind/data/bind9/resolv.conf new file mode 100644 index 0000000..e69de29 diff --git a/engine/tests/Functional.bind/data/bind9/rndc.conf b/engine/tests/Functional.bind/data/bind9/rndc.conf new file mode 100644 index 0000000..5e85bfa --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/rndc.conf @@ -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"; + diff --git a/engine/tests/Functional.bind/data/bind9/rndc.key b/engine/tests/Functional.bind/data/bind9/rndc.key new file mode 100644 index 0000000..aca0e86 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/rndc.key @@ -0,0 +1,4 @@ +key "rndckey" { + algorithm hmac-md5; + secret "mH48lXo3q1gxhMeeFxFJ9A=="; +}; diff --git a/engine/tests/Functional.bind/data/bind9/sysconfig/named b/engine/tests/Functional.bind/data/bind9/sysconfig/named new file mode 100644 index 0000000..82e6b6b --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/sysconfig/named @@ -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 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot @@ -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=/ diff --git a/engine/tests/Functional.bind/data/bind9/x86_64_named.conf b/engine/tests/Functional.bind/data/bind9/x86_64_named.conf new file mode 100644 index 0000000..8c76e30 --- /dev/null +++ b/engine/tests/Functional.bind/data/bind9/x86_64_named.conf @@ -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; }; +#}; diff --git a/engine/tests/Functional.bind/data/linux_test.com.db b/engine/tests/Functional.bind/data/linux_test.com.db new file mode 100644 index 0000000..7846fd5 --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db @@ -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/linux_test.com.db_24 b/engine/tests/Functional.bind/data/linux_test.com.db_24 new file mode 100644 index 0000000..02b6086 --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_24 @@ -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/linux_test.com.db_27 b/engine/tests/Functional.bind/data/linux_test.com.db_27 new file mode 100644 index 0000000..ca836b5 --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_27 @@ -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/linux_test.com.db_29 b/engine/tests/Functional.bind/data/linux_test.com.db_29 new file mode 100644 index 0000000..f4a8377 --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_29 @@ -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/linux_test.com.db_30 b/engine/tests/Functional.bind/data/linux_test.com.db_30 new file mode 100644 index 0000000..dc373bb --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_30 @@ -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 diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_31 b/engine/tests/Functional.bind/data/linux_test.com.db_31 new file mode 100644 index 0000000..f39f5fb --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_31 @@ -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/linux_test.com.db_34 b/engine/tests/Functional.bind/data/linux_test.com.db_34 new file mode 100644 index 0000000..9f942f2 --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_34 @@ -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/linux_test.com.db_36 b/engine/tests/Functional.bind/data/linux_test.com.db_36 new file mode 100644 index 0000000..d24501f --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_36 @@ -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 diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_38 b/engine/tests/Functional.bind/data/linux_test.com.db_38 new file mode 100644 index 0000000..880166b --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_38 @@ -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 diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_8 b/engine/tests/Functional.bind/data/linux_test.com.db_8 new file mode 100644 index 0000000..7846fd5 --- /dev/null +++ b/engine/tests/Functional.bind/data/linux_test.com.db_8 @@ -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/fuego_test.sh b/engine/tests/Functional.bind/fuego_test.sh new file mode 100644 index 0000000..7e4fa2d --- /dev/null +++ b/engine/tests/Functional.bind/fuego_test.sh @@ -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" +} diff --git a/engine/tests/Functional.bind/parser.py b/engine/tests/Functional.bind/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.bind/parser.py @@ -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)) diff --git a/engine/tests/Functional.bind/spec.json b/engine/tests/Functional.bind/spec.json new file mode 100644 index 0000000..00a56f9 --- /dev/null +++ b/engine/tests/Functional.bind/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.bind", + "specs": { + "default": {} + } +} + diff --git a/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh b/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh new file mode 100644 index 0000000..5a6fbb7 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh @@ -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. + +test="chroot_chkconf" + +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 /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 named-checkconf -t /var/named/chroot +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +rm -rf /var/named +mv /etc/sysconfig/named_bak /etc/sysconfig/named diff --git a/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh b/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh new file mode 100644 index 0000000..ccd261d --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh @@ -0,0 +1,112 @@ +#!/bin/sh + +# In the target start named chroot, and confirm that an IP address is pulled from the name. + +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 +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 /etc/bind/named.conf + chmod 644 /etc/bind/rndc.key /etc/bind/rndc.conf /etc/bind/named.conf +} + +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 diff --git a/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh b/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh new file mode 100644 index 0000000..bbeb981 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +# In the target start named chroot, and confirm that an IP address is pulled from the name. + +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 +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 +} + +named -t /var/named/chroot + +sleep 5 + +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 diff --git a/engine/tests/Functional.bind/tests/bind_chroot_lport.sh b/engine/tests/Functional.bind/tests/bind_chroot_lport.sh new file mode 100644 index 0000000..88456c0 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_lport.sh @@ -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 +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 +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 +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 +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 +} + +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 diff --git a/engine/tests/Functional.bind/tests/bind_chroot_pid.sh b/engine/tests/Functional.bind/tests/bind_chroot_pid.sh new file mode 100644 index 0000000..70f872b --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_pid.sh @@ -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 +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 +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 +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 +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 +} + +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 diff --git a/engine/tests/Functional.bind/tests/bind_chroot_ps.sh b/engine/tests/Functional.bind/tests/bind_chroot_ps.sh new file mode 100644 index 0000000..d99c3cb --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_ps.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# In the target start named chroot, and confirm the process condition by command ps. + +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 diff --git a/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh b/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh new file mode 100644 index 0000000..be1919d --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# Run the rndc-confgen command in the chroot environment to find the rndc.key file. + +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 diff --git a/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh b/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh new file mode 100644 index 0000000..195410f --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh @@ -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 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot). 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot) Wang Mingyu @ 2018-10-12 4:35 ` Tim.Bird 2018-10-13 4:59 ` Wang, Mingyu 0 siblings, 1 reply; 20+ messages in thread From: Tim.Bird @ 2018-10-12 4:35 UTC (permalink / raw) To: wangmy, fuego Comments and questions inline below... > -----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. > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > 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 > > diff --git a/engine/tests/Functional.bind/bind_test.sh > b/engine/tests/Functional.bind/bind_test.sh > new file mode 100755 > index 0000000..dd5ce37 > --- /dev/null > +++ b/engine/tests/Functional.bind/bind_test.sh > @@ -0,0 +1,4 @@ > +#!/bin/sh > +for i in tests/*.sh; do > + sh $i > +done > diff --git a/engine/tests/Functional.bind/data/bind9/0.168.192.in- > addr.arpa.db b/engine/tests/Functional.bind/data/bind9/0.168.192.in- > addr.arpa.db > new file mode 100644 > index 0000000..3100047 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db > @@ -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. > diff --git a/engine/tests/Functional.bind/data/bind9/20.24.10.in- > addr.arpa.db b/engine/tests/Functional.bind/data/bind9/20.24.10.in- > addr.arpa.db > new file mode 100644 > index 0000000..3100047 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db > @@ -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. > diff --git a/engine/tests/Functional.bind/data/bind9/246.168.192.in- > addr.arpa.db b/engine/tests/Functional.bind/data/bind9/246.168.192.in- > addr.arpa.db > new file mode 100644 > index 0000000..3100047 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db > @@ -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. > diff --git a/engine/tests/Functional.bind/data/bind9/fjelinux.com.db > b/engine/tests/Functional.bind/data/bind9/fjelinux.com.db > new file mode 100644 > index 0000000..45d3d19 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/fjelinux.com.db > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/hosts > b/engine/tests/Functional.bind/data/bind9/hosts > new file mode 100644 > index 0000000..c7b9f21 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/hosts > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC > b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC > new file mode 100644 > index 0000000..02b6086 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 > @@ -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 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 > b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 > new file mode 100644 > index 0000000..7846fd5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/named > b/engine/tests/Functional.bind/data/bind9/named > new file mode 100644 > index 0000000..82e6b6b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/named > @@ -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/named.conf > b/engine/tests/Functional.bind/data/bind9/named.conf > new file mode 100644 > index 0000000..cbe9b3b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/named.conf > @@ -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"; > diff --git a/engine/tests/Functional.bind/data/bind9/resolv.conf > b/engine/tests/Functional.bind/data/bind9/resolv.conf > new file mode 100644 > index 0000000..e69de29 > diff --git a/engine/tests/Functional.bind/data/bind9/rndc.conf > b/engine/tests/Functional.bind/data/bind9/rndc.conf > new file mode 100644 > index 0000000..5e85bfa > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/rndc.conf > @@ -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"; > + > diff --git a/engine/tests/Functional.bind/data/bind9/rndc.key > b/engine/tests/Functional.bind/data/bind9/rndc.key > new file mode 100644 > index 0000000..aca0e86 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/rndc.key > @@ -0,0 +1,4 @@ > +key "rndckey" { > + algorithm hmac-md5; > + secret "mH48lXo3q1gxhMeeFxFJ9A=="; > +}; > diff --git a/engine/tests/Functional.bind/data/bind9/sysconfig/named > b/engine/tests/Functional.bind/data/bind9/sysconfig/named > new file mode 100644 > index 0000000..82e6b6b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/sysconfig/named > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot > @@ -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=/ > diff --git a/engine/tests/Functional.bind/data/bind9/x86_64_named.conf > b/engine/tests/Functional.bind/data/bind9/x86_64_named.conf > new file mode 100644 > index 0000000..8c76e30 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/x86_64_named.conf > @@ -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; }; > +#}; > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db > b/engine/tests/Functional.bind/data/linux_test.com.db > new file mode 100644 > index 0000000..7846fd5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db > @@ -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/linux_test.com.db_24 > b/engine/tests/Functional.bind/data/linux_test.com.db_24 > new file mode 100644 > index 0000000..02b6086 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_24 > @@ -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. > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_27 > b/engine/tests/Functional.bind/data/linux_test.com.db_27 > new file mode 100644 > index 0000000..ca836b5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_27 > @@ -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/linux_test.com.db_29 > b/engine/tests/Functional.bind/data/linux_test.com.db_29 > new file mode 100644 > index 0000000..f4a8377 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_29 > @@ -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/linux_test.com.db_30 > b/engine/tests/Functional.bind/data/linux_test.com.db_30 > new file mode 100644 > index 0000000..dc373bb > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_30 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_31 > b/engine/tests/Functional.bind/data/linux_test.com.db_31 > new file mode 100644 > index 0000000..f39f5fb > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_31 > @@ -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/linux_test.com.db_34 > b/engine/tests/Functional.bind/data/linux_test.com.db_34 > new file mode 100644 > index 0000000..9f942f2 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_34 > @@ -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/linux_test.com.db_36 > b/engine/tests/Functional.bind/data/linux_test.com.db_36 > new file mode 100644 > index 0000000..d24501f > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_36 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_38 > b/engine/tests/Functional.bind/data/linux_test.com.db_38 > new file mode 100644 > index 0000000..880166b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_38 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_8 > b/engine/tests/Functional.bind/data/linux_test.com.db_8 > new file mode 100644 > index 0000000..7846fd5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_8 > @@ -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/fuego_test.sh > b/engine/tests/Functional.bind/fuego_test.sh > new file mode 100644 > index 0000000..7e4fa2d > --- /dev/null > +++ b/engine/tests/Functional.bind/fuego_test.sh > @@ -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" 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). > +} > + > +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;\ will this work on a board on any network? Or does the board being tested have to be on a 192.168.246 network? > + export test_target_conf=x86_64;\ > + export remotehost=$IPADDR;\ > + ./bind_test.sh" > +} > + > +function test_processing { > + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" > +} > diff --git a/engine/tests/Functional.bind/parser.py > b/engine/tests/Functional.bind/parser.py > new file mode 100644 > index 0000000..d85abd7 > --- /dev/null > +++ b/engine/tests/Functional.bind/parser.py > @@ -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)) > diff --git a/engine/tests/Functional.bind/spec.json > b/engine/tests/Functional.bind/spec.json > new file mode 100644 > index 0000000..00a56f9 > --- /dev/null > +++ b/engine/tests/Functional.bind/spec.json > @@ -0,0 +1,7 @@ > +{ > + "testName": "Functional.bind", > + "specs": { > + "default": {} > + } > +} > + > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh > b/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh > new file mode 100644 > index 0000000..5a6fbb7 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh > @@ -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. > + > +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. > + > +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 > + > +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. > +mv /etc/sysconfig/named_bak /etc/sysconfig/named > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh > b/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh > new file mode 100644 > index 0000000..ccd261d > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh > @@ -0,0 +1,112 @@ > +#!/bin/sh > + > +# In the target start named chroot, and confirm that an IP address is pulled > from the name. > + > +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 > +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 > /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. > + chmod 644 /etc/bind/rndc.key /etc/bind/rndc.conf > /etc/bind/named.conf > +} > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh > b/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh > new file mode 100644 > index 0000000..bbeb981 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh > @@ -0,0 +1,118 @@ > +#!/bin/sh > + > +# In the target start named chroot, and confirm that an IP address is pulled > from the name. > + > +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 > +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 > +} > + > +named -t /var/named/chroot > + > +sleep 5 > + > +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. > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_lport.sh > b/engine/tests/Functional.bind/tests/bind_chroot_lport.sh > new file mode 100644 > index 0000000..88456c0 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_lport.sh > @@ -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 > +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 > +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 > +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 > +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 > +} > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_pid.sh > b/engine/tests/Functional.bind/tests/bind_chroot_pid.sh > new file mode 100644 > index 0000000..70f872b > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_pid.sh > @@ -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 > +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 > +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 > +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 > +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 > +} > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_ps.sh > b/engine/tests/Functional.bind/tests/bind_chroot_ps.sh > new file mode 100644 > index 0000000..d99c3cb > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_ps.sh > @@ -0,0 +1,45 @@ > +#!/bin/sh > + > +# In the target start named chroot, and confirm the process condition by > command ps. > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh > b/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh > new file mode 100644 > index 0000000..be1919d > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh > @@ -0,0 +1,57 @@ > +#!/bin/sh > + > +# Run the rndc-confgen command in the chroot environment to find the > rndc.key file. > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh > b/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh > new file mode 100644 > index 0000000..195410f > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh > @@ -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 > -- > 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 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot). 2018-10-12 4:35 ` Tim.Bird @ 2018-10-13 4:59 ` Wang, Mingyu 2018-10-13 16:11 ` Tim.Bird 0 siblings, 1 reply; 20+ messages in thread From: Wang, Mingyu @ 2018-10-13 4:59 UTC (permalink / raw) To: Tim.Bird, fuego Hi Tim The answers to comment are as follows. > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_24 > @@ -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. > +} > + > +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;\ >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. >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. >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. >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. >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: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] Sent: Friday, October 12, 2018 12:35 PM To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; fuego@lists.linuxfoundation.org Subject: RE: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot). Comments and questions inline below... > -----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. > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > 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 > > diff --git a/engine/tests/Functional.bind/bind_test.sh > b/engine/tests/Functional.bind/bind_test.sh > new file mode 100755 > index 0000000..dd5ce37 > --- /dev/null > +++ b/engine/tests/Functional.bind/bind_test.sh > @@ -0,0 +1,4 @@ > +#!/bin/sh > +for i in tests/*.sh; do > + sh $i > +done > diff --git a/engine/tests/Functional.bind/data/bind9/0.168.192.in- > addr.arpa.db b/engine/tests/Functional.bind/data/bind9/0.168.192.in- > addr.arpa.db > new file mode 100644 > index 0000000..3100047 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/0.168.192.in-addr.arpa.db > @@ -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. > diff --git a/engine/tests/Functional.bind/data/bind9/20.24.10.in- > addr.arpa.db b/engine/tests/Functional.bind/data/bind9/20.24.10.in- > addr.arpa.db > new file mode 100644 > index 0000000..3100047 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/20.24.10.in-addr.arpa.db > @@ -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. > diff --git a/engine/tests/Functional.bind/data/bind9/246.168.192.in- > addr.arpa.db b/engine/tests/Functional.bind/data/bind9/246.168.192.in- > addr.arpa.db > new file mode 100644 > index 0000000..3100047 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/246.168.192.in-addr.arpa.db > @@ -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. > diff --git a/engine/tests/Functional.bind/data/bind9/fjelinux.com.db > b/engine/tests/Functional.bind/data/bind9/fjelinux.com.db > new file mode 100644 > index 0000000..45d3d19 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/fjelinux.com.db > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/hosts > b/engine/tests/Functional.bind/data/bind9/hosts > new file mode 100644 > index 0000000..c7b9f21 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/hosts > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_ARMV8 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC > b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC > new file mode 100644 > index 0000000..02b6086 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_MPC > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_fedora > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p1020 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p2020 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_p4080 > @@ -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 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 > b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 > new file mode 100644 > index 0000000..7846fd5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_x86_64 > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/linux_test.com.db_zunq > @@ -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 > diff --git a/engine/tests/Functional.bind/data/bind9/named > b/engine/tests/Functional.bind/data/bind9/named > new file mode 100644 > index 0000000..82e6b6b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/named > @@ -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/named.conf > b/engine/tests/Functional.bind/data/bind9/named.conf > new file mode 100644 > index 0000000..cbe9b3b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/named.conf > @@ -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"; > diff --git a/engine/tests/Functional.bind/data/bind9/resolv.conf > b/engine/tests/Functional.bind/data/bind9/resolv.conf > new file mode 100644 > index 0000000..e69de29 > diff --git a/engine/tests/Functional.bind/data/bind9/rndc.conf > b/engine/tests/Functional.bind/data/bind9/rndc.conf > new file mode 100644 > index 0000000..5e85bfa > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/rndc.conf > @@ -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"; > + > diff --git a/engine/tests/Functional.bind/data/bind9/rndc.key > b/engine/tests/Functional.bind/data/bind9/rndc.key > new file mode 100644 > index 0000000..aca0e86 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/rndc.key > @@ -0,0 +1,4 @@ > +key "rndckey" { > + algorithm hmac-md5; > + secret "mH48lXo3q1gxhMeeFxFJ9A=="; > +}; > diff --git a/engine/tests/Functional.bind/data/bind9/sysconfig/named > b/engine/tests/Functional.bind/data/bind9/sysconfig/named > new file mode 100644 > index 0000000..82e6b6b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/sysconfig/named > @@ -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 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/sysconfig/named.nochroot > @@ -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=/ > diff --git a/engine/tests/Functional.bind/data/bind9/x86_64_named.conf > b/engine/tests/Functional.bind/data/bind9/x86_64_named.conf > new file mode 100644 > index 0000000..8c76e30 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/bind9/x86_64_named.conf > @@ -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; }; > +#}; > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db > b/engine/tests/Functional.bind/data/linux_test.com.db > new file mode 100644 > index 0000000..7846fd5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db > @@ -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/linux_test.com.db_24 > b/engine/tests/Functional.bind/data/linux_test.com.db_24 > new file mode 100644 > index 0000000..02b6086 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_24 > @@ -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. > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_27 > b/engine/tests/Functional.bind/data/linux_test.com.db_27 > new file mode 100644 > index 0000000..ca836b5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_27 > @@ -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/linux_test.com.db_29 > b/engine/tests/Functional.bind/data/linux_test.com.db_29 > new file mode 100644 > index 0000000..f4a8377 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_29 > @@ -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/linux_test.com.db_30 > b/engine/tests/Functional.bind/data/linux_test.com.db_30 > new file mode 100644 > index 0000000..dc373bb > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_30 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_31 > b/engine/tests/Functional.bind/data/linux_test.com.db_31 > new file mode 100644 > index 0000000..f39f5fb > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_31 > @@ -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/linux_test.com.db_34 > b/engine/tests/Functional.bind/data/linux_test.com.db_34 > new file mode 100644 > index 0000000..9f942f2 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_34 > @@ -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/linux_test.com.db_36 > b/engine/tests/Functional.bind/data/linux_test.com.db_36 > new file mode 100644 > index 0000000..d24501f > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_36 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_38 > b/engine/tests/Functional.bind/data/linux_test.com.db_38 > new file mode 100644 > index 0000000..880166b > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_38 > @@ -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 > diff --git a/engine/tests/Functional.bind/data/linux_test.com.db_8 > b/engine/tests/Functional.bind/data/linux_test.com.db_8 > new file mode 100644 > index 0000000..7846fd5 > --- /dev/null > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_8 > @@ -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/fuego_test.sh > b/engine/tests/Functional.bind/fuego_test.sh > new file mode 100644 > index 0000000..7e4fa2d > --- /dev/null > +++ b/engine/tests/Functional.bind/fuego_test.sh > @@ -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" 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). > +} > + > +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;\ will this work on a board on any network? Or does the board being tested have to be on a 192.168.246 network? > + export test_target_conf=x86_64;\ > + export remotehost=$IPADDR;\ > + ./bind_test.sh" > +} > + > +function test_processing { > + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" > +} > diff --git a/engine/tests/Functional.bind/parser.py > b/engine/tests/Functional.bind/parser.py > new file mode 100644 > index 0000000..d85abd7 > --- /dev/null > +++ b/engine/tests/Functional.bind/parser.py > @@ -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)) > diff --git a/engine/tests/Functional.bind/spec.json > b/engine/tests/Functional.bind/spec.json > new file mode 100644 > index 0000000..00a56f9 > --- /dev/null > +++ b/engine/tests/Functional.bind/spec.json > @@ -0,0 +1,7 @@ > +{ > + "testName": "Functional.bind", > + "specs": { > + "default": {} > + } > +} > + > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh > b/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh > new file mode 100644 > index 0000000..5a6fbb7 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_chkconf.sh > @@ -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. > + > +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. > + > +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 > + > +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. > +mv /etc/sysconfig/named_bak /etc/sysconfig/named > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh > b/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh > new file mode 100644 > index 0000000..ccd261d > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_dig1.sh > @@ -0,0 +1,112 @@ > +#!/bin/sh > + > +# In the target start named chroot, and confirm that an IP address is pulled > from the name. > + > +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 > +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 > /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. > + chmod 644 /etc/bind/rndc.key /etc/bind/rndc.conf > /etc/bind/named.conf > +} > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh > b/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh > new file mode 100644 > index 0000000..bbeb981 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_dig2.sh > @@ -0,0 +1,118 @@ > +#!/bin/sh > + > +# In the target start named chroot, and confirm that an IP address is pulled > from the name. > + > +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 > +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 > +} > + > +named -t /var/named/chroot > + > +sleep 5 > + > +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. > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_lport.sh > b/engine/tests/Functional.bind/tests/bind_chroot_lport.sh > new file mode 100644 > index 0000000..88456c0 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_lport.sh > @@ -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 > +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 > +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 > +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 > +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 > +} > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_pid.sh > b/engine/tests/Functional.bind/tests/bind_chroot_pid.sh > new file mode 100644 > index 0000000..70f872b > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_pid.sh > @@ -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 > +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 > +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 > +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 > +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 > +} > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_ps.sh > b/engine/tests/Functional.bind/tests/bind_chroot_ps.sh > new file mode 100644 > index 0000000..d99c3cb > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_ps.sh > @@ -0,0 +1,45 @@ > +#!/bin/sh > + > +# In the target start named chroot, and confirm the process condition by > command ps. > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh > b/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh > new file mode 100644 > index 0000000..be1919d > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_rndc-confgen.sh > @@ -0,0 +1,57 @@ > +#!/bin/sh > + > +# Run the rndc-confgen command in the chroot environment to find the > rndc.key file. > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh > b/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh > new file mode 100644 > index 0000000..195410f > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_chroot_syslog-ng.sh > @@ -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 > -- > 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 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot). 2018-10-13 4:59 ` Wang, Mingyu @ 2018-10-13 16:11 ` Tim.Bird 0 siblings, 0 replies; 20+ messages in thread From: Tim.Bird @ 2018-10-13 16:11 UTC (permalink / raw) To: wangmy, fuego > -----Original Message----- > From: Wang, Mingyu > > Hi Tim > > The answers to comment are as follows. > > > +++ b/engine/tests/Functional.bind/data/linux_test.com.db_24 > > @@ -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. > > > +} > > + > > +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;\ > > >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. > > > >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. > > > >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. > > >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. > > > >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 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [Fuego] [PATCH] bind: Add test cases for commands of bind(named). 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] mcelog: Add test cases for command mcelog Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot) Wang Mingyu @ 2018-10-09 6:43 ` Wang Mingyu 2018-10-12 5:29 ` Tim.Bird 2018-10-09 6:43 ` [Fuego] [PATCH] lm_sensors: Add test cases for command lm_sensors Wang Mingyu ` (3 subsequent siblings) 6 siblings, 1 reply; 20+ messages in thread From: Wang Mingyu @ 2018-10-09 6:43 UTC (permalink / raw) To: fuego Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> --- .../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 diff --git a/engine/tests/Functional.bind/tests/bind_named_chkconf.sh b/engine/tests/Functional.bind/tests/bind_named_chkconf.sh new file mode 100644 index 0000000..7914e0d --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_chkconf.sh @@ -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 diff --git a/engine/tests/Functional.bind/tests/bind_named_chkzone1.sh b/engine/tests/Functional.bind/tests/bind_named_chkzone1.sh new file mode 100644 index 0000000..40a6387 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_chkzone1.sh @@ -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 diff --git a/engine/tests/Functional.bind/tests/bind_named_chkzone2.sh b/engine/tests/Functional.bind/tests/bind_named_chkzone2.sh new file mode 100644 index 0000000..6a3da22 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_chkzone2.sh @@ -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 diff --git a/engine/tests/Functional.bind/tests/bind_named_dig1.sh b/engine/tests/Functional.bind/tests/bind_named_dig1.sh new file mode 100644 index 0000000..8cbbdb1 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_dig1.sh @@ -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 +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" +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 +mv /etc/hosts_bak /etc/hosts diff --git a/engine/tests/Functional.bind/tests/bind_named_dig2.sh b/engine/tests/Functional.bind/tests/bind_named_dig2.sh new file mode 100644 index 0000000..1259f3e --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_dig2.sh @@ -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 +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 + +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 diff --git a/engine/tests/Functional.bind/tests/bind_named_lport.sh b/engine/tests/Functional.bind/tests/bind_named_lport.sh new file mode 100644 index 0000000..0a171a6 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_lport.sh @@ -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 diff --git a/engine/tests/Functional.bind/tests/bind_named_pidfile.sh b/engine/tests/Functional.bind/tests/bind_named_pidfile.sh new file mode 100644 index 0000000..be2fc89 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_pidfile.sh @@ -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 diff --git a/engine/tests/Functional.bind/tests/bind_named_ps.sh b/engine/tests/Functional.bind/tests/bind_named_ps.sh new file mode 100644 index 0000000..cd5fcc0 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_ps.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +# In the target start bind, and confirm the process condition by command ps. + +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 diff --git a/engine/tests/Functional.bind/tests/bind_named_syslog.sh b/engine/tests/Functional.bind/tests/bind_named_syslog.sh new file mode 100644 index 0000000..0b7c690 --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_named_syslog.sh @@ -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 + diff --git a/engine/tests/Functional.bind/tests/bind_rndc-confgen.sh b/engine/tests/Functional.bind/tests/bind_rndc-confgen.sh new file mode 100644 index 0000000..adc38ca --- /dev/null +++ b/engine/tests/Functional.bind/tests/bind_rndc-confgen.sh @@ -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 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] bind: Add test cases for commands of bind(named). 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(named) Wang Mingyu @ 2018-10-12 5:29 ` Tim.Bird 0 siblings, 0 replies; 20+ messages in thread From: Tim.Bird @ 2018-10-12 5:29 UTC (permalink / raw) To: wangmy, fuego Comments and questions inline below. > -----Original Message----- > From: Wang Mingyu Missing description in commit message body. Please add these in the future. > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > .../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 > > diff --git a/engine/tests/Functional.bind/tests/bind_named_chkconf.sh > b/engine/tests/Functional.bind/tests/bind_named_chkconf.sh > new file mode 100644 > index 0000000..7914e0d > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_chkconf.sh > @@ -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 We stop named, but don't restart it. We should leave the machine in the same state we found it in. > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_named_chkzone1.sh > b/engine/tests/Functional.bind/tests/bind_named_chkzone1.sh > new file mode 100644 > index 0000000..40a6387 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_chkzone1.sh > @@ -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 > diff --git a/engine/tests/Functional.bind/tests/bind_named_chkzone2.sh > b/engine/tests/Functional.bind/tests/bind_named_chkzone2.sh > new file mode 100644 > index 0000000..6a3da22 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_chkzone2.sh > @@ -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 > diff --git a/engine/tests/Functional.bind/tests/bind_named_dig1.sh > b/engine/tests/Functional.bind/tests/bind_named_dig1.sh > new file mode 100644 > index 0000000..8cbbdb1 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_dig1.sh > @@ -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 > +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" > +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. > +mv /etc/hosts_bak /etc/hosts > diff --git a/engine/tests/Functional.bind/tests/bind_named_dig2.sh > b/engine/tests/Functional.bind/tests/bind_named_dig2.sh > new file mode 100644 > index 0000000..1259f3e > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_dig2.sh > @@ -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 > +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 > + > +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? > diff --git a/engine/tests/Functional.bind/tests/bind_named_lport.sh > b/engine/tests/Functional.bind/tests/bind_named_lport.sh > new file mode 100644 > index 0000000..0a171a6 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_lport.sh > @@ -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 > diff --git a/engine/tests/Functional.bind/tests/bind_named_pidfile.sh > b/engine/tests/Functional.bind/tests/bind_named_pidfile.sh > new file mode 100644 > index 0000000..be2fc89 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_pidfile.sh > @@ -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 > diff --git a/engine/tests/Functional.bind/tests/bind_named_ps.sh > b/engine/tests/Functional.bind/tests/bind_named_ps.sh > new file mode 100644 > index 0000000..cd5fcc0 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_ps.sh > @@ -0,0 +1,41 @@ > +#!/bin/sh > + > +# In the target start bind, and confirm the process condition by command > ps. > + > +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 > diff --git a/engine/tests/Functional.bind/tests/bind_named_syslog.sh > b/engine/tests/Functional.bind/tests/bind_named_syslog.sh > new file mode 100644 > index 0000000..0b7c690 > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_named_syslog.sh > @@ -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 > + > diff --git a/engine/tests/Functional.bind/tests/bind_rndc-confgen.sh > b/engine/tests/Functional.bind/tests/bind_rndc-confgen.sh > new file mode 100644 > index 0000000..adc38ca > --- /dev/null > +++ b/engine/tests/Functional.bind/tests/bind_rndc-confgen.sh > @@ -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 > -- > 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 ^ permalink raw reply [flat|nested] 20+ messages in thread
* [Fuego] [PATCH] lm_sensors: Add test cases for command lm_sensors. 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu ` (2 preceding siblings ...) 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(named) Wang Mingyu @ 2018-10-09 6:43 ` Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] atmtcp: Add test cases for command atmtcp Wang Mingyu ` (2 subsequent siblings) 6 siblings, 0 replies; 20+ messages in thread From: Wang Mingyu @ 2018-10-09 6:43 UTC (permalink / raw) To: fuego Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> --- 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 diff --git a/engine/tests/Functional.lm_sensors/fuego_test.sh b/engine/tests/Functional.lm_sensors/fuego_test.sh new file mode 100644 index 0000000..e48d012 --- /dev/null +++ b/engine/tests/Functional.lm_sensors/fuego_test.sh @@ -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" +} diff --git a/engine/tests/Functional.lm_sensors/lm_sensors_test.sh b/engine/tests/Functional.lm_sensors/lm_sensors_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/engine/tests/Functional.lm_sensors/lm_sensors_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/engine/tests/Functional.lm_sensors/parser.py b/engine/tests/Functional.lm_sensors/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.lm_sensors/parser.py @@ -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)) diff --git a/engine/tests/Functional.lm_sensors/spec.json b/engine/tests/Functional.lm_sensors/spec.json new file mode 100644 index 0000000..f1d295e --- /dev/null +++ b/engine/tests/Functional.lm_sensors/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.lm_sensors", + "specs": { + "default": {} + } +} + diff --git a/engine/tests/Functional.lm_sensors/tests/lm_sensors_detect.sh b/engine/tests/Functional.lm_sensors/tests/lm_sensors_detect.sh new file mode 100644 index 0000000..bd753a8 --- /dev/null +++ b/engine/tests/Functional.lm_sensors/tests/lm_sensors_detect.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +# In target, run command sensors-detect to scan hardware monitoring chips, or sensors. +# option: none + +test="sensors-detect" + +flag=0 + +expect <<-EOF +spawn sensors-detect +expect { + -re ".*YES/no.*" { + exp_send "\r" + exp_continue + } + -re ".*YES/no/selectively.*" { + exp_send "\r" + exp_continue + } + -re ".*yes/NO/selectively.*" { + exp_send "\r" + exp_continue + } + -re ".*yes/NO.*" { + exp_send "\r" + exp_continue + } + -re ".*Just press ENTER to continue.*" { + exp_send "\r" + exp_continue + } + -re ".*root # " { + exp_send "\r" + if { $flag=0 } { + flag=1 + exp_continue + } + } + timeout { + exp_send "\003\r" + } +} +EOF + +if sensors | grep "Adapter" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; + +expect <<-EOF +spawn ssh 192.168.246.61 +expect { + ".*yes/no.*" {send "yes\r"; exp_continue} + ".*password.*" {send "123456\r"} +} +expect eof +EOF + diff --git a/engine/tests/Functional.lm_sensors/tests/lm_sensors_help.sh b/engine/tests/Functional.lm_sensors/tests/lm_sensors_help.sh new file mode 100644 index 0000000..7c27cbb --- /dev/null +++ b/engine/tests/Functional.lm_sensors/tests/lm_sensors_help.sh @@ -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; -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Fuego] [PATCH] atmtcp: Add test cases for command atmtcp. 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu ` (3 preceding siblings ...) 2018-10-09 6:43 ` [Fuego] [PATCH] lm_sensors: Add test cases for command lm_sensors Wang Mingyu @ 2018-10-09 6:43 ` Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] dovecot: fix test of logfile and ps Wang Mingyu 2018-10-12 0:33 ` [Fuego] [PATCH] kbd: Add test cases for commands of kbd Tim.Bird 6 siblings, 0 replies; 20+ messages in thread From: Wang Mingyu @ 2018-10-09 6:43 UTC (permalink / raw) To: fuego Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> --- 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 diff --git a/engine/tests/Functional.atmtcp/atmtcp_test.sh b/engine/tests/Functional.atmtcp/atmtcp_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/engine/tests/Functional.atmtcp/atmtcp_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/engine/tests/Functional.atmtcp/fuego_test.sh b/engine/tests/Functional.atmtcp/fuego_test.sh new file mode 100644 index 0000000..229c506 --- /dev/null +++ b/engine/tests/Functional.atmtcp/fuego_test.sh @@ -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" +} diff --git a/engine/tests/Functional.atmtcp/parser.py b/engine/tests/Functional.atmtcp/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.atmtcp/parser.py @@ -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)) diff --git a/engine/tests/Functional.atmtcp/spec.json b/engine/tests/Functional.atmtcp/spec.json new file mode 100644 index 0000000..aff88cd --- /dev/null +++ b/engine/tests/Functional.atmtcp/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.atmtcp", + "specs": { + "default": {} + } +} + diff --git a/engine/tests/Functional.atmtcp/tests/atmtcp_help.sh b/engine/tests/Functional.atmtcp/tests/atmtcp_help.sh new file mode 100644 index 0000000..e019355 --- /dev/null +++ b/engine/tests/Functional.atmtcp/tests/atmtcp_help.sh @@ -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 diff --git a/engine/tests/Functional.atmtcp/tests/atmtcp_virtual.sh b/engine/tests/Functional.atmtcp/tests/atmtcp_virtual.sh new file mode 100644 index 0000000..8b7c55d --- /dev/null +++ b/engine/tests/Functional.atmtcp/tests/atmtcp_virtual.sh @@ -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 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* [Fuego] [PATCH] dovecot: fix test of logfile and ps. 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu ` (4 preceding siblings ...) 2018-10-09 6:43 ` [Fuego] [PATCH] atmtcp: Add test cases for command atmtcp Wang Mingyu @ 2018-10-09 6:43 ` Wang Mingyu 2018-10-09 18:41 ` Tim.Bird 2018-10-12 0:33 ` [Fuego] [PATCH] kbd: Add test cases for commands of kbd Tim.Bird 6 siblings, 1 reply; 20+ messages in thread From: Wang Mingyu @ 2018-10-09 6:43 UTC (permalink / raw) To: fuego Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> --- 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 --- a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh +++ b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh @@ -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" diff --git a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh index 2c627bb..0585cf2 100644 --- a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh +++ b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh @@ -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 -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps. 2018-10-09 6:43 ` [Fuego] [PATCH] dovecot: fix test of logfile and ps Wang Mingyu @ 2018-10-09 18:41 ` Tim.Bird 2018-10-10 3:17 ` Wang, Mingyu 0 siblings, 1 reply; 20+ messages in thread From: Tim.Bird @ 2018-10-09 18:41 UTC (permalink / raw) To: wangmy, fuego Question inline below. > -----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. > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > 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 > --- a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > +++ b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > @@ -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 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. > > 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" > diff --git a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > index 2c627bb..0585cf2 100644 > --- a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > +++ b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > @@ -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? > 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 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps. 2018-10-09 18:41 ` Tim.Bird @ 2018-10-10 3:17 ` Wang, Mingyu 2018-10-10 3:34 ` Tim.Bird 0 siblings, 1 reply; 20+ messages in thread From: Wang, Mingyu @ 2018-10-10 3:17 UTC (permalink / raw) To: Tim.Bird, fuego Hi Tim >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. >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: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] Sent: Wednesday, October 10, 2018 2:42 AM To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; fuego@lists.linuxfoundation.org Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps. Question inline below. > -----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. > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > 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 > --- a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > +++ b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > @@ -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 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. > > 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" > diff --git a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > index 2c627bb..0585cf2 100644 > --- a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > +++ b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > @@ -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? > 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 ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps. 2018-10-10 3:17 ` Wang, Mingyu @ 2018-10-10 3:34 ` Tim.Bird 2018-10-10 8:49 ` Wang, Mingyu 0 siblings, 1 reply; 20+ messages in thread From: Tim.Bird @ 2018-10-10 3:34 UTC (permalink / raw) To: wangmy, fuego > -----Original Message----- > From: Wang, Mingyu > > Hi Tim > > >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. 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. > > >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. 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 > > by Wangmy > > > -----Original Message----- > From: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] > Sent: Wednesday, October 10, 2018 2:42 AM > To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; > fuego@lists.linuxfoundation.org > Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps. > > Question inline below. > > > -----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. > > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > > --- > > 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 > > --- a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > > +++ b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > > @@ -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 > 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. > > > > > 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" > > diff --git a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > index 2c627bb..0585cf2 100644 > > --- a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > +++ b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > @@ -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? > > > 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 > > > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps. 2018-10-10 3:34 ` Tim.Bird @ 2018-10-10 8:49 ` Wang, Mingyu 2018-10-10 18:00 ` Tim.Bird 0 siblings, 1 reply; 20+ messages in thread From: Wang, Mingyu @ 2018-10-10 8:49 UTC (permalink / raw) To: Tim.Bird, fuego Hi Tim >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: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] Sent: Wednesday, October 10, 2018 11:34 AM To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; fuego@lists.linuxfoundation.org Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps. > -----Original Message----- > From: Wang, Mingyu > > Hi Tim > > >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. 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. > > >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. 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 > > by Wangmy > > > -----Original Message----- > From: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] > Sent: Wednesday, October 10, 2018 2:42 AM > To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; > fuego@lists.linuxfoundation.org > Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps. > > Question inline below. > > > -----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. > > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > > --- > > 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 > > --- a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > > +++ b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > > @@ -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 > 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. > > > > > 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" > > diff --git a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > index 2c627bb..0585cf2 100644 > > --- a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > +++ b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > @@ -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? > > > 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 > > > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] dovecot: fix test of logfile and ps. 2018-10-10 8:49 ` Wang, Mingyu @ 2018-10-10 18:00 ` Tim.Bird 0 siblings, 0 replies; 20+ messages in thread From: Tim.Bird @ 2018-10-10 18:00 UTC (permalink / raw) To: wangmy, fuego > -----Original Message----- > From: Wang, Mingyu > > Hi Tim > > >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 . That sounds like a good approach. Please do that and re-submit the patch. Thanks, -- Tim > -----Original Message----- > From: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] > Sent: Wednesday, October 10, 2018 11:34 AM > To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; > fuego@lists.linuxfoundation.org > Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps. > > > -----Original Message----- > > From: Wang, Mingyu > > > > Hi Tim > > > > >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. > > 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. > > > > > >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. > > 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 > > > > > by Wangmy > > > > > > -----Original Message----- > > From: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] > > Sent: Wednesday, October 10, 2018 2:42 AM > > To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; > > fuego@lists.linuxfoundation.org > > Subject: RE: [Fuego] [PATCH] dovecot: fix test of logfile and ps. > > > > Question inline below. > > > > > -----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. > > > > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > > > --- > > > 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 > > > --- a/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > > > +++ b/engine/tests/Functional.dovecot/tests/dovecot_logfile.sh > > > @@ -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 > > 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. > > > > > > > > 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" > > > diff --git a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > > b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > > index 2c627bb..0585cf2 100644 > > > --- a/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > > +++ b/engine/tests/Functional.dovecot/tests/dovecot_ps.sh > > > @@ -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? > > > > > 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 > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] kbd: Add test cases for commands of kbd. 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu ` (5 preceding siblings ...) 2018-10-09 6:43 ` [Fuego] [PATCH] dovecot: fix test of logfile and ps Wang Mingyu @ 2018-10-12 0:33 ` Tim.Bird 2018-10-12 3:15 ` Wang, Mingyu 6 siblings, 1 reply; 20+ messages in thread From: Tim.Bird @ 2018-10-12 0:33 UTC (permalink / raw) To: wangmy, fuego See comments inline below. > -----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. > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > 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 > > diff --git a/engine/tests/Functional.kbd/fuego_test.sh > b/engine/tests/Functional.kbd/fuego_test.sh > new file mode 100644 > index 0000000..fd5084f > --- /dev/null > +++ b/engine/tests/Functional.kbd/fuego_test.sh > @@ -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" '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. > +} > + > +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" > +} > diff --git a/engine/tests/Functional.kbd/kbd_test.sh > b/engine/tests/Functional.kbd/kbd_test.sh > new file mode 100755 > index 0000000..dd5ce37 > --- /dev/null > +++ b/engine/tests/Functional.kbd/kbd_test.sh > @@ -0,0 +1,4 @@ > +#!/bin/sh > +for i in tests/*.sh; do > + sh $i > +done > diff --git a/engine/tests/Functional.kbd/parser.py > b/engine/tests/Functional.kbd/parser.py > new file mode 100644 > index 0000000..d85abd7 > --- /dev/null > +++ b/engine/tests/Functional.kbd/parser.py > @@ -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)) > diff --git a/engine/tests/Functional.kbd/spec.json > b/engine/tests/Functional.kbd/spec.json > new file mode 100644 > index 0000000..0a85fef > --- /dev/null > +++ b/engine/tests/Functional.kbd/spec.json > @@ -0,0 +1,6 @@ > +{ > + "testName": "Functional.kbd", > + "specs": { > + "default": {} > + } > +} > diff --git a/engine/tests/Functional.kbd/tests/chvt.sh > b/engine/tests/Functional.kbd/tests/chvt.sh > new file mode 100644 > index 0000000..7bdeaf0 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/chvt.sh > @@ -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!! > + 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 > diff --git a/engine/tests/Functional.kbd/tests/deallocvt.sh > b/engine/tests/Functional.kbd/tests/deallocvt.sh > new file mode 100644 > index 0000000..26bb2d0 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/deallocvt.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/dumpkeys1.sh > b/engine/tests/Functional.kbd/tests/dumpkeys1.sh > new file mode 100644 > index 0000000..96e0d5c > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/dumpkeys1.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/dumpkeys2.sh > b/engine/tests/Functional.kbd/tests/dumpkeys2.sh > new file mode 100644 > index 0000000..511a6bc > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/dumpkeys2.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/dumpkeys3.sh > b/engine/tests/Functional.kbd/tests/dumpkeys3.sh > new file mode 100644 > index 0000000..e2db65a > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/dumpkeys3.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/fgconsole.sh > b/engine/tests/Functional.kbd/tests/fgconsole.sh > new file mode 100644 > index 0000000..9fa4410 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/fgconsole.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode1.sh > b/engine/tests/Functional.kbd/tests/kbd_mode1.sh > new file mode 100644 > index 0000000..d86c224 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode1.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode2.sh > b/engine/tests/Functional.kbd/tests/kbd_mode2.sh > new file mode 100644 > index 0000000..6f43ae6 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode2.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode3.sh > b/engine/tests/Functional.kbd/tests/kbd_mode3.sh > new file mode 100644 > index 0000000..bbb8f0b > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode3.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode4.sh > b/engine/tests/Functional.kbd/tests/kbd_mode4.sh > new file mode 100644 > index 0000000..ce4132f > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode4.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbdrate1.sh > b/engine/tests/Functional.kbd/tests/kbdrate1.sh > new file mode 100644 > index 0000000..a16150e > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbdrate1.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbdrate2.sh > b/engine/tests/Functional.kbd/tests/kbdrate2.sh > new file mode 100644 > index 0000000..33d3b37 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbdrate2.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/loadkeys.sh > b/engine/tests/Functional.kbd/tests/loadkeys.sh > new file mode 100644 > index 0000000..5458630 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/loadkeys.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/loadunimap.sh > b/engine/tests/Functional.kbd/tests/loadunimap.sh > new file mode 100644 > index 0000000..ce2a24c > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/loadunimap.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/mapscrn.sh > b/engine/tests/Functional.kbd/tests/mapscrn.sh > new file mode 100644 > index 0000000..5a9cfd5 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/mapscrn.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/openvt.sh > b/engine/tests/Functional.kbd/tests/openvt.sh > new file mode 100644 > index 0000000..7a70dc6 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/openvt.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/psfaddtable.sh > b/engine/tests/Functional.kbd/tests/psfaddtable.sh > new file mode 100644 > index 0000000..79449d2 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/psfaddtable.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/psfgettable.sh > b/engine/tests/Functional.kbd/tests/psfgettable.sh > new file mode 100644 > index 0000000..4c8d201 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/psfgettable.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/psfxtable.sh > b/engine/tests/Functional.kbd/tests/psfxtable.sh > new file mode 100644 > index 0000000..49e7316 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/psfxtable.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/resizecons.sh > b/engine/tests/Functional.kbd/tests/resizecons.sh > new file mode 100644 > index 0000000..7002e6a > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/resizecons.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/setfont.sh > b/engine/tests/Functional.kbd/tests/setfont.sh > new file mode 100644 > index 0000000..e97d504 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/setfont.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/setkeycodes.sh > b/engine/tests/Functional.kbd/tests/setkeycodes.sh > new file mode 100644 > index 0000000..3300318 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/setkeycodes.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/setleds.sh > b/engine/tests/Functional.kbd/tests/setleds.sh > new file mode 100644 > index 0000000..1d97700 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/setleds.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/showconsolefont.sh > b/engine/tests/Functional.kbd/tests/showconsolefont.sh > new file mode 100644 > index 0000000..aadbeab > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/showconsolefont.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/showkey.sh > b/engine/tests/Functional.kbd/tests/showkey.sh > new file mode 100644 > index 0000000..e064077 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/showkey.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/unicode_start.sh > b/engine/tests/Functional.kbd/tests/unicode_start.sh > new file mode 100644 > index 0000000..6af7c2f > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/unicode_start.sh > @@ -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 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. > -- > 1.8.3.1 Please remove these uses of 'expect' and resubmit. Thanks, -- Tim ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] kbd: Add test cases for commands of kbd. 2018-10-12 0:33 ` [Fuego] [PATCH] kbd: Add test cases for commands of kbd Tim.Bird @ 2018-10-12 3:15 ` Wang, Mingyu 2018-10-12 3:50 ` Tim.Bird 0 siblings, 1 reply; 20+ messages in thread From: Wang, Mingyu @ 2018-10-12 3:15 UTC (permalink / raw) To: Tim.Bird, fuego hi Tim >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: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] Sent: Friday, October 12, 2018 8:34 AM To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; fuego@lists.linuxfoundation.org Subject: RE: [Fuego] [PATCH] kbd: Add test cases for commands of kbd. See comments inline below. > -----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. > > Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com> > --- > 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 > > diff --git a/engine/tests/Functional.kbd/fuego_test.sh > b/engine/tests/Functional.kbd/fuego_test.sh > new file mode 100644 > index 0000000..fd5084f > --- /dev/null > +++ b/engine/tests/Functional.kbd/fuego_test.sh > @@ -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" '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. > +} > + > +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" > +} > diff --git a/engine/tests/Functional.kbd/kbd_test.sh > b/engine/tests/Functional.kbd/kbd_test.sh > new file mode 100755 > index 0000000..dd5ce37 > --- /dev/null > +++ b/engine/tests/Functional.kbd/kbd_test.sh > @@ -0,0 +1,4 @@ > +#!/bin/sh > +for i in tests/*.sh; do > + sh $i > +done > diff --git a/engine/tests/Functional.kbd/parser.py > b/engine/tests/Functional.kbd/parser.py > new file mode 100644 > index 0000000..d85abd7 > --- /dev/null > +++ b/engine/tests/Functional.kbd/parser.py > @@ -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)) > diff --git a/engine/tests/Functional.kbd/spec.json > b/engine/tests/Functional.kbd/spec.json > new file mode 100644 > index 0000000..0a85fef > --- /dev/null > +++ b/engine/tests/Functional.kbd/spec.json > @@ -0,0 +1,6 @@ > +{ > + "testName": "Functional.kbd", > + "specs": { > + "default": {} > + } > +} > diff --git a/engine/tests/Functional.kbd/tests/chvt.sh > b/engine/tests/Functional.kbd/tests/chvt.sh > new file mode 100644 > index 0000000..7bdeaf0 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/chvt.sh > @@ -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!! > + 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 > diff --git a/engine/tests/Functional.kbd/tests/deallocvt.sh > b/engine/tests/Functional.kbd/tests/deallocvt.sh > new file mode 100644 > index 0000000..26bb2d0 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/deallocvt.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/dumpkeys1.sh > b/engine/tests/Functional.kbd/tests/dumpkeys1.sh > new file mode 100644 > index 0000000..96e0d5c > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/dumpkeys1.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/dumpkeys2.sh > b/engine/tests/Functional.kbd/tests/dumpkeys2.sh > new file mode 100644 > index 0000000..511a6bc > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/dumpkeys2.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/dumpkeys3.sh > b/engine/tests/Functional.kbd/tests/dumpkeys3.sh > new file mode 100644 > index 0000000..e2db65a > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/dumpkeys3.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/fgconsole.sh > b/engine/tests/Functional.kbd/tests/fgconsole.sh > new file mode 100644 > index 0000000..9fa4410 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/fgconsole.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode1.sh > b/engine/tests/Functional.kbd/tests/kbd_mode1.sh > new file mode 100644 > index 0000000..d86c224 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode1.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode2.sh > b/engine/tests/Functional.kbd/tests/kbd_mode2.sh > new file mode 100644 > index 0000000..6f43ae6 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode2.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode3.sh > b/engine/tests/Functional.kbd/tests/kbd_mode3.sh > new file mode 100644 > index 0000000..bbb8f0b > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode3.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbd_mode4.sh > b/engine/tests/Functional.kbd/tests/kbd_mode4.sh > new file mode 100644 > index 0000000..ce4132f > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbd_mode4.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbdrate1.sh > b/engine/tests/Functional.kbd/tests/kbdrate1.sh > new file mode 100644 > index 0000000..a16150e > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbdrate1.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/kbdrate2.sh > b/engine/tests/Functional.kbd/tests/kbdrate2.sh > new file mode 100644 > index 0000000..33d3b37 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/kbdrate2.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/loadkeys.sh > b/engine/tests/Functional.kbd/tests/loadkeys.sh > new file mode 100644 > index 0000000..5458630 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/loadkeys.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/loadunimap.sh > b/engine/tests/Functional.kbd/tests/loadunimap.sh > new file mode 100644 > index 0000000..ce2a24c > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/loadunimap.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/mapscrn.sh > b/engine/tests/Functional.kbd/tests/mapscrn.sh > new file mode 100644 > index 0000000..5a9cfd5 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/mapscrn.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/openvt.sh > b/engine/tests/Functional.kbd/tests/openvt.sh > new file mode 100644 > index 0000000..7a70dc6 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/openvt.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/psfaddtable.sh > b/engine/tests/Functional.kbd/tests/psfaddtable.sh > new file mode 100644 > index 0000000..79449d2 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/psfaddtable.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/psfgettable.sh > b/engine/tests/Functional.kbd/tests/psfgettable.sh > new file mode 100644 > index 0000000..4c8d201 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/psfgettable.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/psfxtable.sh > b/engine/tests/Functional.kbd/tests/psfxtable.sh > new file mode 100644 > index 0000000..49e7316 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/psfxtable.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/resizecons.sh > b/engine/tests/Functional.kbd/tests/resizecons.sh > new file mode 100644 > index 0000000..7002e6a > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/resizecons.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/setfont.sh > b/engine/tests/Functional.kbd/tests/setfont.sh > new file mode 100644 > index 0000000..e97d504 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/setfont.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/setkeycodes.sh > b/engine/tests/Functional.kbd/tests/setkeycodes.sh > new file mode 100644 > index 0000000..3300318 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/setkeycodes.sh > @@ -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 ditto > diff --git a/engine/tests/Functional.kbd/tests/setleds.sh > b/engine/tests/Functional.kbd/tests/setleds.sh > new file mode 100644 > index 0000000..1d97700 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/setleds.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/showconsolefont.sh > b/engine/tests/Functional.kbd/tests/showconsolefont.sh > new file mode 100644 > index 0000000..aadbeab > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/showconsolefont.sh > @@ -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 > diff --git a/engine/tests/Functional.kbd/tests/showkey.sh > b/engine/tests/Functional.kbd/tests/showkey.sh > new file mode 100644 > index 0000000..e064077 > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/showkey.sh > @@ -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 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. > diff --git a/engine/tests/Functional.kbd/tests/unicode_start.sh > b/engine/tests/Functional.kbd/tests/unicode_start.sh > new file mode 100644 > index 0000000..6af7c2f > --- /dev/null > +++ b/engine/tests/Functional.kbd/tests/unicode_start.sh > @@ -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 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. > -- > 1.8.3.1 Please remove these uses of 'expect' and resubmit. Thanks, -- Tim ^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [Fuego] [PATCH] kbd: Add test cases for commands of kbd. 2018-10-12 3:15 ` Wang, Mingyu @ 2018-10-12 3:50 ` Tim.Bird 0 siblings, 0 replies; 20+ messages in thread From: Tim.Bird @ 2018-10-12 3:50 UTC (permalink / raw) To: wangmy, fuego > -----Original Message----- > From: Wang, Mingyu > > hi Tim > > >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. 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. > 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.") > 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 ^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2018-10-13 16:11 UTC | newest] Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-10-09 6:43 [Fuego] [PATCH] kbd: Add test cases for commands of kbd Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] mcelog: Add test cases for command mcelog Wang Mingyu 2018-10-12 0:37 ` Tim.Bird 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(chroot) Wang Mingyu 2018-10-12 4:35 ` Tim.Bird 2018-10-13 4:59 ` Wang, Mingyu 2018-10-13 16:11 ` Tim.Bird 2018-10-09 6:43 ` [Fuego] [PATCH] bind: Add test cases for commands of bind(named) Wang Mingyu 2018-10-12 5:29 ` Tim.Bird 2018-10-09 6:43 ` [Fuego] [PATCH] lm_sensors: Add test cases for command lm_sensors Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] atmtcp: Add test cases for command atmtcp Wang Mingyu 2018-10-09 6:43 ` [Fuego] [PATCH] dovecot: fix test of logfile and ps Wang Mingyu 2018-10-09 18:41 ` Tim.Bird 2018-10-10 3:17 ` Wang, Mingyu 2018-10-10 3:34 ` Tim.Bird 2018-10-10 8:49 ` Wang, Mingyu 2018-10-10 18:00 ` Tim.Bird 2018-10-12 0:33 ` [Fuego] [PATCH] kbd: Add test cases for commands of kbd Tim.Bird 2018-10-12 3:15 ` Wang, Mingyu 2018-10-12 3:50 ` Tim.Bird
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.