I found a few problems. However, this was applied to my 'next' branch
in the fuegotest repository.
See details below.
-- Tim
> -----Original Message-----
> From: Wang Mingyu
>
> This test set is used to check option help and subcommand virtual of atmtcp.
>
> Signed-off-by: Wang Mingyu <[email protected]>
> ---
> tests/Functional.atmtcp/atmtcp_test.sh | 4 +++
> tests/Functional.atmtcp/fuego_test.sh | 20 +++++++++++++
> tests/Functional.atmtcp/spec.json | 7 +++++
> tests/Functional.atmtcp/tests/atmtcp_help.sh | 15 ++++++++++
> .../Functional.atmtcp/tests/atmtcp_virtual.sh | 29 +++++++++++++++++++
> 5 files changed, 75 insertions(+)
> create mode 100644 tests/Functional.atmtcp/atmtcp_test.sh
this should be 100755 mode (executable)
> create mode 100644 tests/Functional.atmtcp/fuego_test.sh
> create mode 100644 tests/Functional.atmtcp/spec.json
> create mode 100644 tests/Functional.atmtcp/tests/atmtcp_help.sh
> create mode 100644 tests/Functional.atmtcp/tests/atmtcp_virtual.sh
>
> diff --git a/tests/Functional.atmtcp/atmtcp_test.sh
> b/tests/Functional.atmtcp/atmtcp_test.sh
> new file mode 100644
This should be file mode 100755 (user, group and world executable)
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/tests/Functional.atmtcp/atmtcp_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> + sh $i
> +done
> diff --git a/tests/Functional.atmtcp/fuego_test.sh
> b/tests/Functional.atmtcp/fuego_test.sh
> new file mode 100644
> index 0000000..2d42527
> --- /dev/null
> +++ b/tests/Functional.atmtcp/fuego_test.sh
> @@ -0,0 +1,20 @@
> +function test_pre_check {
> + assert_has_program atmtcp
> + assert_has_program lsmod
> + assert_has_program modprobe
> + assert_has_module atmtcp
> +}
These asserts take a long time. This is not a problem with this test,
but it indicates that I need to take a look at optimizing the assert_has_program code,
I think.
> +
> +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/tests/Functional.atmtcp/spec.json
> b/tests/Functional.atmtcp/spec.json
> new file mode 100644
> index 0000000..aff88cd
> --- /dev/null
> +++ b/tests/Functional.atmtcp/spec.json
> @@ -0,0 +1,7 @@
> +{
> + "testName": "Functional.atmtcp",
> + "specs": {
> + "default": {}
> + }
> +}
> +
> diff --git a/tests/Functional.atmtcp/tests/atmtcp_help.sh
> b/tests/Functional.atmtcp/tests/atmtcp_help.sh
> new file mode 100644
> index 0000000..327fcdb
> --- /dev/null
> +++ b/tests/Functional.atmtcp/tests/atmtcp_help.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +# In target, run command atmtcp to check the output of help.
> +# option: -h
> +
> +test="help"
> +
> +atmtcp -h &> atmtcp_log
'&>' is a bash-ism, I replaced this with 2>&1, which is posix-compliant.
This didn't work on a machine here that used dash for /bin/sh.
> +if cat atmtcp_log | grep [Uu]sage
This could be simplified to remove the 'cat'
if grep [Uu]sage atmtcp_log ;
> +then
> + echo " -> $test: TEST-PASS"
> +else
> + echo " -> $test: TEST-FAIL"
> +fi
> +rm atmtcp_log
> diff --git a/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
> b/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
> new file mode 100644
> index 0000000..4aad2a1
> --- /dev/null
> +++ b/tests/Functional.atmtcp/tests/atmtcp_virtual.sh
> @@ -0,0 +1,29 @@
> +#!/bin/sh
> +
> +# In target, run command atmtcp.
> +# option: virtual
> +
> +test="virtual"
> +
> +if lsmod | grep atmtcp
> +then
> + echo " -> $test: atmtcp is already loaded."
> +else
> + if modprobe -v atmtcp
> + then
> + echo " -> $test: load atmtcp succeeded."
> + else
> + echo " -> $test: load atmtcp failed."
> + echo " -> $test: TEST-FAIL"
> + exit
> + fi
> +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
This returned non-zero (meaning failure),when atmtcp exited
cleanly.
I added an:
exit 0
Thanks.
-- Tim
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.