Return-Path: From: Wang Mingyu Date: Tue, 18 Sep 2018 08:57:37 -0700 Message-ID: <1537286257-74580-9-git-send-email-wangmy@cn.fujitsu.com> In-Reply-To: <1537286257-74580-1-git-send-email-wangmy@cn.fujitsu.com> References: <1537286257-74580-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] Add test cases for commands of cross_compilation. 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 --- .../cross_compilation_test.sh | 4 +++ .../Functional.cross_compilation/fuego_test.sh | 42 ++++++++++++++++++++++ .../tests/Functional.cross_compilation/parser.py | 22 ++++++++++++ .../tests/Functional.cross_compilation/spec.json | 7 ++++ .../tests/cross_compilation_dotlockfile.sh | 15 ++++++++ .../tests/cross_compilation_drbdsetup.sh | 13 +++++++ .../tests/cross_compilation_jpegtran.sh | 15 ++++++++ .../tests/cross_compilation_lockfile-create.sh | 15 ++++++++ .../tests/cross_compilation_logcheck.sh | 13 +++++++ .../tests/cross_compilation_mip6d.sh | 15 ++++++++ .../tests/cross_compilation_ntfsend.sh | 13 +++++++ .../tests/cross_compilation_numactl.sh | 13 +++++++ .../tests/cross_compilation_openhpid.sh | 13 +++++++ .../tests/cross_compilation_openl2tpd.sh | 15 ++++++++ .../tests/cross_compilation_ptpd2.sh | 13 +++++++ .../tests/cross_compilation_setuidgid.sh | 15 ++++++++ .../tests/cross_compilation_smartctl.sh | 13 +++++++ 17 files changed, 256 insertions(+) create mode 100755 engine/tests/Functional.cross_compilation/cross_compilation_test.sh create mode 100644 engine/tests/Functional.cross_compilation/fuego_test.sh create mode 100644 engine/tests/Functional.cross_compilation/parser.py create mode 100644 engine/tests/Functional.cross_compilation/spec.json create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh diff --git a/engine/tests/Functional.cross_compilation/cross_compilation_test.sh b/engine/tests/Functional.cross_compilation/cross_compilation_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/cross_compilation_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/engine/tests/Functional.cross_compilation/fuego_test.sh b/engine/tests/Functional.cross_compilation/fuego_test.sh new file mode 100644 index 0000000..36ec7bc --- /dev/null +++ b/engine/tests/Functional.cross_compilation/fuego_test.sh @@ -0,0 +1,42 @@ +function test_pre_check { + is_on_target_path dotlockfile PROGRAM_DOTLOCKFILE + assert_define PROGRAM_DOTLOCKFILE "Missing 'dotlockfile' program on target board" + is_on_target_path drbdsetup PROGRAM_DRBDSETUP + assert_define PROGRAM_DRBDSETUP "Missing 'drbdsetup' program on target board" + is_on_target_path jpegtran PROGRAM_JPEGTRAN + assert_define PROGRAM_JPEGTRAN "Missing 'jpegtran' program on target board" + is_on_target_path lockfile-create PROGRAM_LOCKFILE_CREATE + assert_define PROGRAM_LOCKFILE_CREATE "Missing 'lockfile-create' program on target board" + is_on_target_path logcheck PROGRAM_LOGCHECK + assert_define PROGRAM_LOGCHECK "Missing 'logcheck' program on target board" + is_on_target_path mip6d PROGRAM_MIP6D + assert_define PROGRAM_MIP6D "Missing 'mip6d' program on target board" + is_on_target_path ntfsend PROGRAM_NTFSEND + assert_define PROGRAM_NTFSEND "Missing 'ntfsend' program on target board" + is_on_target_path numactl PROGRAM_NUMACTL + assert_define PROGRAM_NUMACTL "Missing 'numactl' program on target board" + is_on_target_path openhpid PROGRAM_OPENHPID + assert_define PROGRAM_OPENHPID "Missing 'openhpid' program on target board" + is_on_target_path openl2tpd PROGRAM_OPENL2TPD + assert_define PROGRAM_OPENL2TPD "Missing 'openl2tpd' program on target board" + is_on_target_path ptpd2 PROGRAM_PTPD2 + assert_define PROGRAM_PTPD2 "Missing 'ptpd2' program on target board" + is_on_target_path setuidgid PROGRAM_SETUIDGID + assert_define PROGRAM_SETUIDGID "Missing 'setuidgid' program on target board" + is_on_target_path smartctl PROGRAM_SMARTCTL + assert_define PROGRAM_SMARTCTL "Missing 'smartctl' program on target board" +} + +function test_deploy { + put $TEST_HOME/cross_compilation_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./cross_compilation_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +} diff --git a/engine/tests/Functional.cross_compilation/parser.py b/engine/tests/Functional.cross_compilation/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/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.cross_compilation/spec.json b/engine/tests/Functional.cross_compilation/spec.json new file mode 100644 index 0000000..a88109e --- /dev/null +++ b/engine/tests/Functional.cross_compilation/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.cross_compilation", + "specs": { + "default": {} + } +} + diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh new file mode 100644 index 0000000..20b19b5 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# The testscript checks the command dotlockfile. +# option: none + +test="dotlockfile" + +dotlockfile > log 2>&1 +if cat log | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm log diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh new file mode 100644 index 0000000..29d2b9b --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command drbdsetup. +# option: -h + +test="drbdsetup" + +if drbdsetup -h | grep USAGE +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh new file mode 100644 index 0000000..4fce7ab --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# The testscript checks the command jpegtran. +# option: -h + +test="jpegtran" + +jpegtran -h > log 2>&1 +if cat log | grep usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm log diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh new file mode 100644 index 0000000..e9c1286 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# The testscript checks the command lockfile-create. +# option: none + +test="lockfile-create" + +lockfile-create > log 2>&1 +if cat log | grep usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm log diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh new file mode 100644 index 0000000..269999d --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command logcheck. +# option: -h + +test="logcheck" + +if sudo -u logcheck logcheck -h | grep usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh new file mode 100644 index 0000000..4c6ee01 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# The testscript checks the command mip6d. +# option: -h + +test="mip6d" + +mip6d -h > log 2>&1 +if cat log | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm log diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh new file mode 100644 index 0000000..3f80215 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command ntfsend. +# option: --help + +test="ntfsend" + +if ntfsend --help | grep "ntfsend - send notification" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh new file mode 100644 index 0000000..61f7870 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command numactl. +# option: none + +test="numactl" + +if numactl -s | grep "policy" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh new file mode 100644 index 0000000..308497e --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command openhpid. +# option: -h + +test="openhpid" + +if openhpid -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh new file mode 100644 index 0000000..d49224a --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# The testscript checks the command openl2tpd. +# option: -h + +test="openl2tpd" + +openl2tpd -h > log 2>&1 +if cat log | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm log diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh new file mode 100644 index 0000000..f00d4ce --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command ptpd2. +# option: -h + +test="ptpd2" + +if ptpd2 -h | grep usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh new file mode 100644 index 0000000..18acea7 --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# The testscript checks the following options of the command setuidgid. +# option: --help + +test="setuidgid" + +setuidgid --help > log 2>&1 +if cat log | grep usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm log diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh new file mode 100644 index 0000000..8188d1b --- /dev/null +++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command smartctl. +# option: -h + +test="smartctl" + +if smartctl -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi -- 1.8.3.1