Add test cases for command ethtool.
PATCH v2 1/1 Add test cases for command ethtool.
--- engine/tests/Functional.ethtool/ethtool_test.sh | 4 ++++ engine/tests/Functional.ethtool/fuego_test.sh | 18 +++++++++++++++ engine/tests/Functional.ethtool/parser.py | 22 ++++++++++++++++++ engine/tests/Functional.ethtool/spec.json | 7 ++++++ .../Functional.ethtool/tests/ethtool_driver.sh | 25 +++++++++++++++++++++ .../tests/Functional.ethtool/tests/ethtool_help.sh | 13 +++++++++++ .../tests/Functional.ethtool/tests/ethtool_show.sh | 26 ++++++++++++++++++++++ 7 files changed, 115 insertions(+) create mode 100755 engine/tests/Functional.ethtool/ethtool_test.sh create mode 100644 engine/tests/Functional.ethtool/fuego_test.sh create mode 100644 engine/tests/Functional.ethtool/parser.py create mode 100644 engine/tests/Functional.ethtool/spec.json create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_driver.sh create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_help.sh create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_show.sh
engine/tests/Functional.ethtool/ethtool_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.ethtool/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path ethtool PROGRAM_ETHTOOL + assert_define PROGRAM_ETHTOOL "Missing 'ethtool' program on target board" +} + +function test_deploy { + put $TEST_HOME/ethtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./ethtool_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.ethtool/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.ethtool/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.ethtool", + "specs": { + "default": {} + } +} +
engine/tests/Functional.ethtool/tests/ethtool_driver.sh new file +25 -0
@@ -0,0 +1,25 @@ +#!/bin/sh + +# In target, run command ethtool. +# option: -i + +test="driver" + +ETHERNET_DEVICE_NAME="have no Ethernet device" +ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list + +for line in $(cat driver_list) +do + if ethtool $line | grep "baseT" + then + ETHERNET_DEVICE_NAME=$line + break + fi +done + +if ethtool -i $ETHERNET_DEVICE_NAME | grep driver +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.ethtool/tests/ethtool_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command ethtool. +# option: help + +test="help" + +if ethtool -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.ethtool/tests/ethtool_show.sh new file +26 -0
@@ -0,0 +1,26 @@ +#!/bin/sh + +# In target, run command ethtool. +# option: none + +test="show" + +ETHERNET_DEVICE_NAME="have no Ethernet device" +ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list + +for line in $(cat driver_list) +do + if ethtool $line | grep "baseT" + then + ETHERNET_DEVICE_NAME=$line + break + fi +done + + +if ethtool $ETHERNET_DEVICE_NAME | grep "Settings for" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for command cryptsetup.
--- .../tests/Functional.cryptsetup/cryptsetup_test.sh | 4 +++ engine/tests/Functional.cryptsetup/fuego_test.sh | 18 ++++++++++++ engine/tests/Functional.cryptsetup/parser.py | 22 +++++++++++++++ engine/tests/Functional.cryptsetup/spec.json | 7 +++++ .../tests/cryptsetup_create.sh | 32 ++++++++++++++++++++++ .../Functional.cryptsetup/tests/cryptsetup_help.sh | 13 +++++++++ 6 files changed, 96 insertions(+) create mode 100755 engine/tests/Functional.cryptsetup/cryptsetup_test.sh create mode 100644 engine/tests/Functional.cryptsetup/fuego_test.sh create mode 100644 engine/tests/Functional.cryptsetup/parser.py create mode 100644 engine/tests/Functional.cryptsetup/spec.json create mode 100644 engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh create mode 100644 engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh
engine/tests/Functional.cryptsetup/cryptsetup_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.cryptsetup/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path cryptsetup PROGRAM_CRYPTSETUP + assert_define PROGRAM_CRYPTSETUP "Missing 'cryptsetup' program on target board" +} + +function test_deploy { + put $TEST_HOME/cryptsetup_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./cryptsetup_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.cryptsetup/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.cryptsetup/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.cryptsetup", + "specs": { + "default": {} + } +} +
engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh new file +32 -0
@@ -0,0 +1,32 @@ +#!/bin/sh + +# The testscript checks the following options of the command cryptsetup +# option: create + +test="create" + +modprobe loop + +dd if=/dev/zero of=/tmp/cryptloop bs=1k count=1000 +losetup -f +losetup /dev/loop0 /tmp/cryptloop + +expect <<-EOF +spawn cryptsetup create loop_test /dev/loop0 +expect { + -re "Enter passphrase:" { + send "test\n" + send_user " -> $test: create loop_test succeeded.\n" + } + default { send_user " -> $test: TEST-FAIL\n" } } +expect eof +EOF + +if ls /dev/mapper | grep loop_test +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +cryptsetup remove loop_test +losetup -d /dev/loop0
engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the following options of the command cryptsetup +# option: --help + +test="help" + +if cryptsetup --help | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
Signature · 1 line
1.8.3.1
[email protected]
AppliedRe: [Fuego] [PATCH] Add test cases for command cryptsetup.
Sorry to only get to this now.
Applied, but see comments inline below.
Quoted 42 lines
-----Original Message-----
From: Wang MingyuSigned-off-by Wang Mingyu <[email protected]>--- .../tests/Functional.cryptsetup/cryptsetup_test.sh | 4 +++ engine/tests/Functional.cryptsetup/fuego_test.sh | 18 ++++++++++++ engine/tests/Functional.cryptsetup/parser.py | 22 +++++++++++++++ engine/tests/Functional.cryptsetup/spec.json | 7 +++++ .../tests/cryptsetup_create.sh | 32 ++++++++++++++++++++++ .../Functional.cryptsetup/tests/cryptsetup_help.sh | 13 +++++++++ 6 files changed, 96 insertions(+) create mode 100755 engine/tests/Functional.cryptsetup/cryptsetup_test.sh create mode 100644 engine/tests/Functional.cryptsetup/fuego_test.sh create mode 100644 engine/tests/Functional.cryptsetup/parser.py create mode 100644 engine/tests/Functional.cryptsetup/spec.json create mode 100644 engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh create mode 100644
engine/tests/Functional.cryptsetup/tests/cryptsetup_help.shengine/tests/Functional.cryptsetup/cryptsetup_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.cryptsetup/fuego_test.sh new file +3
-0@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path cryptsetup PROGRAM_CRYPTSETUP + assert_define PROGRAM_CRYPTSETUP "Missing 'cryptsetup' program on
Quoted 2 lines
target board"
+}
You should check for 'expect' here also, as it is used in individual test cases.
Quoted 117 lines
engine/tests/Functional.cryptsetup/fuego_test.sh new file +14
-0+ +function test_deploy { + put $TEST_HOME/cryptsetup_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./cryptsetup_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}engine/tests/Functional.cryptsetup/parser.py new file +22
-0@@ -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))engine/tests/Functional.cryptsetup/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.cryptsetup", + "specs": { + "default": {} + } +} +engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh new file +32
-0@@ -0,0 +1,32 @@ +#!/bin/sh + +# The testscript checks the following options of the command cryptsetup +# option: create + +test="create" + +modprobe loop + +dd if=/dev/zero of=/tmp/cryptloop bs=1k count=1000 +losetup -f +losetup /dev/loop0 /tmp/cryptloop + +expect <<-EOF +spawn cryptsetup create loop_test /dev/loop0 +expect { + -re "Enter passphrase:" { + send "test\n" + send_user " -> $test: create loop_test succeeded.\n" + } + default { send_user " -> $test: TEST-FAIL\n" } } +expect eof +EOF + +if ls /dev/mapper | grep loop_test +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +cryptsetup remove loop_test +losetup -d /dev/loop0engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh new file +13
-1@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the following options of the command cryptsetup +# option: --help + +test="help" + +if cryptsetup --help | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; --
Quoted 1 line
1.8.3.1
Applied - but it would be nice to get a patch on top of this for checking for 'expect' in test_pre_check()
-- Tim
PATCH 1/1 Add test cases for command ecryptfs-manager.
In reply to Wang Mingyu--- .../ecryptfs-manager_test.sh | 4 ++++ .../Functional.ecryptfs-manager/fuego_test.sh | 18 ++++++++++++++++ engine/tests/Functional.ecryptfs-manager/parser.py | 22 ++++++++++++++++++++ engine/tests/Functional.ecryptfs-manager/spec.json | 7 +++++++ .../tests/ecryptfs-manager01.sh | 23 +++++++++++++++++++++ .../tests/ecryptfs-manager02.sh | 24 ++++++++++++++++++++++ 6 files changed, 98 insertions(+) create mode 100755 engine/tests/Functional.ecryptfs-manager/ecryptfs-manager_test.sh create mode 100644 engine/tests/Functional.ecryptfs-manager/fuego_test.sh create mode 100644 engine/tests/Functional.ecryptfs-manager/parser.py create mode 100644 engine/tests/Functional.ecryptfs-manager/spec.json create mode 100644 engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager01.sh create mode 100644 engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager02.sh
engine/tests/Functional.ecryptfs-manager/ecryptfs-manager_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.ecryptfs-manager/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path ecryptfs-manager PROGRAM_ECRYPTFS_MANAGER + assert_define PROGRAM_ECRYPTFS_MANAGER "Missing 'ecryptfs-manager' program on target board" +} + +function test_deploy { + put $TEST_HOME/ecryptfs-manager_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./ecryptfs-manager_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.ecryptfs-manager/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.ecryptfs-manager/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.ecryptfs-manager", + "specs": { + "default": {} + } +} +
engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager01.sh new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/sh + +# The testscript execute the command ecryptfs-manager and check the passphrase. +# option: none + +test="ecryptfs-manager01" + +expect <<-EOF +spawn ecryptfs-manager +expect "Make selection:" +send "1\r" +expect "Mount-wide passphrase:" +send "test123\r" +expect ".*Confirm passphrase:" +send "test123\r" +expect { + -re ".*Using the default salt value.*" { + send_user " -> $test: TEST-PASS\n" + } +default { send_user " -> $test: TEST-FAIL\n" } } +send "4\r" +expect eof +EOF
engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager02.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh + +# The testscript execute the command ecryptfs-manager and check the passphrase. +# option: none + +test="ecryptfs-manager02" + +expect <<-EOF +spawn ecryptfs-manager +expect "Make selection:" +send "1\r" +expect "Mount-wide passphrase:" +send "test123\r" +expect ".*Confirm passphrase:" +send "test123\r" +expect "Using the default salt value" +expect { + -re "That key was already" { + send_user " -> $test: TEST-PASS\n" + } +default { send_user " -> $test: TEST-FAIL\n" } } +send "4\r" +expect eof +EOF
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for command zabbix.
In reply to Wang Mingyu--- engine/tests/Functional.zabbix/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.zabbix/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.zabbix/spec.json | 7 +++++++ .../tests/Functional.zabbix/tests/zabbix_help.sh | 13 +++++++++++++ .../tests/Functional.zabbix/tests/zabbix_print.sh | 13 +++++++++++++ engine/tests/Functional.zabbix/zabbix_test.sh | 4 ++++ 6 files changed, 77 insertions(+) create mode 100644 engine/tests/Functional.zabbix/fuego_test.sh create mode 100644 engine/tests/Functional.zabbix/parser.py create mode 100644 engine/tests/Functional.zabbix/spec.json create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_help.sh create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_print.sh create mode 100755 engine/tests/Functional.zabbix/zabbix_test.sh
engine/tests/Functional.zabbix/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path zabbix_agentd PROGRAM_ZABBIX_AGENTD + assert_define PROGRAM_ZABBIX_AGENTD "Missing 'zabbix_agentd' program on target board" +} + +function test_deploy { + put $TEST_HOME/zabbix_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./zabbix_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.zabbix/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.zabbix/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.v10pkgs", + "specs": { + "default": {} + } +} +
engine/tests/Functional.zabbix/tests/zabbix_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command zabbix_agentd. +# option: -h + +test="help" + +if zabbix_agentd -h | grep usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.zabbix/tests/zabbix_print.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command zabbix_agentd. +# option: -p + +test="print" + +if zabbix_agentd -p | grep localhost +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.zabbix/zabbix_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH] Add test cases for command zabbix.
Quoted 4 lines
-----Original Message-----
From: Wang Mingyu
The commit message body should rarely be empty. Please put a synopsis of test features here.
Also, a test.yaml file describing what 'zabbix' is would be nice. I'm not familiar with it.
Quoted 81 lines
Signed-off-by Wang Mingyu <[email protected]>--- engine/tests/Functional.zabbix/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.zabbix/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.zabbix/spec.json | 7 +++++++ .../tests/Functional.zabbix/tests/zabbix_help.sh | 13 +++++++++++++ .../tests/Functional.zabbix/tests/zabbix_print.sh | 13 +++++++++++++ engine/tests/Functional.zabbix/zabbix_test.sh | 4 ++++ 6 files changed, 77 insertions(+) create mode 100644 engine/tests/Functional.zabbix/fuego_test.sh create mode 100644 engine/tests/Functional.zabbix/parser.py create mode 100644 engine/tests/Functional.zabbix/spec.json create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_help.sh create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_print.sh create mode 100755 engine/tests/Functional.zabbix/zabbix_test.shengine/tests/Functional.zabbix/fuego_test.sh new file +3
-0@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path zabbix_agentd PROGRAM_ZABBIX_AGENTD + assert_define PROGRAM_ZABBIX_AGENTD "Missing 'zabbix_agentd'program on target board"
engine/tests/Functional.zabbix/fuego_test.sh new file +15
-0+} + +function test_deploy { + put $TEST_HOME/zabbix_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./zabbix_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}engine/tests/Functional.zabbix/parser.py new file +22
-0@@ -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))engine/tests/Functional.zabbix/spec.json new file +0
-0
engine/tests/Functional.zabbix/spec.json line 2
Quoted 2 lines
engine/tests/Functional.zabbix/spec.json new file +2
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.v10pkgs",'
This is incorrect. Should be "Functional.zabbix".
Quoted 57 lines
engine/tests/Functional.zabbix/spec.json new file +5
-0+ "specs": { + "default": {} + } +} +engine/tests/Functional.zabbix/tests/zabbix_help.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command zabbix_agentd. +# option: -h + +test="help" + +if zabbix_agentd -h | grep usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.zabbix/tests/zabbix_print.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command zabbix_agentd. +# option: -p + +test="print" + +if zabbix_agentd -p | grep localhost +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.zabbix/zabbix_test.sh new file +4
-1@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done --
Quoted 1 line
1.8.3.1
These tests that only check the usage line and some trivial output are not useful in the long run. I guess they detect that the command is present. But the likelihood that this test will catch a bug is extremely low. Commands don't change their usage very often, and this is extremely unlikely to catch anything of importance for the operation of the tool.
I've been letting these "stub" tests through, on the theory that it's good to have a placeholder and the infrastructure for a test of a command, even if I'm unfamiliar with it, because then it will be easier for someone to add additional testcases for that command in the future. However, if no additional testcases are ever written, these tests are not very useful. They are actually detrimental, because they provide a false sense that the command has been tested thoroughly, which is not really true.
Please let me know if Fujitsu plans to enhance these simple tests with additional testcases over time.
If so, please add at least one more testcase now, which tests some actual functionality of zabbix_agentd. And, please fix the other issues listed above.
For now, this is NOT applied.
Regards,
-- Tim
PATCH 1/1 Add test cases for command dumpsexp.
In reply to Wang Mingyu--- engine/tests/Functional.dumpsexp/dumpsexp_test.sh | 4 ++++ engine/tests/Functional.dumpsexp/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.dumpsexp/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.dumpsexp/spec.json | 7 +++++++ engine/tests/Functional.dumpsexp/tests/dumpsexp.sh | 15 +++++++++++++++ 5 files changed, 66 insertions(+) create mode 100755 engine/tests/Functional.dumpsexp/dumpsexp_test.sh create mode 100644 engine/tests/Functional.dumpsexp/fuego_test.sh create mode 100644 engine/tests/Functional.dumpsexp/parser.py create mode 100644 engine/tests/Functional.dumpsexp/spec.json create mode 100644 engine/tests/Functional.dumpsexp/tests/dumpsexp.sh
engine/tests/Functional.dumpsexp/dumpsexp_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.dumpsexp/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path dumpsexp PROGRAM_DUMPSEXP + assert_define PROGRAM_DUMPSEXP "Missing 'dumpsexp' program on target board" +} + +function test_deploy { + put $TEST_HOME/dumpsexp_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./dumpsexp_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.dumpsexp/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.dumpsexp/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.dumpsexp", + "specs": { + "default": {} + } +} +
engine/tests/Functional.dumpsexp/tests/dumpsexp.sh new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# The testscript checks the command dumpsexp. +# option: none + +test="dumpsexp" + +mkdir test_dir +echo test > test_dir/libgcrypt_test +if dumpsexp test_dir/libgcrypt_test | grep "74 65 73 74 0a" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for command keyctl.
In reply to Wang Mingyu--- engine/tests/Functional.keyctl/fuego_test.sh | 18 ++++++++++++++++++ engine/tests/Functional.keyctl/keyctl_test.sh | 4 ++++ engine/tests/Functional.keyctl/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.keyctl/spec.json | 7 +++++++ engine/tests/Functional.keyctl/tests/keyctl_add.sh | 14 ++++++++++++++ .../tests/Functional.keyctl/tests/keyctl_clear.sh | 14 ++++++++++++++ .../tests/Functional.keyctl/tests/keyctl_show.sh | 13 +++++++++++++ .../Functional.keyctl/tests/keyctl_version.sh | 13 +++++++++++++ 8 files changed, 105 insertions(+) create mode 100644 engine/tests/Functional.keyctl/fuego_test.sh create mode 100755 engine/tests/Functional.keyctl/keyctl_test.sh create mode 100644 engine/tests/Functional.keyctl/parser.py create mode 100644 engine/tests/Functional.keyctl/spec.json create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_add.sh create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_clear.sh create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_show.sh create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_version.sh
engine/tests/Functional.keyctl/fuego_test.sh new file +18 -0
@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path keyctl PROGRAM_KEYCTL + assert_define PROGRAM_KEYCTL "Missing 'keyctl' program on target board" +} + +function test_deploy { + put $TEST_HOME/keyctl_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./keyctl_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.keyctl/keyctl_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.keyctl/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.keyctl/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.keyctl", + "specs": { + "default": {} + } +} +
engine/tests/Functional.keyctl/tests/keyctl_add.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +# The testscript checks the command keyctl. +# option: add + +test="add" + +keyctl add user _display data @u +if keyctl show | grep "user: _display" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.keyctl/tests/keyctl_clear.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +# The testscript checks the command keyctl. +# option: clear + +test="clear" + +keyctl clear @u +if keyctl show | grep "Session Keyring" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.keyctl/tests/keyctl_show.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command keyctl. +# option: show + +test="show" + +if keyctl show | grep "_ses" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.keyctl/tests/keyctl_version.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# The testscript checks the command keyctl. +# option: --version + +test="version" + +if keyctl --version | grep "keyctl" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
Signature · 1 line
1.8.3.1
PATCH v2 1/1 Add test cases for commands of module-init-tools.
In reply to Wang Mingyu--- .../Functional.module-init-tools/fuego_test.sh | 29 +++++++++++++++ .../module-init-tools_test.sh | 4 ++ .../tests/Functional.module-init-tools/parser.py | 22 +++++++++++ .../tests/Functional.module-init-tools/spec.json | 7 ++++ .../tests/module-init-tools_depmod.sh | 29 +++++++++++++++ .../tests/module-init-tools_insmod.sh | 40 ++++++++++++++++++++ .../tests/module-init-tools_lsmod.sh | 39 ++++++++++++++++++++ .../tests/module-init-tools_modinfo.sh | 18 +++++++++ .../tests/module-init-tools_modprobe.sh | 35 ++++++++++++++++++ .../tests/module-init-tools_rmmod.sh | 43 ++++++++++++++++++++++ 10 files changed, 266 insertions(+) create mode 100644 engine/tests/Functional.module-init-tools/fuego_test.sh create mode 100755 engine/tests/Functional.module-init-tools/module-init-tools_test.sh create mode 100644 engine/tests/Functional.module-init-tools/parser.py create mode 100644 engine/tests/Functional.module-init-tools/spec.json create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_depmod.sh create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_lsmod.sh create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_modinfo.sh create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_modprobe.sh create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_rmmod.sh
engine/tests/Functional.module-init-tools/fuego_test.sh new file +29 -0
@@ -0,0 +1,29 @@ +function test_pre_check { + is_on_target_path depmod PROGRAM_DEPMOD + assert_define PROGRAM_DEPMOD "Missing 'depmod' program on target board" + is_on_target_path insmod PROGRAM_INSMOD + assert_define PROGRAM_INSMOD "Missing 'insmod' program on target board" + is_on_target_path lsmod PROGRAM_LSMOD + assert_define PROGRAM_LSMOD "Missing 'lsmod' program on target board" + is_on_target_path rmmod PROGRAM_RMMOD + assert_define PROGRAM_RMMOD "Missing 'rmmod' program on target board" + is_on_target_path modinfo PROGRAM_MODINFO + assert_define PROGRAM_MODINFO "Missing 'modinfo' program on target board" + is_on_target_path modprobe PROGRAM_MODPROBE + assert_define PROGRAM_MODPROBE "Missing 'modprobe' program on target board" +} + +function test_deploy { + put $TEST_HOME/module-init-tools_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;\ + ./module-init-tools_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.module-init-tools/module-init-tools_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.module-init-tools/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.module-init-tools/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.module-init-tools", + "specs": { + "default": {} + } +} +
engine/tests/Functional.module-init-tools/tests/module-init-tools_depmod.sh new file +29 -0
@@ -0,0 +1,29 @@ +#!/bin/sh + +# In target, run command depmod. +# option: none + +test="depmod" + +test_krnl_rel=$(uname -r) + +if [ -f /lib/modules/$test_krnl_rel/modules.dep ] +then + mv /lib/modules/$test_krnl_rel/modules.dep /lib/modules/$test_krnl_rel/modules.dep_bak +fi + +depmod + +if ls -l /lib/modules/$test_krnl_rel/modules.dep +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +if [ -e /lib/modules/$test_krnl_rel/modules.dep_bak ] +then + mv /lib/modules/$test_krnl_rel/modules.dep_bak /lib/modules/$test_krnl_rel/modules.dep +else + rm /lib/modules/$test_krnl_rel/modules.de +fi
engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh new file +40 -0
@@ -0,0 +1,40 @@ +#!/bin/sh + +# In target, run command insmod. +# option: none + +test="insmod" + +tst_mod_file="ko file of module" +tst_mod_flag=0 + +if modinfo uvesafb +then + tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8) +else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi + +mkdir test_dir +cp $tst_mod_file test_dir/ + +if lsmod | grep uvesafb +then + tst_mod_flag=1 + rmmod $tst_mod_file +fi + +if insmod test_dir/*.ko +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +if [ $tst_mod_flag=0 ] +then + rmmod $tst_mod_file +fi +rm -fr test_dir
engine/tests/Functional.module-init-tools/tests/module-init-tools_lsmod.sh new file +39 -0
@@ -0,0 +1,39 @@ +#!/bin/sh + +# In target, run command lsmod. +# option: none + +test="lsmod" + +tst_mod_file="ko file of module" + +if modinfo uvesafb +then + tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8) +else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi + +if lsmod | grep uvesafb +then + echo " -> $test: TEST-PASS" + exit +fi + +mkdir test_dir +cp $tst_mod_file test_dir/ + +insmod test_dir/*.ko + +if lsmod | grep uvesafb +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +rmmod $tst_mod_file +rm -fr test_dir +
engine/tests/Functional.module-init-tools/tests/module-init-tools_modinfo.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh + +# In target, run command modinfo. +# option: none + +test="modinfo" + +tst_mod_file="ko file of module" +tst_mod_flag=0 + +if modinfo uvesafb | grep "filename" +then + echo " -> $test: TEST-PASS" +else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi
engine/tests/Functional.module-init-tools/tests/module-init-tools_modprobe.sh new file +35 -0
@@ -0,0 +1,35 @@ +#!/bin/sh + +# In target, run command modprobe. +# option: modprobe + +test="modprobe" + +tst_mod_file="ko file of module" +tst_mod_flag=0 +test_krnl_rel=$(uname -r) + +if modinfo uvesafb +then + tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8) +else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi + +if modprobe -D uvesafb | grep "insmod $tst_mod_file" +then + echo " -> $test: modprobe -D is succeeded." +else + echo " -> $test: modprobe -D is failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if cat /lib/modules/$test_krnl_rel/modules.dep | grep "uvesafb.ko" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.module-init-tools/tests/module-init-tools_rmmod.sh new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH v2] Add test cases for commands of module-init-tools.
Sorry for the slow response. See comments inline below.
Quoted 2 lines
-----Original Message-----
From: Wang Mingyu on Tuesday, September 18, 2018 8:58 AM
There should be some text in the commit body here.
Quoted 4 lines
Signed-off-by Wang Mingyu <[email protected]>--- .../Functional.module-init-tools/fuego_test.sh | 29 +++++++++++++++
Fuego test names should use underscores and not dashes. Please change this to Functional.module_init_tools See http://fuegotest.org/wiki/Fuego_naming_rules
Quoted 55 lines
.../module-init-tools_test.sh | 4 ++ .../tests/Functional.module-init-tools/parser.py | 22 +++++++++++ .../tests/Functional.module-init-tools/spec.json | 7 ++++ .../tests/module-init-tools_depmod.sh | 29 +++++++++++++++ .../tests/module-init-tools_insmod.sh | 40 ++++++++++++++++++++ .../tests/module-init-tools_lsmod.sh | 39 ++++++++++++++++++++ .../tests/module-init-tools_modinfo.sh | 18 +++++++++ .../tests/module-init-tools_modprobe.sh | 35 ++++++++++++++++++ .../tests/module-init-tools_rmmod.sh | 43 ++++++++++++++++++++++ 10 files changed, 266 insertions(+) create mode 100644 engine/tests/Functional.module-init- tools/fuego_test.sh create mode 100755 engine/tests/Functional.module-init-tools/module-init- tools_test.sh create mode 100644 engine/tests/Functional.module-init-tools/parser.py create mode 100644 engine/tests/Functional.module-init-tools/spec.json create mode 100644 engine/tests/Functional.module-init- tools/tests/module-init-tools_depmod.sh create mode 100644 engine/tests/Functional.module-init- tools/tests/module-init-tools_insmod.sh create mode 100644 engine/tests/Functional.module-init- tools/tests/module-init-tools_lsmod.sh create mode 100644 engine/tests/Functional.module-init- tools/tests/module-init-tools_modinfo.sh create mode 100644 engine/tests/Functional.module-init- tools/tests/module-init-tools_modprobe.sh create mode 100644 engine/tests/Functional.module-init-
tools/tests/module-init-tools_rmmod.shengine/tests/Functional.module-init-tools/fuego_test.sh new file +3
-0@@ -0,0 +1,29 @@ +function test_pre_check { + is_on_target_path depmod PROGRAM_DEPMOD + assert_define PROGRAM_DEPMOD "Missing 'depmod' program on targetboard"
engine/tests/Functional.module-init-tools/fuego_test.sh new file +2
-0+ is_on_target_path insmod PROGRAM_INSMOD + assert_define PROGRAM_INSMOD "Missing 'insmod' program on targetboard"
engine/tests/Functional.module-init-tools/fuego_test.sh new file +2
-0+ is_on_target_path lsmod PROGRAM_LSMOD + assert_define PROGRAM_LSMOD "Missing 'lsmod' program on targetboard"
engine/tests/Functional.module-init-tools/fuego_test.sh new file +2
-0+ is_on_target_path rmmod PROGRAM_RMMOD + assert_define PROGRAM_RMMOD "Missing 'rmmod' program on targetboard"
engine/tests/Functional.module-init-tools/fuego_test.sh new file +2
-0+ is_on_target_path modinfo PROGRAM_MODINFO + assert_define PROGRAM_MODINFO "Missing 'modinfo' program ontarget board"
engine/tests/Functional.module-init-tools/fuego_test.sh new file +2
-0+ is_on_target_path modprobe PROGRAM_MODPROBE + assert_define PROGRAM_MODPROBE "Missing 'modprobe' program on
Quoted 1 line
target board"
Please switch these to assert_has_program
Also, I think you need a NEED_ROOT=1 somewhere.
I believe many of these tests will not run without root privileges (depmod?)
Quoted 110 lines
engine/tests/Functional.module-init-tools/fuego_test.sh new file +4
-0+} + +function test_deploy { + put $TEST_HOME/module-init-tools_test.sh$BOARD_TESTDIR/fuego.$TESTDIR/
+ put$FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh
$BOARD_TESTDIR/fuego.$TESTDIRengine/tests/Functional.module-init-tools/fuego_test.sh new file +11
-0+ put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./module-init-tools_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}(quoted diff) +0
-0
tools_test.shb/engine/tests/Functional.module-init-tools/module-init-tools_test.sh
new file mode 100755
index 0000000..dd5ce37engine/tests/Functional.module-init-tools/module-init-tools_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.module-init-tools/parser.py new file +22
-0@@ -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))engine/tests/Functional.module-init-tools/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.module-init-tools", + "specs": { + "default": {} + } +} +(quoted diff) +0
-0
tools_depmod.shb/engine/tests/Functional.module-init-tools/tests/module-init-tools_depmod.sh
new file mode 100644
index 0000000..c80f0aaengine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_depmod.shengine/tests/Functional.module-init-tools/tests/module-init- new file +12
-0@@ -0,0 +1,29 @@ +#!/bin/sh + +# In target, run command depmod. +# option: none + +test="depmod" + +test_krnl_rel=$(uname -r) + +if [ -f /lib/modules/$test_krnl_rel/modules.dep ] +then + mv /lib/modules/$test_krnl_rel/modules.dep
/lib/modules/$test_krnl_rel/modules.dep_bakengine/tests/Functional.module-init-tools/tests/module-init- new file +14
-0+fi + +depmod + +if ls -l /lib/modules/$test_krnl_rel/modules.dep +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +if [ -e /lib/modules/$test_krnl_rel/modules.dep_bak ] +then + mv /lib/modules/$test_krnl_rel/modules.dep_bak
/lib/modules/$test_krnl_rel/modules.dep
engine/tests/Functional.module-init-tools/tests/module-init-
Quoted 2 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +2
-0+else + rm /lib/modules/$test_krnl_rel/modules.de
Missing a 'p' at the end of this filename.
Quoted 11 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +1
-0+fi(quoted diff) +0
-0
tools_insmod.shb/engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh
new file mode 100644
index 0000000..443c088engine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_insmod.shengine/tests/Functional.module-init-tools/tests/module-init- new file +1
-0@@ -0,0 +1,40 @@ +#!/bin/sh
engine/tests/Functional.module-init-tools/tests/module-init- line 11
Quoted 10 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +10
-0+ +# In target, run command insmod. +# option: none + +test="insmod" + +tst_mod_file="ko file of module" +tst_mod_flag=0 + +if modinfo uvesafb
How was this chosen as the module to use? I only have this module on 2 of my boards (both x86_64).
Is there another module that is more common?
It would be difficult, but maybe we should provide a stub module
ourselves: fuego_stub.ko, and build it and put it on the target.
engine/tests/Functional.module-init-tools/tests/module-init- line 13
Quoted 2 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +2
-0+then + tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
Please use 'head' instead of sed here, to get the first line of the output.
Quoted 38 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +27
-0+else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi + +mkdir test_dir +cp $tst_mod_file test_dir/ + +if lsmod | grep uvesafb +then + tst_mod_flag=1 + rmmod $tst_mod_file +fi + +if insmod test_dir/*.ko +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +if [ $tst_mod_flag=0 ] +then + rmmod $tst_mod_file +fi +rm -fr test_dir(quoted diff) +0
-0
tools_lsmod.shb/engine/tests/Functional.module-init-tools/tests/module-init-tools_lsmod.sh
new file mode 100644
index 0000000..77acb18engine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_lsmod.shengine/tests/Functional.module-init-tools/tests/module-init- new file +2
-0@@ -0,0 +1,39 @@ +#!/bin/sh +
engine/tests/Functional.module-init-tools/tests/module-init- line 12
Quoted 10 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +10
-0+# In target, run command lsmod. +# option: none + +test="lsmod" + +tst_mod_file="ko file of module" + +if modinfo uvesafb +then + tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
Please use head here instead of sed to get first line of output.
Quoted 151 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +27
-0+else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi + +if lsmod | grep uvesafb +then + echo " -> $test: TEST-PASS" + exit +fi + +mkdir test_dir +cp $tst_mod_file test_dir/ + +insmod test_dir/*.ko + +if lsmod | grep uvesafb +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +rmmod $tst_mod_file +rm -fr test_dir +(quoted diff) +0
-0
tools_modinfo.shb/engine/tests/Functional.module-init-tools/tests/module-init-tools_modinfo.sh
new file mode 100644
index 0000000..4265887engine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_modinfo.shengine/tests/Functional.module-init-tools/tests/module-init- new file +18
-0@@ -0,0 +1,18 @@ +#!/bin/sh + +# In target, run command modinfo. +# option: none + +test="modinfo" + +tst_mod_file="ko file of module" +tst_mod_flag=0 + +if modinfo uvesafb | grep "filename" +then + echo " -> $test: TEST-PASS" +else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi(quoted diff) +0
-0
tools_modprobe.shb/engine/tests/Functional.module-init-tools/tests/module-init-tools_modprobe.sh
new file mode 100644
index 0000000..13823f9engine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_modprobe.shengine/tests/Functional.module-init-tools/tests/module-init- new file +35
-0@@ -0,0 +1,35 @@ +#!/bin/sh + +# In target, run command modprobe. +# option: modprobe + +test="modprobe" + +tst_mod_file="ko file of module" +tst_mod_flag=0 +test_krnl_rel=$(uname -r) + +if modinfo uvesafb +then + tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8) +else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi + +if modprobe -D uvesafb | grep "insmod $tst_mod_file" +then + echo " -> $test: modprobe -D is succeeded." +else + echo " -> $test: modprobe -D is failed." + echo " -> $test: TEST-FAIL" + exit +fi + +if cat /lib/modules/$test_krnl_rel/modules.dep | grep "uvesafb.ko" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi(quoted diff) +0
-0
tools_rmmod.shb/engine/tests/Functional.module-init-tools/tests/module-init-tools_rmmod.sh
new file mode 100644
index 0000000..bdd2d30engine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_rmmod.shengine/tests/Functional.module-init-tools/tests/module-init- new file +43
-1@@ -0,0 +1,43 @@ +#!/bin/sh + +# In target, run command rmmod. +# option: none + +test="rmmod" + +tst_mod_file="ko file of module" +tst_mod_flag=0 + +if modinfo uvesafb +then + tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8) +else + echo " -> module uvesafb is not exist." + echo " -> $test: TEST-FAIL" + exit +fi + +mkdir test_dir +cp $tst_mod_file test_dir/ + +if lsmod | grep uvesafb +then + tst_mod_flag=1 +fi + +insmod test_dir/*.ko + +rmmod $tst_mod_file + +if lsmod | grep uvesafb +then + echo " -> $test: TEST-FAIL" +else + echo " -> $test: TEST-PASS" +fi + +if [ $tst_mod_flag=1 ] +then + insmod $tst_mod_file +fi +rm -fr test_dir --
Quoted 1 line
1.8.3.1
Thanks for working on this.
Please address my comments and re-submit.
Thanks,
-- Tim
PATCH 1/1 Add test cases for command dhcpd.
In reply to Wang Mingyu--- .../tests/Functional.dhcpd/data/change_dhcpd.conf | 5 ++ engine/tests/Functional.dhcpd/data/dhcpd.conf | 18 +++++ engine/tests/Functional.dhcpd/dhcpd_test.sh | 4 ++ engine/tests/Functional.dhcpd/fuego_test.sh | 20 ++++++ engine/tests/Functional.dhcpd/parser.py | 22 ++++++ engine/tests/Functional.dhcpd/spec.json | 7 ++ .../tests/Functional.dhcpd/tests/dhcpd_pidfile.sh | 82 ++++++++++++++++++++++ engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh | 77 ++++++++++++++++++++ .../tests/Functional.dhcpd/tests/dhcpd_syslog.sh | 79 +++++++++++++++++++++ 9 files changed, 314 insertions(+) create mode 100644 engine/tests/Functional.dhcpd/data/change_dhcpd.conf create mode 100644 engine/tests/Functional.dhcpd/data/dhcpd.conf create mode 100755 engine/tests/Functional.dhcpd/dhcpd_test.sh create mode 100644 engine/tests/Functional.dhcpd/fuego_test.sh create mode 100644 engine/tests/Functional.dhcpd/parser.py create mode 100644 engine/tests/Functional.dhcpd/spec.json create mode 100644 engine/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh create mode 100644 engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh create mode 100644 engine/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
engine/tests/Functional.dhcpd/data/change_dhcpd.conf new file +5 -0
@@ -0,0 +1,5 @@ +#! /bin/sh + +echo " subnet 192.168.246.0 netmask 255.255.255.0 {" >> /etc/dhcp/dhcpd.conf +echo " range 192.168.246.200 192.168.246.210;" >> /etc/dhcp/dhcpd.conf +echo " } " >> /etc/dhcp/dhcpd.conf
engine/tests/Functional.dhcpd/data/dhcpd.conf new file +18 -0
@@ -0,0 +1,18 @@ +# /etc/dhcpd.conf + +ddns-update-style none; +#deny unknown-clients; +#allow bootp; + +# subnet 192.168.0.0 netmask 255.255.255.0 { +subnet 192.168.246.0 netmask 255.255.255.0 { + + range 192.168.246.100 192.168.246.110; +# option routers 192.168.0.1; + option broadcast-address 192.168.246.255; + + default-lease-time 3600; # 1h + max-lease-time 7200; # 2h + +} +
engine/tests/Functional.dhcpd/dhcpd_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.dhcpd/fuego_test.sh new file +20 -0
@@ -0,0 +1,20 @@ +function test_pre_check { + is_on_target_path dhcpd PROGRAM_DHCPD + assert_define PROGRAM_DHCPD "Missing 'dhcpd' program on target board" +} + +function test_deploy { + put $TEST_HOME/dhcpd_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/ + put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./dhcpd_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.dhcpd/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.dhcpd/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.dhcpd", + "specs": { + "default": {} + } +} +
engine/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh new file +82 -0
82 lines not on this page · raw message
+restore_target
engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh new file +77 -0
77 lines not on this page · raw message
+restore_target
engine/tests/Functional.dhcpd/tests/dhcpd_syslog.sh new file +79 -0
79 lines not on this page · raw message
+restore_target
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for commands of cross_compilation.
In reply to 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
engine/tests/Functional.cross_compilation/cross_compilation_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.cross_compilation/fuego_test.sh new file +42 -0
42 lines not on this page · raw message
engine/tests/Functional.cross_compilation/parser.py new file +22 -0
@@ -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))
engine/tests/Functional.cross_compilation/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.cross_compilation", + "specs": { + "default": {} + } +} +
engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh new file +15 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh new file +13 -0
@@ -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;
engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh new file +15 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh new file +15 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh new file +13 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh new file +15 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh new file +13 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh new file +13 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh new file +13 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh new file +15 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh new file +13 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh new file +15 -0
@@ -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
engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh new file +13 -0
@@ -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
Signature · 1 line
1.8.3.1
Quoted 4 lines
-----Original Message-----
From: Wang Mingyu
There should be something in the commit message body here.
Quoted 118 lines
Signed-off-by Wang Mingyu <[email protected]>--- engine/tests/Functional.ethtool/ethtool_test.sh | 4 ++++ engine/tests/Functional.ethtool/fuego_test.sh | 18 +++++++++++++++ engine/tests/Functional.ethtool/parser.py | 22 ++++++++++++++++++ engine/tests/Functional.ethtool/spec.json | 7 ++++++ .../Functional.ethtool/tests/ethtool_driver.sh | 25 +++++++++++++++++++++ .../tests/Functional.ethtool/tests/ethtool_help.sh | 13 +++++++++++ .../tests/Functional.ethtool/tests/ethtool_show.sh | 26 ++++++++++++++++++++++ 7 files changed, 115 insertions(+) create mode 100755 engine/tests/Functional.ethtool/ethtool_test.sh create mode 100644 engine/tests/Functional.ethtool/fuego_test.sh create mode 100644 engine/tests/Functional.ethtool/parser.py create mode 100644 engine/tests/Functional.ethtool/spec.json create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_driver.sh create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_help.sh create mode 100644
engine/tests/Functional.ethtool/tests/ethtool_show.shengine/tests/Functional.ethtool/ethtool_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.ethtool/fuego_test.sh new file +3
-0@@ -0,0 +1,18 @@ +function test_pre_check { + is_on_target_path ethtool PROGRAM_ETHTOOL + assert_define PROGRAM_ETHTOOL "Missing 'ethtool' program on targetboard"
engine/tests/Functional.ethtool/fuego_test.sh new file +15
-0+} + +function test_deploy { + put $TEST_HOME/ethtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./ethtool_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}engine/tests/Functional.ethtool/parser.py new file +22
-0@@ -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))engine/tests/Functional.ethtool/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.ethtool", + "specs": { + "default": {} + } +} +engine/tests/Functional.ethtool/tests/ethtool_driver.sh new file +8
-0@@ -0,0 +1,25 @@ +#!/bin/sh + +# In target, run command ethtool. +# option: -i + +test="driver" + +ETHERNET_DEVICE_NAME="have no Ethernet device"
engine/tests/Functional.ethtool/tests/ethtool_driver.sh line 18
Quoted 10 lines
engine/tests/Functional.ethtool/tests/ethtool_driver.sh new file +10
-0+ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list + +for line in $(cat driver_list) +do + if ethtool $line | grep "baseT" + then + ETHERNET_DEVICE_NAME=$line + break + fi +done
Very nice! Thanks for setting this up to autodetect the Ethernet device.
It would be good to check that ETHERNET_DEVICE_NAME got set, or fail the test here. You could do it with:
if echo $ETHERNET_DEVICE_NAME | grep "have no Ethernet device"
echo " -> $test: TEST-FAIL"
exit 1fi
Quoted 43 lines
engine/tests/Functional.ethtool/tests/ethtool_driver.sh new file +7
-0+ +if ethtool -i $ETHERNET_DEVICE_NAME | grep driver +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fiengine/tests/Functional.ethtool/tests/ethtool_help.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command ethtool. +# option: help + +test="help" + +if ethtool -h | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.ethtool/tests/ethtool_show.sh new file +9
-0@@ -0,0 +1,26 @@ +#!/bin/sh + +# In target, run command ethtool. +# option: none + +test="show" + +ETHERNET_DEVICE_NAME="have no Ethernet device" +ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
engine/tests/Functional.ethtool/tests/ethtool_show.sh line 19
Quoted 10 lines
engine/tests/Functional.ethtool/tests/ethtool_show.sh new file +10
-0+ +for line in $(cat driver_list) +do + if ethtool $line | grep "baseT" + then + ETHERNET_DEVICE_NAME=$line + break + fi +done +
I would be nice to put this into a test-specific library.
Quoted 9 lines
engine/tests/Functional.ethtool/tests/ethtool_show.sh new file +7
-1+ +if ethtool $ETHERNET_DEVICE_NAME | grep "Settings for" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi --1.8.3.1
Despite my list of possible improvements, I'm applying this as is (well, I'm going to add some text to the commit body). Please feel free to send a patch with the requested improvements, if you can.
Thanks,
-- Tim