Return-Path: From: Wang Mingyu Date: Wed, 28 Nov 2018 07:47:38 -0800 Message-ID: <1543420064-1823-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] Add test case for command of wpa_supplicant. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org wpa_supplicant is a WiFi client encryption and authentication tool. This test set is used to use wpa_passphrase to generate a WPA PSK from an ASCII passphrase for a SSID. Signed-off-by: Wang Mingyu --- .../tests/Functional.wpa_supplicant/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.wpa_supplicant/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.wpa_supplicant/spec.json | 7 +++++++ .../tests/wpa_supplicant_set-passphrase.sh | 12 ++++++++++++ .../wpa_supplicant_test.sh | 4 ++++ 5 files changed, 63 insertions(+) create mode 100644 engine/tests/Functional.wpa_supplicant/fuego_test.sh create mode 100644 engine/tests/Functional.wpa_supplicant/parser.py create mode 100644 engine/tests/Functional.wpa_supplicant/spec.json create mode 100644 engine/tests/Functional.wpa_supplicant/tests/wpa_supplicant_set-passphrase.sh create mode 100755 engine/tests/Functional.wpa_supplicant/wpa_supplicant_test.sh diff --git a/engine/tests/Functional.wpa_supplicant/fuego_test.sh b/engine/tests/Functional.wpa_supplicant/fuego_test.sh new file mode 100644 index 0000000..f757cbf --- /dev/null +++ b/engine/tests/Functional.wpa_supplicant/fuego_test.sh @@ -0,0 +1,18 @@ +function test_pre_check { + assert_has_program wpa_supplicant +} + +function test_deploy { + put $TEST_HOME/wpa_supplicant_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./wpa_supplicant_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +} diff --git a/engine/tests/Functional.wpa_supplicant/parser.py b/engine/tests/Functional.wpa_supplicant/parser.py new file mode 100644 index 0000000..d85abd7 --- /dev/null +++ b/engine/tests/Functional.wpa_supplicant/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.wpa_supplicant/spec.json b/engine/tests/Functional.wpa_supplicant/spec.json new file mode 100644 index 0000000..c8b61f2 --- /dev/null +++ b/engine/tests/Functional.wpa_supplicant/spec.json @@ -0,0 +1,7 @@ +{ + "testName": "Functional.wpa_supplicant", + "specs": { + "default": {} + } +} + diff --git a/engine/tests/Functional.wpa_supplicant/tests/wpa_supplicant_set-passphrase.sh b/engine/tests/Functional.wpa_supplicant/tests/wpa_supplicant_set-passphrase.sh new file mode 100644 index 0000000..636fd4c --- /dev/null +++ b/engine/tests/Functional.wpa_supplicant/tests/wpa_supplicant_set-passphrase.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Run the command wpa_passphrase, and confirm the output with keyword. + +test="set-passphrase" + +if wpa_passphrase abcdefg 01234567 | grep "01234567" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/engine/tests/Functional.wpa_supplicant/wpa_supplicant_test.sh b/engine/tests/Functional.wpa_supplicant/wpa_supplicant_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/engine/tests/Functional.wpa_supplicant/wpa_supplicant_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done -- 1.8.3.1