Return-Path: From: Wang Mingyu Date: Tue, 22 May 2018 08:59:27 -0700 Message-ID: <1527004767-65076-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] Add a new test suite called Functional.busybox. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Signed-off-by: Wang Mingyu --- engine/tests/Functional.busybox/fuego_test.sh | 51 +++++++++++++++++++++++++++ engine/tests/Functional.busybox/parser.py | 22 ++++++++++++ engine/tests/Functional.busybox/spec.json | 7 ++++ 3 files changed, 80 insertions(+) create mode 100755 engine/tests/Functional.busybox/fuego_test.sh create mode 100755 engine/tests/Functional.busybox/parser.py create mode 100644 engine/tests/Functional.busybox/spec.json diff --git a/engine/tests/Functional.busybox/fuego_test.sh b/engine/tests/Functional.busybox/fuego_test.sh new file mode 100755 index 0000000..3140680 --- /dev/null +++ b/engine/tests/Functional.busybox/fuego_test.sh @@ -0,0 +1,51 @@ +# $1: string with tests to skip separated by spaces +# $2: absolute path to the skipfile (default: ${LOGDIR}/skiplist.txt) +function skip_tests { + # split $1 on whitespace, without file globbing + set -f + local TESTS=($1) + local SKIPFILE="${LOGDIR}/skiplist.txt" + set +f + echo "Skipping tests: ${TESTS[@]}." + for testname in "${TESTS[@]}"; do + echo "$testname" >> ${SKIPFILE} + done +} + +# $1: command/program to look for +# $2: string with busybox test names separated by spaces +# $3: This function may also be used in other tests, which can be considered as a general function of fuego. +function skip_if_command_unavailable { + local PROGRAM="$1" + local TESTS="$2" + export FOUND="" + + is_on_target ${PROGRAM} FOUND /bin:/usr/bin:/usr/sbin:/usr/local/bin + if [ -z "${FOUND}" ]; then + echo "WARNING: ${PROGRAM} is not installed on the target." + skip_tests "${TESTS}" + fi +} + +function test_pre_check { + echo "Tests skipped depending on the availability of a command on the target" + touch ${LOGDIR}/skiplist.txt + skip_if_command_unavailable expect "busybox_ash.sh" +} + +function test_deploy { + put $TEST_HOME/busybox_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/testsuits $BOARD_TESTDIR/fuego.$TESTDIR/ + put ${LOGDIR}/skiplist.txt $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + export test_tcpip_host=$SRV_IP;\ + export test_port_host=$SRV_PORT;\ + sh -v busybox_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "4" "TEST-PASS" "p" +} diff --git a/engine/tests/Functional.busybox/parser.py b/engine/tests/Functional.busybox/parser.py new file mode 100755 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.busybox/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.busybox/spec.json b/engine/tests/Functional.busybox/spec.json new file mode 100644 index 0000000..a71218a --- /dev/null +++ b/engine/tests/Functional.busybox/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.busybox", + "specs": { + "default": {} + } +} + -- 1.8.3.1