[Fuego] [PATCH] kbd: Add test cases for commands of kbd.
Wang, Mingyu
wangmy at cn.fujitsu.com
Fri Oct 12 03:15:18 UTC 2018
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 at sony.com [mailto:Tim.Bird at sony.com]
Sent: Friday, October 12, 2018 8:34 AM
To: Wang, Mingyu/王 鸣瑜 <wangmy at cn.fujitsu.com>; fuego at 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 at 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
More information about the Fuego
mailing list