Return-Path: From: Wang Mingyu Date: Mon, 8 Oct 2018 23:43:26 -0700 Message-ID: <1539067407-93632-6-git-send-email-wangmy@cn.fujitsu.com> In-Reply-To: <1539067407-93632-1-git-send-email-wangmy@cn.fujitsu.com> References: <1539067407-93632-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] atmtcp: Add test cases for command atmtcp. 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.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