Add settings of board to lib file.
PATCH 1/1 Add settings of board to lib file.
--- engine/scripts/fuego_board_function_lib.sh | 6 ++++++ 1 file changed, 6 insertions(+)
engine/scripts/fuego_board_function_lib.sh +6 -0
@@ -11,6 +11,12 @@ init_manager="init_manager-not-set" logger_service="logger_service-not-set" +test_krnl_rel="$(uname -r | xargs echo)" +tst_mod_file="ah4" +tst_mod_dir="net/ipv4/" +test_tcpip_host="192.168.246.2" +test_tcpip="192.168.246.100" +remote_ifeth="eth0" # set_init_manager: # detects and sets the init_manager variable, which indicates which
Signature · 1 line
1.8.3.1
PATCH 1/1 Add test cases for commands of net-tools.
--- .../Functional.net-tools/create_xml_net-tools.py | 86 ---------------------- .../tests/Functional.net-tools/data/dns_test.txt | 1 + .../tests/Functional.net-tools/data/host_test.txt | 1 + engine/tests/Functional.net-tools/data/hosts | 3 + engine/tests/Functional.net-tools/fuego_test.sh | 47 +++++++++--- .../tests/Functional.net-tools/net-tools_test.sh | 4 + engine/tests/Functional.net-tools/parser.py | 22 ++++++ .../Functional.net-tools/tests/net-tools_arp1.sh | 16 ++++ .../Functional.net-tools/tests/net-tools_arp2.sh | 18 +++++ .../tests/net-tools_dnsdomainname.sh | 18 +++++ .../tests/net-tools_domainname1.sh | 13 ++++ .../tests/net-tools_domainname2.sh | 15 ++++ .../tests/net-tools_domainname3.sh | 13 ++++ .../tests/net-tools_domainname4.sh | 14 ++++ .../tests/net-tools_hostname1.sh | 14 ++++ .../tests/net-tools_hostname2.sh | 15 ++++ .../tests/net-tools_hostname3.sh | 14 ++++ .../tests/net-tools_hostname4.sh | 15 ++++ .../tests/net-tools_ifconfig1.sh | 13 ++++ .../tests/net-tools_ifconfig2.sh | 14 ++++ .../tests/net-tools_ifconfig3.sh | 14 ++++ .../tests/net-tools_ipmaddr.sh | 12 +++ .../tests/net-tools_iptunnel.sh | 19 +++++ .../tests/net-tools_netstat1.sh | 12 +++ .../tests/net-tools_netstat2.sh | 17 +++++ .../tests/net-tools_netstat3.sh | 13 ++++ .../tests/net-tools_netstat4.sh | 13 ++++ .../tests/net-tools_netstat5.sh | 18 +++++ .../tests/net-tools_nisdomainname1.sh | 13 ++++ .../tests/net-tools_nisdomainname2.sh | 16 ++++ .../Functional.net-tools/tests/net-tools_route.sh | 16 ++++ .../tests/net-tools_ypdomainname1.sh | 13 ++++ .../tests/net-tools_ypdomainname2.sh | 15 ++++ 33 files changed, 449 insertions(+), 98 deletions(-) delete mode 100755 engine/tests/Functional.net-tools/create_xml_net-tools.py create mode 100644 engine/tests/Functional.net-tools/data/dns_test.txt create mode 100644 engine/tests/Functional.net-tools/data/host_test.txt create mode 100644 engine/tests/Functional.net-tools/data/hosts mode change 100755 => 100644 engine/tests/Functional.net-tools/fuego_test.sh create mode 100644 engine/tests/Functional.net-tools/net-tools_test.sh create mode 100644 engine/tests/Functional.net-tools/parser.py create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_arp1.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_arp2.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_dnsdomainname.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_domainname1.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_domainname2.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_domainname3.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_domainname4.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_hostname1.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_hostname2.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_hostname3.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_hostname4.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_ifconfig1.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_ifconfig2.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_ifconfig3.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_ipmaddr.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_iptunnel.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_netstat1.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_netstat2.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_netstat3.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_netstat4.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_netstat5.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_nisdomainname1.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_nisdomainname2.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_route.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_ypdomainname1.sh create mode 100644 engine/tests/Functional.net-tools/tests/net-tools_ypdomainname2.sh
engine/tests/Functional.net-tools/create_xml_net-tools.py deleted +0 -86
@@ -1,86 +0,0 @@ -#!/usr/bin/python - -import os, re, sys, time, collections - -jta_home = os.environ.get('JTA_ENGINE_PATH', '/home/jenkins') -testname = os.environ.get('JOB_NAME', "Functional.net-tools") - -ret_val = 0 -parser_path = "%s/scripts/detailed_results/" % jta_home -sys.path.insert(0, parser_path) -import xmltodict - -cur_dict = collections.OrderedDict() -cur_dict['report'] = collections.OrderedDict() -cur_dict['report']['name'] = testname - -# Get build number -number_file = "%s/jta/jobs/%s/nextBuildNumber" % (jta_home, testname) -file_hd = open(number_file, 'r') -number_line = file_hd.read() -file_hd.close -number = int(number_line.strip()) - 1 -number = int(os.environ.get('BUILD_NUMBER', number)) - -# Get start time and result of the testset -build_xml = "%s/jta/jobs/%s/builds/%d/build.xml" % (jta_home, testname, number) -build_file = open(build_xml, 'rb') -build_raw_values = build_file.read() -build_file.close() -build_dict = xmltodict.parse(build_raw_values) -start_sec = int(build_dict['build']['startTime']) / 1000 -cur_dict['report']['starttime'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(start_sec)) -log = "%s/jta/jobs/%s/builds/%d/log" % (jta_home, testname, number) -cur_dict['report']['endtime'] = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(os.path.getmtime(log))) -cur_dict['report']['result'] = str(build_dict['build']['result']) - -# Get result and value of the testcase -cur_dict['report']['items'] = collections.OrderedDict({'item': []}) -log_file = open(log, 'r') -log_raw_lines = log_file.readlines() -log_file.close() - -for line in log_raw_lines: - if line.startswith("++++ BOARD_VER"): - cur_dict['report']['board_version'] = line.split("=")[1].strip() - if line.startswith("++++ DEVICE_TEST"): - cur_dict['report']['device'] = line.split("=")[1].strip() - if line.startswith("++++ DEVICE_FS"): - cur_dict['report']['filesystem'] = line.split("=")[1].strip() - if line.startswith("++++ TESTLOG"): - test_log = line.split("=")[1].strip() - if line.startswith("+++ report "): - tmp_cmd = line.split(";")[0] - cur_dict['report']['test_dir'] = tmp_cmd.split()[3] - tmp_cmd = line.split(";")[1].strip() - cur_dict['report']['command_line'] = tmp_cmd.split("'")[0] - break - -cur_search_pat = re.compile("^(TEST-[\d]+) (.*)$", re.MULTILINE) -cur_file = open(test_log, 'r') -pat_result = cur_search_pat.findall(cur_file.read()) -cur_file.close() - -if pat_result: - for i in range(0, len(pat_result)): - ditem = collections.OrderedDict() - cur_dict['report']['items']['item'].append(ditem) - ditem['name'] = "%s" % pat_result[i][0] - if ((pat_result[i][1]).strip() == "OK"): - ditem['result'] = "PASS" - else: - ditem['result'] = "FAIL" - ret_val = 1 -if (ret_val == 1): - cur_dict['report']['result'] = "FAILURE" -print cur_dict - -content = xmltodict.unparse(cur_dict, pretty=True) - -cur_xml = "%s/jta/jobs/%s/builds/%d/test_result.xml" % (jta_home, testname, number) -cur_file = open(cur_xml, 'wb') -cur_file.write(content) -cur_file.close() - -sys.exit(ret_val) -
engine/tests/Functional.net-tools/data/dns_test.txt new file +1 -0
@@ -0,0 +1 @@ +abc.com
engine/tests/Functional.net-tools/data/host_test.txt new file +1 -0
@@ -0,0 +1 @@ +testlinux
engine/tests/Functional.net-tools/data/hosts new file +3 -0
@@ -0,0 +1,3 @@ +# Do not remove the following line, or various programs +# that require network functionality will fail. +127.0.0.1 localhost.localdomain localhost
engine/tests/Functional.net-tools/fuego_test.sh +35 -12
52 lines not on this page · raw message
engine/tests/Functional.net-tools/net-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.net-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.net-tools/tests/net-tools_arp1.sh new file +16 -0
@@ -0,0 +1,16 @@ +#!/bin/sh + +# In target, run command arp and add an ARP entry to the command line. +# option -s + +test="arp1" + +. ./fuego_board_function_lib.sh + +if arp -s $test_tcpip 00:01:01:01:01:01 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +arp -d &test_tcpip
engine/tests/Functional.net-tools/tests/net-tools_arp2.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh + +# In target, run command arp and display an ARP entry. +# option -a + +test="arp2" + +. ./fuego_board_function_lib.sh + +arp -s $test_tcpip 00:01:01:01:01:01 + +if arp -a $test_tcpip | grep $test_tcpip +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +arp -d $test_tcpip
engine/tests/Functional.net-tools/tests/net-tools_dnsdomainname.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh + +# In target, run command dnsdomainname to display the domain name. + +test="dnsdomainname" + +mkdir test_dir + +hostname > test_dir/hostname +hostname localhost.localdomain +if dnsdomainname | grep localdomain +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +hostname $(cat test_dir/hostname) +rm -fr test_dir
engine/tests/Functional.net-tools/tests/net-tools_domainname1.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command domainname and specify the domain name from the command line. + +test="domainname1" + +if domainname abc.com +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +domainname localdomain
engine/tests/Functional.net-tools/tests/net-tools_domainname2.sh new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# In target, run command domainname and specify the domain name from the command line, dodoname again resets the contents of the configuration. + +test="domainname2" + +domainname abc.com + +if domainname | grep "abc.com" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +domainname localdomain
engine/tests/Functional.net-tools/tests/net-tools_domainname3.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command domainname and specify the domain name from the file. + +test="domainname3" + +if domainname -F data/dns_test.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +domainname localdomain
engine/tests/Functional.net-tools/tests/net-tools_domainname4.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +# In target, run command domainname and specify the domain name from the file again, domainname is done again to confirm the contents of the configuration. + +test="domainname4" + +domainname -F data/dns_test.txt +if domainname | grep "abc.com" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +domainname localdomain
engine/tests/Functional.net-tools/tests/net-tools_hostname1.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +# In target, run command hostname and specify the host name from the command line. + +test="hostname1" + +if hostname testlinux +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +hostname localhost.localdomain +hostname localhost
engine/tests/Functional.net-tools/tests/net-tools_hostname2.sh new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# In target, run command hostname and the host name is specified from the command line, the hostname is executed again, and the acquisition of the contents is set. + +test="hostname2" + +hostname testlinux +if hostname | grep "testlinux" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +hostname localhost.localdomain +hostname localhost
engine/tests/Functional.net-tools/tests/net-tools_hostname3.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +# In target, run command hostname and specify the hostname from the file. + +test="hostname3" + +if hostname -F data/host_test.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +hostname localhost.localdomain +hostname localhost
engine/tests/Functional.net-tools/tests/net-tools_hostname4.sh new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# In target, run command hostname and the hostname is specified from the file, the hostname is executed again and the acquisition of the contents is set. + +test="hostname4" + +hostname -F data/host_test.txt +if hostname | grep testlinux +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +hostname localhost.localdomain +hostname localhost
engine/tests/Functional.net-tools/tests/net-tools_ifconfig1.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command fconfig lo down to down the IF. + +test="ifconfig1" + +if ifconfig lo down +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +ifconfig lo up
engine/tests/Functional.net-tools/tests/net-tools_ifconfig2.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +# In target, run command fconfig lo down and ifconfig lo up to corfirm the output "UP". + +test="ifconfig2" + +ifconfig lo down +ifconfig lo up +if ifconfig lo | grep UP +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.net-tools/tests/net-tools_ifconfig3.sh new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +# In target, run command fconfig lo inet to set the address to IF. + +test="ifconfig3" + +ifconfig lo inet 127.0.0.2 +if ifconfig lo | grep "127.0.0.2" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +ifconfig lo inet 127.0.0.1
engine/tests/Functional.net-tools/tests/net-tools_ipmaddr.sh new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/sh + +# In target, run command ipmaddr show dev lo to display the address. + +test="ipmaddr" + +if ipmaddr show dev lo | grep inet +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.net-tools/tests/net-tools_iptunnel.sh new file +19 -0
@@ -0,0 +1,19 @@ +#!/bin/sh + +# In target, run command iptunnel show to display the address. + +test="iptunnel" + +modprobe sit + +if [ ! -f /sbin/iptunnel ] && [ -f /sbin/iptunnel.net-tools ] +then + ln -sf /sbin/iptunnel.net-tools /sbin/iptunnel +fi + +if iptunnel show | grep sit0 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.net-tools/tests/net-tools_netstat1.sh new file +12 -0
@@ -0,0 +1,12 @@ +#!/bin/sh + +# In target, run command netstat to display all socket information. + +test="netstat1" + +if netstat +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.net-tools/tests/net-tools_netstat2.sh new file +17 -0
@@ -0,0 +1,17 @@ +#!/bin/sh + +# In target, run command netstat to display listening socket information. +# option: -a + +test="netstat2" + +mkdir test_dir +netstat -a > test_dir/netstat.log + +if cat test_dir/netstat.log | grep telnet +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test_dir
engine/tests/Functional.net-tools/tests/net-tools_netstat3.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command netstat to display TCP statistics. +# option: -s, -t + +test="netstat3" + +if netstat -s -t | grep Tcp +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.net-tools/tests/net-tools_netstat4.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command netstat to display multicast group membership information. +# option: -g + +test="netstat4" + +if netstat -gn | grep "IPv6/IPv4 Group Memberships" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.net-tools/tests/net-tools_netstat5.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh + +# In target, run command netstat to display the routing table information. +# option: -r + +test="netstat5" + +. ./fuego_board_function_lib.sh + +route add default gw $test_tcpip_host + +if netstat -r | grep default +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +route del default
engine/tests/Functional.net-tools/tests/net-tools_nisdomainname1.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command nisdomainname and specify the domain name from the command line. + +test="nisdomainname1" + +if nisdomainname testnis +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +domainname localdomain
engine/tests/Functional.net-tools/tests/net-tools_nisdomainname2.sh new file +16 -0
@@ -0,0 +1,16 @@ +#!/bin/sh + +# In target, run command nisdomainname and specify the domain name from the command line. +# Then run the iodomainname to verify the contents of the configuration. + +test="nisdomainname2" + +nisdomainname testnis + +if nisdomainname | grep testnis +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +nisdomainname localdomain
engine/tests/Functional.net-tools/tests/net-tools_route.sh new file +16 -0
@@ -0,0 +1,16 @@ +#!/bin/sh + +# In target, add the route and then delete it. + +test="route" + +. ./fuego_board_function_lib.sh + +route add -net 192.168.2.0 netmask 255.255.255.0 dev $remote_ifeth + +if route del -net 192.168.2.0 netmask 255.255.255.0 dev $remote_ifeth +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.net-tools/tests/net-tools_ypdomainname1.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command ypdomainname and specify the domain name from the command line. + +test="ypdomainname1" + +if ypdomainname testnis +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +ypdomainname localdomain
engine/tests/Functional.net-tools/tests/net-tools_ypdomainname2.sh new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# In target, run command ypdomainname and specify the domain name from the command line. +# Then run ypdomainname again to verify the contents of the configuration. + +test="ypdomainname2" + +ypdomainname testyp +if ypdomainname | grep testyp +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +ypdomainname localdomain
Signature · 1 line
1.8.3.1
PATCH 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 | 19 ++++++++++++++ .../tests/module-init-tools_insmod.sh | 21 ++++++++++++++++ .../tests/module-init-tools_lsmod.sh | 23 +++++++++++++++++ .../tests/module-init-tools_modinfo.sh | 23 +++++++++++++++++ .../tests/module-init-tools_modprobe.sh | 24 ++++++++++++++++++ .../tests/module-init-tools_rmmod.sh | 22 ++++++++++++++++ 10 files changed, 194 insertions(+) create mode 100644 engine/tests/Functional.module-init-tools/fuego_test.sh create mode 100644 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 'rnmod' 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;\ + sh -v 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 +19 -0
@@ -0,0 +1,19 @@ +#!/bin/sh + +# In target, run command depmod. +# option: none + +test="depmod" + +. ./fuego_board_function_lib.sh + +rm -f /lib/modules/$test_krnl_rel/modules.dep + +depmod + +if ls -l /lib/modules/$test_krnl_rel/modules.dep +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh + +# In target, run command insmod. +# option: none + +test="insmod" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko test_dir/ + +if insmod test_dir/$tst_mod_file.ko +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_lsmod.sh new file +23 -0
@@ -0,0 +1,23 @@ +#!/bin/sh + +# In target, run command lsmod. +# option: none + +test="lsmod" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko test_dir/ + +insmod test_dir/$tst_mod_file.ko + +if lsmod |grep $tst_mod_file | grep "$tst_mod_file .*" +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 +23 -0
@@ -0,0 +1,23 @@ +#!/bin/sh + +# In target, run command modinfo. +# option: none + +test="modinfo" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko test_dir/ + +insmod test_dir/$tst_mod_file.ko + +if modinfo test_dir/$tst_mod_file.ko | grep -z "filename.*$test_krnl_rel.*" +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_modprobe.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh + +# In target, run command modprobe. +# option: modprobe + +test="modprobe" + +. ./fuego_board_function_lib.sh + +if modprobe -D $tst_mod_file | grep "insmod /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko" +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 $tst_mod_file | grep "kernel/$tst_mod_dir$tst_mod_file.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 +22 -0
@@ -0,0 +1,22 @@ +#!/bin/sh + +# In target, run command rmmod. +# option: none + +test="rmmod" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko test_dir/ + +insmod test_dir/$tst_mod_file.ko + +if rmmod $tst_mod_file +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +rm -fr test_dir
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH] Add test cases for commands of module-init-tools.
These tests will have to be re-worked to not use function_lib for board-specific and lab-specific funtions, but see my other comments inline below as well.
Quoted 55 lines
-----Original Message-----
From: Wang MingyuSigned-off-by Wang Mingyu <[email protected]>--- .../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 | 19 ++++++++++++++ .../tests/module-init-tools_insmod.sh | 21 ++++++++++++++++ .../tests/module-init-tools_lsmod.sh | 23 +++++++++++++++++ .../tests/module-init-tools_modinfo.sh | 23 +++++++++++++++++ .../tests/module-init-tools_modprobe.sh | 24 ++++++++++++++++++ .../tests/module-init-tools_rmmod.sh | 22 ++++++++++++++++ 10 files changed, 194 insertions(+) create mode 100644 engine/tests/Functional.module-init- tools/fuego_test.sh create mode 100644 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 'rnmod' program on target
Quoted 1 line
board"
'rnmod' should be 'rmmod' in this error string.
Quoted 88 lines
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 ontarget board"
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;\ + sh -v 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 100644
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..f72a1f8engine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_depmod.sh
engine/tests/Functional.module-init-tools/tests/module-init- line 8
Quoted 8 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +8
-0@@ -0,0 +1,19 @@ +#!/bin/sh + +# In target, run command depmod. +# option: none + +test="depmod" + +. ./fuego_board_function_lib.sh
should just do:
test_krnl_rel=$(uname -r)
locally in this file, instead of getting it from fuego_board_function_lib.sh
engine/tests/Functional.module-init-tools/tests/module-init- line 10
Quoted 2 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +2
-0+ +rm -f /lib/modules/$test_krnl_rel/modules.dep
This is not acceptable.
If the test fails, then the machine is left without modules.dep. Please save this off, if it exists. You may also way to use it to check that the data produced by depmod matches the pre-existing file.
engine/tests/Functional.module-init-tools/tests/module-init- line 12
Quoted 2 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +2
-0+ +depmod
Also, if there wasn't a modules.dep before, this will leave one around on the target. There are valid reasons (mainly having to do with size) why a product would not want a modules.dep file on the board in a production system.
engine/tests/Functional.module-init-tools/tests/module-init- line 19
Quoted 7 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +7
-0+ +if ls -l /lib/modules/$test_krnl_rel/modules.dep +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
If modules.dep did not exist before the test was run, it should be removed here after creating it.
Quoted 10 lines
(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..233d7e3engine/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,21 @@ +#!/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" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko
How do you know if the specified kernel module will be present? Many embedded systems strip the modules down to just those used by the system. You should at least check that the file exists before trying to copy it.
And, this should either be auto-detected or specified using a board or spec variable.
engine/tests/Functional.module-init-tools/tests/module-init-
Quoted 10 lines
test_dir/
engine/tests/Functional.module-init-tools/tests/module-init- new file +9
-0+ +if insmod test_dir/$tst_mod_file.ko +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; + +rmmod $tst_mod_file
Not all modules can be safely removed. I presume you've checked to see if net/ipv4/ah4 can be safely loaded and removed. (I just looked at it, and it seems safe - but I'm not familiar with this module.)
Also, this assumes that the module was not loaded before the test. I don't know how commonly net/ipv4/ah4 is used, but it's bad practice to leave the machine in a different state than you found it in.
IOW, you should not rmmod if the module was already loaded before the test. This cleanup should probably go in the insmod PASS branch of the if (because presumably you'll get a FAIL if the module is already loaded).
Quoted 21 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +1
-0+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..667681dengine/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 +11
-0@@ -0,0 +1,23 @@ +#!/bin/sh + +# In target, run command lsmod. +# option: none + +test="lsmod" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko
Quoted 1 line
test_dir/
Should check that module exists before using it. Should use board-specific or spec-specific module name.
engine/tests/Functional.module-init-tools/tests/module-init-
Quoted 4 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +4
-0+ +insmod test_dir/$tst_mod_file.ko + +if lsmod |grep $tst_mod_file | grep "$tst_mod_file .*"
What is the second grep for?
Quoted 50 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +8
-0+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..8275978engine/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 +11
-0@@ -0,0 +1,23 @@ +#!/bin/sh + +# In target, run command modinfo. +# option: none + +test="modinfo" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.kotest_dir/
engine/tests/Functional.module-init-tools/tests/module-init- new file +12
-0+ +insmod test_dir/$tst_mod_file.ko + +if modinfo test_dir/$tst_mod_file.ko | grep -z "filename.*$test_krnl_rel.*" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; + +rmmod $tst_mod_file +rm -fr test_dir(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..f71805bengine/tests/Functional.module-init-tools/tests/module-init- new file +0
-0
tools_modprobe.sh
engine/tests/Functional.module-init-tools/tests/module-init- line 10
Quoted 10 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +10
-0@@ -0,0 +1,24 @@ +#!/bin/sh + +# In target, run command modprobe. +# option: modprobe + +test="modprobe" + +. ./fuego_board_function_lib.sh + +if modprobe -D $tst_mod_file | grep "insmod
shouldn't this be '-d' (little 'd')? I don't see an option '-D' supported by modprobe in its man page.
Quoted 36 lines
/lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko"engine/tests/Functional.module-init-tools/tests/module-init- new file +9
-0+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 $tst_mod_file | grep"kernel/$tst_mod_dir$tst_mod_file.ko:.*"
engine/tests/Functional.module-init-tools/tests/module-init- new file +5
-0+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..9e76f16engine/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 +11
-0@@ -0,0 +1,22 @@ +#!/bin/sh + +# In target, run command rmmod. +# option: none + +test="rmmod" + +. ./fuego_board_function_lib.sh + +mkdir test_dir +cp -a /lib/modules/$test_krnl_rel/kernel/$tst_mod_dir$tst_mod_file.ko
Quoted 1 line
test_dir/
Same issues as mentioned elsewhere.
engine/tests/Functional.module-init-tools/tests/module-init-
Quoted 4 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +4
-0+ +insmod test_dir/$tst_mod_file.ko + +if rmmod $tst_mod_file
Actually, it would be better to do lsmod to make sure the module is now gone, rather than just rely on rmmod's exit code. (or grep /proc/modules).
Quoted 9 lines
engine/tests/Functional.module-init-tools/tests/module-init- new file +7
-1+then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi + +rm -fr test_dir --1.8.3.1
Thanks for the submission. Please fix up the mentioned issues and re-submit.
-- Tim
PATCH 1/1 Add test cases for command tar.
In reply to Wang Mingyu--- engine/tests/Functional.tar/data/test.tar | Bin 0 -> 10240 bytes engine/tests/Functional.tar/data/test.tar.bz2 | Bin 0 -> 337 bytes engine/tests/Functional.tar/data/test.tar.gz | Bin 0 -> 319 bytes engine/tests/Functional.tar/fuego_test.sh | 19 ++++++++++++++++ engine/tests/Functional.tar/parser.py | 22 +++++++++++++++++++ engine/tests/Functional.tar/spec.json | 7 ++++++ engine/tests/Functional.tar/tar_test.sh | 4 ++++ engine/tests/Functional.tar/tests/tar_create01.sh | 24 +++++++++++++++++++++ engine/tests/Functional.tar/tests/tar_create02.sh | 24 +++++++++++++++++++++ engine/tests/Functional.tar/tests/tar_create03.sh | 24 +++++++++++++++++++++ engine/tests/Functional.tar/tests/tar_extract01.sh | 21 ++++++++++++++++++ engine/tests/Functional.tar/tests/tar_extract02.sh | 21 ++++++++++++++++++ engine/tests/Functional.tar/tests/tar_extract03.sh | 21 ++++++++++++++++++ engine/tests/Functional.tar/tests/tar_help.sh | 13 +++++++++++ engine/tests/Functional.tar/tests/tar_list01.sh | 13 +++++++++++ engine/tests/Functional.tar/tests/tar_list02.sh | 13 +++++++++++ engine/tests/Functional.tar/tests/tar_list03.sh | 13 +++++++++++ 17 files changed, 239 insertions(+) create mode 100644 engine/tests/Functional.tar/data/test.tar create mode 100644 engine/tests/Functional.tar/data/test.tar.bz2 create mode 100644 engine/tests/Functional.tar/data/test.tar.gz create mode 100644 engine/tests/Functional.tar/fuego_test.sh create mode 100644 engine/tests/Functional.tar/parser.py create mode 100644 engine/tests/Functional.tar/spec.json create mode 100644 engine/tests/Functional.tar/tar_test.sh create mode 100644 engine/tests/Functional.tar/tests/tar_create01.sh create mode 100644 engine/tests/Functional.tar/tests/tar_create02.sh create mode 100644 engine/tests/Functional.tar/tests/tar_create03.sh create mode 100644 engine/tests/Functional.tar/tests/tar_extract01.sh create mode 100644 engine/tests/Functional.tar/tests/tar_extract02.sh create mode 100644 engine/tests/Functional.tar/tests/tar_extract03.sh create mode 100644 engine/tests/Functional.tar/tests/tar_help.sh create mode 100644 engine/tests/Functional.tar/tests/tar_list01.sh create mode 100644 engine/tests/Functional.tar/tests/tar_list02.sh create mode 100644 engine/tests/Functional.tar/tests/tar_list03.sh
engine/tests/Functional.tar/data/test.tar new file binary +0 -0
engine/tests/Functional.tar/data/test.tar.bz2 new file binary +0 -0
engine/tests/Functional.tar/data/test.tar.gz new file binary +0 -0
engine/tests/Functional.tar/fuego_test.sh new file +19 -0
@@ -0,0 +1,19 @@ +function test_pre_check { + is_on_target_path tar PROGRAM_TAR + assert_define PROGRAM_TAR "Missing 'tar' program on target board" +} + +function test_deploy { + put $TEST_HOME/tar_test.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;\ + sh -v tar_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.tar/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.tar/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.tar", + "specs": { + "default": {} + } +} +
engine/tests/Functional.tar/tar_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.tar/tests/tar_create01.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh + +# In target, run command tar. +# option: cf + +test="create01" + +mkdir test_dir + +if tar cf mytest.tar test_dir +then + echo "creation of tar is succeeded." +else + echo "creation of tar is failed." + exit +fi + +if test -f mytest.tar +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test_dir
engine/tests/Functional.tar/tests/tar_create02.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh + +# In target, run command tar. +# option: czf(gzip) + +test="create02" + +mkdir test_dir + +if tar czf mytest.tar.gz test_dir +then + echo "creation of tar is succeeded." +else + echo "creation of tar is failed." + exit +fi + +if test -f mytest.tar.gz +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test_dir
engine/tests/Functional.tar/tests/tar_create03.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/bin/sh + +# In target, run command tar. +# option: cjf(bzip2) + +test="create03" + +mkdir test_dir + +if tar cf mytest.tar.bz2 test_dir +then + echo "creation of tar is succeeded." +else + echo "creation of tar is failed." + exit +fi + +if test -f mytest.tar.bz2 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test_dir
engine/tests/Functional.tar/tests/tar_extract01.sh new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh + +# In target, run command tar. +# option: xf + +test="extract01" + +if tar xf data/test.tar +then + echo " -> tar xf is succeeded." +else + echo " -> tar xf is failed." +fi + +if test -f test/data/test_a.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test
engine/tests/Functional.tar/tests/tar_extract02.sh new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh + +# In target, run command tar. +# option: xzf(gzip) + +test="extract02" + +if tar xzf data/test.tar.gz +then + echo " -> tar xzf is succeeded." +else + echo " -> tar xzf is failed." +fi + +if test -f test/data/test_b.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test
engine/tests/Functional.tar/tests/tar_extract03.sh new file +21 -0
@@ -0,0 +1,21 @@ +#!/bin/sh + +# In target, run command tar. +# option: xjf(bzip2) + +test="extract03" + +if tar xjf data/test.tar.bz2 +then + echo " -> tar xjf is succeeded." +else + echo " -> tar xjf is failed." +fi + +if test -f test/data/test_c.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test
engine/tests/Functional.tar/tests/tar_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: --help + +test="help" + +if tar --help | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.tar/tests/tar_list01.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: tf + +test="list01" + +if tar tf data/test.tar | grep "test_a.txt" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.tar/tests/tar_list02.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: tzf(gzip) + +test="list02" + +if tar tzf data/test.tar.gz | grep "test_b.txt" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.tar/tests/tar_list03.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: tjf(bzip2) + +test="list03" + +if tar tjf data/test.tar.bz2 | grep "test_c.txt" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
Signature · 1 line
1.8.3.1
Re: [Fuego] [PATCH] Add test cases for command tar.
Sorry to just get to this now.
See comments inline below.
Quoted 214 lines
-----Original Message-----
From: Wang MingyuSigned-off-by Wang Mingyu <[email protected]>--- engine/tests/Functional.tar/data/test.tar | Bin 0 -> 10240 bytes engine/tests/Functional.tar/data/test.tar.bz2 | Bin 0 -> 337 bytes engine/tests/Functional.tar/data/test.tar.gz | Bin 0 -> 319 bytes engine/tests/Functional.tar/fuego_test.sh | 19 ++++++++++++++++ engine/tests/Functional.tar/parser.py | 22 +++++++++++++++++++ engine/tests/Functional.tar/spec.json | 7 ++++++ engine/tests/Functional.tar/tar_test.sh | 4 ++++ engine/tests/Functional.tar/tests/tar_create01.sh | 24 +++++++++++++++++++++ engine/tests/Functional.tar/tests/tar_create02.sh | 24 +++++++++++++++++++++ engine/tests/Functional.tar/tests/tar_create03.sh | 24 +++++++++++++++++++++ engine/tests/Functional.tar/tests/tar_extract01.sh | 21 ++++++++++++++++++ engine/tests/Functional.tar/tests/tar_extract02.sh | 21 ++++++++++++++++++ engine/tests/Functional.tar/tests/tar_extract03.sh | 21 ++++++++++++++++++ engine/tests/Functional.tar/tests/tar_help.sh | 13 +++++++++++ engine/tests/Functional.tar/tests/tar_list01.sh | 13 +++++++++++ engine/tests/Functional.tar/tests/tar_list02.sh | 13 +++++++++++ engine/tests/Functional.tar/tests/tar_list03.sh | 13 +++++++++++ 17 files changed, 239 insertions(+) create mode 100644 engine/tests/Functional.tar/data/test.tar create mode 100644 engine/tests/Functional.tar/data/test.tar.bz2 create mode 100644 engine/tests/Functional.tar/data/test.tar.gz create mode 100644 engine/tests/Functional.tar/fuego_test.sh create mode 100644 engine/tests/Functional.tar/parser.py create mode 100644 engine/tests/Functional.tar/spec.json create mode 100644 engine/tests/Functional.tar/tar_test.sh create mode 100644 engine/tests/Functional.tar/tests/tar_create01.sh create mode 100644 engine/tests/Functional.tar/tests/tar_create02.sh create mode 100644 engine/tests/Functional.tar/tests/tar_create03.sh create mode 100644 engine/tests/Functional.tar/tests/tar_extract01.sh create mode 100644 engine/tests/Functional.tar/tests/tar_extract02.sh create mode 100644 engine/tests/Functional.tar/tests/tar_extract03.sh create mode 100644 engine/tests/Functional.tar/tests/tar_help.sh create mode 100644 engine/tests/Functional.tar/tests/tar_list01.sh create mode 100644 engine/tests/Functional.tar/tests/tar_list02.sh create mode 100644 engine/tests/Functional.tar/tests/tar_list03.shengine/tests/Functional.tar/data/test.tar new file +0
-0index 0000000000000000000000000000000000000000..e2b9be0195b799077248b8a9e
50e8dcf5dc58050
GIT binary patch
literal 10240 zcmeI0TXKUS7=?MxDqKMe$faFPhg^D3FA>|ct1oDWs*^N42- @l4L8B1(J%<l}v75@C
zleC4pqO~N=S&81+- *bg9Dk&2}tJ1Y&OejSPnKrDp_qwuXR}e$8e7%JM?6)3{GYR~ zvEF}w;AeJk(}d~Rs- Ml_qDHcb_f5Z;LiV&D@F>MCY*k+|J;AdcqydP7ncjOT&*|P zH@A2950BfY=a<)AW$U;1{m17bu2o- HT>S+F0{?6}{;5!bf5BPHKL!6e<2luq4Ipk zX!u_nYZ4}b{v98i|7ofn|Gd;1CpD%^W(q&b!Ae#1- $>i<$vAvUrE3I3&AAT{~Z2f
z{m- HDe8(8@znp^q?)P8dpM(D#vnG!JxK=sh#Ter%FyMbR3IB?R@4vvm+yBG<&$ wP6 z>Mf4!F<Tvq0{5m;pyA&i$`s_cPjxE)XC3~f+xYkUzq$nfIp)NeWXJWD<EbzP6o3 Ly
W017|>C;$bZ02F`%Pyh-H75D-+Cs_ahliteral 0
HcmV?d00001engine/tests/Functional.tar/data/test.tar.bz2 new file +0
-0index 0000000000000000000000000000000000000000..0fc3958f26621b6f3a5ff88fe61
b2018ed55e706
GIT binary patch
literal 337
zcmV- X0j~Z+T4*^jL0KkKS!>kUBLD(_|L(?+0RTV&|KI=w5eWbP|L_0^0DvF>00IDj z00=Mvm;e|627mypa1~S7yt%<0Lh>L0MG?V6vPpxr<7zKrfLAl+L|<Gr+Dv8ElI J+ zz*9|8QY#@O!w!y(zKz!0n5ZiFV}+$*eUoNoJ|3=P%J!2(o2lPh_LM8!%oe2^$ MC3 zUpOZH^;KNK*Vkxt&owDjw4Fnob!yp~bYeZte!2|kyc%6XJc!+cf69(oAZSEXH ZZ
z@- im%up3svhM}Hai7>j&3$tcQkj<l+D3{8z!pfKhO!a0&%ud2wb4na6Y$Xqg_zc}d zuVFYI(qc@Ke981D)SqH~$=Xihcn9R03Eoa5{S$ETCrIKpB;q@XxI9x@O$84wUA 4(>
jThk!OpVXlL4MgWBku08M)=os+5BR&1DZ+$<UZ%+yalx7lliteral 0
HcmV?d00001engine/tests/Functional.tar/data/test.tar.gz new file +0
-0index 0000000000000000000000000000000000000000..7c007661ee1356f97845065103
fdcd4ed96b03fa
GIT binary patch
literal 319
zcmV- F0l@wriwFQFPzFT+1MQgWPQxG=hWWj#=oL($A0K)(h8;Z5!=P?@^_I@muEu B+
zp;JqKT4C56!P}@3WT)}XCfK##(b|nU2~|gpx)oBFkmnPbp#+g- JZFhRO%GEehczF8J!_e!o3GQ9{f=Ui3WdLz;KQfVr1@H~%{BHh)99&cD>GL?P1*=aA- FO@FIusy$+
zxy5p|zPi4- y}N(dJU%_YY<;L+cl)>Z+24ANJr^*X)_*mg|B|@%pR_voFX4X<VD_|W z{9n1?5- tLVtpBXE%{OT+)_*zp%0J#+x)gtbA@!e4tp7yHp#J9o^?%y*{9laWe|Pa zmf=C4zT~5Ha-8BqxjGIyZ;RTbMT-3qe3}?fFkR;wjKf5Y6I|JV}#=K%f#00000 R006)=_yE(zxoiL^006m+sr3K=literal 0
HcmV?d00001engine/tests/Functional.tar/fuego_test.sh new file +19
-0@@ -0,0 +1,19 @@ +function test_pre_check { + is_on_target_path tar PROGRAM_TAR + assert_define PROGRAM_TAR "Missing 'tar' program on target board" +} + +function test_deploy { + put $TEST_HOME/tar_test.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;\ + sh -v tar_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}engine/tests/Functional.tar/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.tar/spec.json new file +7
-0@@ -0,0 +1,7 @@ +{ + "testName": "Functional.tar", + "specs": { + "default": {} + } +} +engine/tests/Functional.tar/tar_test.sh new file +4
-0@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +doneengine/tests/Functional.tar/tests/tar_create01.sh new file +2
-0@@ -0,0 +1,24 @@ +#!/bin/sh +
engine/tests/Functional.tar/tests/tar_create01.sh line 12
Quoted 10 lines
engine/tests/Functional.tar/tests/tar_create01.sh new file +10
-0+# In target, run command tar. +# option: cf + +test="create01" + +mkdir test_dir + +if tar cf mytest.tar test_dir +then + echo "creation of tar is succeeded."
'is' is not needed here. I applied a followup patch to remove unneeded uses of 'is' in all sub-tests.
engine/tests/Functional.tar/tests/tar_create01.sh line 14
Quoted 2 lines
engine/tests/Functional.tar/tests/tar_create01.sh new file +2
-0+else + echo "creation of tar is failed."
There should also be some report for testcase failure here. Like so:
echo " -> $test: TEST-FAIL"
before the exit. Otherwise this testcase won't have a result.
I added a patch to do this also.
Quoted 21 lines
engine/tests/Functional.tar/tests/tar_create01.sh new file +10
-0+ exit +fi + +if test -f mytest.tar +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test_direngine/tests/Functional.tar/tests/tar_create02.sh new file +4
-0@@ -0,0 +1,24 @@ +#!/bin/sh + +# In target, run command tar. +# option: czf(gzip)
engine/tests/Functional.tar/tests/tar_create02.sh line 14
Quoted 10 lines
engine/tests/Functional.tar/tests/tar_create02.sh new file +10
-0+ +test="create02" + +mkdir test_dir + +if tar czf mytest.tar.gz test_dir +then + echo "creation of tar is succeeded." +else + echo "creation of tar is failed."
Same issue with emitting a result line here.
Quoted 206 lines
engine/tests/Functional.tar/tests/tar_create02.sh new file +10
-0+ exit +fi + +if test -f mytest.tar.gz +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test_direngine/tests/Functional.tar/tests/tar_create03.sh new file +24
-0@@ -0,0 +1,24 @@ +#!/bin/sh + +# In target, run command tar. +# option: cjf(bzip2) + +test="create03" + +mkdir test_dir + +if tar cf mytest.tar.bz2 test_dir +then + echo "creation of tar is succeeded." +else + echo "creation of tar is failed." + exit +fi + +if test -f mytest.tar.bz2 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr test_direngine/tests/Functional.tar/tests/tar_extract01.sh new file +21
-0@@ -0,0 +1,21 @@ +#!/bin/sh + +# In target, run command tar. +# option: xf + +test="extract01" + +if tar xf data/test.tar +then + echo " -> tar xf is succeeded." +else + echo " -> tar xf is failed." +fi + +if test -f test/data/test_a.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr testengine/tests/Functional.tar/tests/tar_extract02.sh new file +21
-0@@ -0,0 +1,21 @@ +#!/bin/sh + +# In target, run command tar. +# option: xzf(gzip) + +test="extract02" + +if tar xzf data/test.tar.gz +then + echo " -> tar xzf is succeeded." +else + echo " -> tar xzf is failed." +fi + +if test -f test/data/test_b.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr testengine/tests/Functional.tar/tests/tar_extract03.sh new file +21
-0@@ -0,0 +1,21 @@ +#!/bin/sh + +# In target, run command tar. +# option: xjf(bzip2) + +test="extract03" + +if tar xjf data/test.tar.bz2 +then + echo " -> tar xjf is succeeded." +else + echo " -> tar xjf is failed." +fi + +if test -f test/data/test_c.txt +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; +rm -fr testengine/tests/Functional.tar/tests/tar_help.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: --help + +test="help" + +if tar --help | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.tar/tests/tar_list01.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: tf + +test="list01" + +if tar tf data/test.tar | grep "test_a.txt" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.tar/tests/tar_list02.sh new file +13
-0@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: tzf(gzip) + +test="list02" + +if tar tzf data/test.tar.gz | grep "test_b.txt" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;engine/tests/Functional.tar/tests/tar_list03.sh new file +13
-1@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command tar. +# option: tjf(bzip2) + +test="list03" + +if tar tjf data/test.tar.bz2 | grep "test_c.txt" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi; --
Quoted 1 line
1.8.3.1
OK - this patch is applied, with 2 fixup patches on top.
Thanks,
-- Tim
PATCH 1/1 Add test cases for command parted.
In reply to Wang Mingyu--- engine/tests/Functional.parted/fuego_test.sh | 20 ++++++++++++++++++++ engine/tests/Functional.parted/parser.py | 22 ++++++++++++++++++++++ engine/tests/Functional.parted/parted_test.sh | 4 ++++ engine/tests/Functional.parted/spec.json | 7 +++++++ .../tests/Functional.parted/tests/parted_help.sh | 13 +++++++++++++ .../Functional.parted/tests/parted_summary.sh | 13 +++++++++++++ .../Functional.parted/tests/parted_version.sh | 13 +++++++++++++ 7 files changed, 92 insertions(+) create mode 100644 engine/tests/Functional.parted/fuego_test.sh create mode 100644 engine/tests/Functional.parted/parser.py create mode 100644 engine/tests/Functional.parted/parted_test.sh create mode 100644 engine/tests/Functional.parted/spec.json create mode 100644 engine/tests/Functional.parted/tests/parted_help.sh create mode 100644 engine/tests/Functional.parted/tests/parted_summary.sh create mode 100644 engine/tests/Functional.parted/tests/parted_version.sh
engine/tests/Functional.parted/fuego_test.sh new file +20 -0
@@ -0,0 +1,20 @@ +function test_pre_check { + is_on_target_path parted PROGRAM_PARTED + assert_define PROGRAM_PARTED "Missing 'parted' program on target board" + is_on_target_path partprobe PROGRAM_PARTPROBE + assert_define PROGRAM_PARTPROBE "Missing 'partprobe' program on target board" +} + +function test_deploy { + put $TEST_HOME/parted_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + sh -v parted_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.parted/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.parted/parted_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.parted/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.parted", + "specs": { + "default": {} + } +} +
engine/tests/Functional.parted/tests/parted_help.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command parted. +# option: --help. + +test="help" + +if parted --help | grep Usage +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi;
engine/tests/Functional.parted/tests/parted_summary.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command partprobe. +# option: -s + +test="summary" + +if partprobe -s +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.parted/tests/parted_version.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command partprobe. +# option: -v + +test="version" + +if partprobe -v | grep Copyright +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 commands of schedutils.
In reply to Wang Mingyu--- engine/tests/Functional.schedutils/fuego_test.sh | 22 ++++++++++++++++++++++ engine/tests/Functional.schedutils/parser.py | 22 ++++++++++++++++++++++ .../tests/Functional.schedutils/schedutils_test.sh | 4 ++++ engine/tests/Functional.schedutils/spec.json | 7 +++++++ .../tests/schedutils_chrt01.sh | 13 +++++++++++++ .../tests/schedutils_chrt02.sh | 13 +++++++++++++ .../tests/schedutils_chrt03.sh | 13 +++++++++++++ .../tests/schedutils_chrt04.sh | 18 ++++++++++++++++++ .../tests/schedutils_ionice01.sh | 13 +++++++++++++ .../tests/schedutils_ionice02.sh | 13 +++++++++++++ .../tests/schedutils_taskset01.sh | 13 +++++++++++++ .../tests/schedutils_taskset02.sh | 13 +++++++++++++ 12 files changed, 164 insertions(+) create mode 100644 engine/tests/Functional.schedutils/fuego_test.sh create mode 100644 engine/tests/Functional.schedutils/parser.py create mode 100644 engine/tests/Functional.schedutils/schedutils_test.sh create mode 100644 engine/tests/Functional.schedutils/spec.json create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_chrt01.sh create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_chrt02.sh create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_chrt03.sh create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_chrt04.sh create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_ionice01.sh create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_ionice02.sh create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_taskset01.sh create mode 100644 engine/tests/Functional.schedutils/tests/schedutils_taskset02.sh
engine/tests/Functional.schedutils/fuego_test.sh new file +22 -0
@@ -0,0 +1,22 @@ +function test_pre_check { + is_on_target_path chrt PROGRAM_CHRT + assert_define PROGRAM_CHRT "Missing 'chrt' program on target board" + is_on_target_path taskset PROGRAM_TASKSET + assert_define PROGRAM_TASKSET "Missing 'taskset' program on target board" + is_on_target_path ionice PROGRAM_IONICE + assert_define PROGRAM_IONICE "Missing 'ionice' program on target board" +} + +function test_deploy { + put $TEST_HOME/schedutils_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + sh -v schedutils_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +}
engine/tests/Functional.schedutils/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.schedutils/schedutils_test.sh new file +4 -0
@@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done
engine/tests/Functional.schedutils/spec.json new file +7 -0
@@ -0,0 +1,7 @@ +{ + "testName": "Functional.schedutils", + "specs": { + "default": {} + } +} +
engine/tests/Functional.schedutils/tests/schedutils_chrt01.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command chrt. +# option: -h + +test="chrt01" + +if chrt -h | grep "options" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.schedutils/tests/schedutils_chrt02.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command chrt. +# option: -m + +test="chrt02" + +if chrt -m | grep "SCHED_FIFO" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.schedutils/tests/schedutils_chrt03.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command chrt. +# option: -V + +test="chrt03" + +if chrt -V | grep "util-linux" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.schedutils/tests/schedutils_chrt04.sh new file +18 -0
@@ -0,0 +1,18 @@ +#!/bin/sh + +# In target, run command chrt. +# option: -p + +test="chrt04" + +sleep 1237 & pid=$! + +chrt -p 1 $pid + +if chrt -p $pid | grep "priority: 1" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +kill -9 $pid
engine/tests/Functional.schedutils/tests/schedutils_ionice01.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command ionice. +# option: -h + +test="ionice01" + +if ionice -h | grep "Usage" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.schedutils/tests/schedutils_ionice02.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command ionice. +# option: -c,-n + +test="ionice02" + +if ionice -c2 -n0 ls +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.schedutils/tests/schedutils_taskset01.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, run command taskset. +# option: -h + +test="taskset" + +if taskset -h | grep "Usage" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
engine/tests/Functional.schedutils/tests/schedutils_taskset02.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# In target, rn command taskset. +# option: --version + +test="taskset02" + +if taskset --version | grep "util-linux" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi
Signature · 1 line
1.8.3.1
See comments inline below.
Quoted 3 lines
-----Original Message-----
From: Wang Mingyu
Wang - please add more to the body of your commit messages. This one has nothing in the body at all (except the signed-off-by). Unless the commit is extremely trivial, then the commit should have some kind of description. In this case, it would have been good to describe what these variables are used for.
Quoted 11 lines
Signed-off-by Wang Mingyu <[email protected]>--- engine/scripts/fuego_board_function_lib.sh | 6 ++++++ 1 file changed, 6 insertions(+)engine/scripts/fuego_board_function_lib.sh +0
-0
engine/scripts/fuego_board_function_lib.sh line 14
Quoted 4 lines
engine/scripts/fuego_board_function_lib.sh +1
-0@@ -11,6 +11,12 @@ init_manager="init_manager-not-set" logger_service="logger_service-not-set" +test_krnl_rel="$(uname -r | xargs echo)"
this can be simplified to:
test_krnl_rel="$(uname -r)"
I don't know why you have the 'xargs echo' in there.
Because it is so simple, there is no need to have this in the function library. It can be placed in individual test files where it is needed.
engine/scripts/fuego_board_function_lib.sh line 19
Quoted 5 lines
engine/scripts/fuego_board_function_lib.sh +5
-0+tst_mod_file="ah4" +tst_mod_dir="net/ipv4/" +test_tcpip_host="192.168.246.2" +test_tcpip="192.168.246.100" +remote_ifeth="eth0"
These are all custom values for your lab and board.
The function library should be used for things that can be auto-detected on the target, not for hardcoded test data.
For the test_tcpip_host, you should probably be using SRV_IP, which Fuego auto-calculates to be the Fuego host IP address, but can be overridden in a board file.
For the test_mod_file and test_mod_dir, these seem like they should be specified in the spec file for the test. (I'll comment on their use in the test that uses them, but there are issues with that as well.) They should definitely not be hardcoded in a shared function library.
Quoted 5 lines
engine/scripts/fuego_board_function_lib.sh +0
-1# set_init_manager: # detects and sets the init_manager variable, which indicates which --1.8.3.1
I'm sorry, but this is not accepted.
I'm going to comment on other of the patches in this series, and indicate where I think these variables should be defined, rather than here. Let me know if you have questions.
-- Tim