Return-Path: From: Wang Mingyu Date: Wed, 6 Mar 2019 02:07:45 -0800 Message-ID: <1551866866-130361-3-git-send-email-wangmy@cn.fujitsu.com> In-Reply-To: <1551866866-130361-1-git-send-email-wangmy@cn.fujitsu.com> References: <1551866866-130361-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] Add test cases for command brctl. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org brctl is used to set up, maintain, and inspect the ethernet bridge configuration in the linux kernel. This test set is used to check if brctl can creat/delete/show the bridge. Signed-off-by: Wang Mingyu --- tests/Functional.brctl/brctl_test.sh | 4 ++++ tests/Functional.brctl/fuego_test.sh | 17 +++++++++++++++++ tests/Functional.brctl/parser.py | 22 ++++++++++++++++++++++ tests/Functional.brctl/spec.json | 7 +++++++ tests/Functional.brctl/tests/brctl_addbr.sh | 15 +++++++++++++++ tests/Functional.brctl/tests/brctl_delbr.sh | 14 ++++++++++++++ tests/Functional.brctl/tests/brctl_setageing.sh | 16 ++++++++++++++++ tests/Functional.brctl/tests/brctl_sethello.sh | 16 ++++++++++++++++ tests/Functional.brctl/tests/brctl_show.sh | 15 +++++++++++++++ tests/Functional.brctl/tests/brctl_showstp.sh | 15 +++++++++++++++ 10 files changed, 141 insertions(+) create mode 100755 tests/Functional.brctl/brctl_test.sh create mode 100644 tests/Functional.brctl/fuego_test.sh create mode 100644 tests/Functional.brctl/parser.py create mode 100644 tests/Functional.brctl/spec.json create mode 100644 tests/Functional.brctl/tests/brctl_addbr.sh create mode 100644 tests/Functional.brctl/tests/brctl_delbr.sh create mode 100644 tests/Functional.brctl/tests/brctl_setageing.sh create mode 100644 tests/Functional.brctl/tests/brctl_sethello.sh create mode 100644 tests/Functional.brctl/tests/brctl_show.sh create mode 100644 tests/Functional.brctl/tests/brctl_showstp.sh diff --git a/tests/Functional.brctl/brctl_test.sh b/tests/Functional.brctl/brctl_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/tests/Functional.brctl/brctl_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/tests/Functional.brctl/fuego_test.sh b/tests/Functional.brctl/fuego_test.sh new file mode 100644 index 0000000..f857ff7 --- /dev/null +++ b/tests/Functional.brctl/fuego_test.sh @@ -0,0 +1,17 @@ +function test_pre_check { + assert_has_program brctl +} + +function test_deploy { + put $TEST_HOME/brctl_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./brctl_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +} diff --git a/tests/Functional.brctl/parser.py b/tests/Functional.brctl/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/tests/Functional.brctl/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/tests/Functional.brctl/spec.json b/tests/Functional.brctl/spec.json new file mode 100644 index 0000000..f0dcc8e --- /dev/null +++ b/tests/Functional.brctl/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.brctl", + "specs": { + "default": {} + } +} + diff --git a/tests/Functional.brctl/tests/brctl_addbr.sh b/tests/Functional.brctl/tests/brctl_addbr.sh new file mode 100644 index 0000000..78678c3 --- /dev/null +++ b/tests/Functional.brctl/tests/brctl_addbr.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# In the target to execute command brct; and confirm the result. +# option : addbr + +test="brctl->addbr" + +brctl addbr br0 +if ifconfig br0 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +brctl delbr br0 diff --git a/tests/Functional.brctl/tests/brctl_delbr.sh b/tests/Functional.brctl/tests/brctl_delbr.sh new file mode 100644 index 0000000..bafe33f --- /dev/null +++ b/tests/Functional.brctl/tests/brctl_delbr.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# In the target to execute command brct; and confirm the result. +# option : delbr + +test="brctl->delbr" + +brctl addbr br0 +if brctl delbr br0 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/tests/Functional.brctl/tests/brctl_setageing.sh b/tests/Functional.brctl/tests/brctl_setageing.sh new file mode 100644 index 0000000..20d1e68 --- /dev/null +++ b/tests/Functional.brctl/tests/brctl_setageing.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# In the target to execute command brct; and confirm the result. +# option : setageing + +test="brctl->setageing" + +brctl addbr br0 +brctl setageing br0 200.00 +if brctl showstp br0 | grep "ageing time.*200.00" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +brctl delbr br0 diff --git a/tests/Functional.brctl/tests/brctl_sethello.sh b/tests/Functional.brctl/tests/brctl_sethello.sh new file mode 100644 index 0000000..4e351b7 --- /dev/null +++ b/tests/Functional.brctl/tests/brctl_sethello.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# In the target to execute command brct; and confirm the result. +# option : sethello + +test="brctl->sethello" + +brctl addbr br0 +brctl sethello br0 5.00 +if brctl showstp br0 | grep "hello time.*5.00" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +brctl delbr br0 diff --git a/tests/Functional.brctl/tests/brctl_show.sh b/tests/Functional.brctl/tests/brctl_show.sh new file mode 100644 index 0000000..68d9c02 --- /dev/null +++ b/tests/Functional.brctl/tests/brctl_show.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# In the target to execute command brct; and confirm the result. +# option : show + +test="brctl->show" + +brctl addbr br0 +if brctl show | grep br0 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +brctl delbr br0 diff --git a/tests/Functional.brctl/tests/brctl_showstp.sh b/tests/Functional.brctl/tests/brctl_showstp.sh new file mode 100644 index 0000000..9ce687b --- /dev/null +++ b/tests/Functional.brctl/tests/brctl_showstp.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# In the target to execute command brct; and confirm the result. +# option : showstp + +test="brctl->showstp" + +brctl addbr br0 +if brctl showstp br0 | grep "bridge id" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +brctl delbr br0 -- 1.8.3.1