All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode.
@ 2019-04-18 23:39 Wang Mingyu
  2019-04-18 23:39 ` [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd Wang Mingyu
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Wang Mingyu @ 2019-04-18 23:39 UTC (permalink / raw)
  To: fuego

This test set is used to check if the network connection is OK when iperf is started with server mode.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.iperf3_server/fuego_test.sh       | 18 ++++++++++++++++
 .../Functional.iperf3_server/iperf3_server_test.sh |  4 ++++
 tests/Functional.iperf3_server/parser.py           | 20 +++++++++++++++++
 tests/Functional.iperf3_server/spec.json           |  6 ++++++
 .../Functional.iperf3_server/tests/iperf3_help.sh  | 13 +++++++++++
 .../tests/iperf3_server_TCP.sh                     | 22 +++++++++++++++++++
 .../tests/iperf3_server_TCP_port.sh                | 22 +++++++++++++++++++
 .../tests/iperf3_server_UDP.sh                     | 18 ++++++++++++++++
 .../tests/iperf3_server_client.sh                  | 22 +++++++++++++++++++
 .../tests/iperf3_server_client_UDP.sh              | 20 +++++++++++++++++
 .../tests/iperf3_server_client_port.sh             | 25 ++++++++++++++++++++++
 .../tests/iperf3_version.sh                        | 13 +++++++++++
 12 files changed, 203 insertions(+)
 create mode 100644 tests/Functional.iperf3_server/fuego_test.sh
 create mode 100644 tests/Functional.iperf3_server/iperf3_server_test.sh
 create mode 100644 tests/Functional.iperf3_server/parser.py
 create mode 100644 tests/Functional.iperf3_server/spec.json
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_help.sh
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_server_client.sh
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh
 create mode 100644 tests/Functional.iperf3_server/tests/iperf3_version.sh

diff --git a/tests/Functional.iperf3_server/fuego_test.sh b/tests/Functional.iperf3_server/fuego_test.sh
new file mode 100644
index 0000000..3cc380e
--- /dev/null
+++ b/tests/Functional.iperf3_server/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program iperf3
+    assert_has_program netstat
+}
+
+function test_deploy {
+    put $TEST_HOME/iperf3_server_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./iperf3_server_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.iperf3_server/iperf3_server_test.sh b/tests/Functional.iperf3_server/iperf3_server_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.iperf3_server/iperf3_server_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.iperf3_server/parser.py b/tests/Functional.iperf3_server/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.iperf3_server/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.iperf3_server/spec.json b/tests/Functional.iperf3_server/spec.json
new file mode 100644
index 0000000..dbd6d04
--- /dev/null
+++ b/tests/Functional.iperf3_server/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.iperf3_server",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.iperf3_server/tests/iperf3_help.sh b/tests/Functional.iperf3_server/tests/iperf3_help.sh
new file mode 100644
index 0000000..6928699
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Option : --help
+
+test="help"
+
+if iperf3 --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh b/tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh
new file mode 100644
index 0000000..f181445
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Option : server(TCP)
+
+test="TCP"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+ls .
+netstat -l > iperf-test
+
+if cat iperf-test | grep "5201"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
+rm -f iperf-test
diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh b/tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh
new file mode 100644
index 0000000..865af0e
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Test command iperf3 on target.
+# Option : server( TCP port 6000 )
+
+test="TCP port"
+
+killall -KILL iperf3
+
+iperf3 -s -p 6000 >iperf.log &
+
+sleep 3
+
+killall iperf3
+
+if grep "Server listening on 6000" iperf.log
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm iperf.log
diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh b/tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh
new file mode 100644
index 0000000..a5c7ea5
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Option : server(UDP)
+
+test="UDP"
+
+killall -KILL iperf3
+iperf3 -s -D
+
+if netstat -l | grep "5201"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_client.sh b/tests/Functional.iperf3_server/tests/iperf3_server_client.sh
new file mode 100644
index 0000000..e7e1306
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_server_client.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Option : -c
+
+test="client"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+iperf3 -c 127.0.0.1 > log
+sleep 5
+
+if grep "connected" log
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
+rm log
diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh b/tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh
new file mode 100644
index 0000000..ca4b57f
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Option : -c (UDP)
+
+test="client_UDP"
+
+killall -KILL iperf3
+iperf3 -s -D&
+
+sleep 3
+
+if iperf3 -c 127.0.0.1 -u | grep "connected"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+
+killall -KILL iperf3
diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh b/tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh
new file mode 100644
index 0000000..b26f659
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Option : -c(port opt)
+
+test="client_port"
+
+killall -KILL iperf3
+iperf3 -s -D -p 6000&
+
+sleep 3
+
+iperf3 -c 127.0.0.1 -p 6000 >iperf.log &
+
+sleep 3
+
+killall iperf3
+if grep "connected" iperf.log
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rm iperf.log
diff --git a/tests/Functional.iperf3_server/tests/iperf3_version.sh b/tests/Functional.iperf3_server/tests/iperf3_version.sh
new file mode 100644
index 0000000..7327ecc
--- /dev/null
+++ b/tests/Functional.iperf3_server/tests/iperf3_version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  Test command iperf3 on target.
+#  Option : version
+
+test="version"
+
+if iperf3 --version | grep "iperf 3.*"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd.
  2019-04-18 23:39 [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Wang Mingyu
@ 2019-04-18 23:39 ` Wang Mingyu
  2019-04-19  1:51   ` Tim.Bird
  2019-04-18 23:39 ` [Fuego] [PATCH v2] hostapd: Add test cases of command hostapd Wang Mingyu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Wang Mingyu @ 2019-04-18 23:39 UTC (permalink / raw)
  To: fuego

DHCP allows hosts on a TCP/IP network to request and be assigned IP addresses, and also to discover information about the network to which they are attached.
This is a simple test to check the service can start successfully.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.dhcpd/data/change_dhcpd.conf |  5 ++
 tests/Functional.dhcpd/data/dhcpd.conf        | 18 ++++++
 tests/Functional.dhcpd/dhcpd_test.sh          |  4 ++
 tests/Functional.dhcpd/fuego_test.sh          | 21 ++++++
 tests/Functional.dhcpd/parser.py              | 20 ++++++
 tests/Functional.dhcpd/spec.json              |  6 ++
 tests/Functional.dhcpd/test.yaml              | 26 ++++++++
 tests/Functional.dhcpd/tests/dhcpd_pidfile.sh | 93 +++++++++++++++++++++++++++
 tests/Functional.dhcpd/tests/dhcpd_ps.sh      | 88 +++++++++++++++++++++++++
 tests/Functional.dhcpd/tests/dhcpd_syslog.sh  | 90 ++++++++++++++++++++++++++
 10 files changed, 371 insertions(+)
 create mode 100644 tests/Functional.dhcpd/data/change_dhcpd.conf
 create mode 100644 tests/Functional.dhcpd/data/dhcpd.conf
 create mode 100644 tests/Functional.dhcpd/dhcpd_test.sh
 create mode 100644 tests/Functional.dhcpd/fuego_test.sh
 create mode 100644 tests/Functional.dhcpd/parser.py
 create mode 100644 tests/Functional.dhcpd/spec.json
 create mode 100644 tests/Functional.dhcpd/test.yaml
 create mode 100644 tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
 create mode 100644 tests/Functional.dhcpd/tests/dhcpd_ps.sh
 create mode 100644 tests/Functional.dhcpd/tests/dhcpd_syslog.sh

diff --git a/tests/Functional.dhcpd/data/change_dhcpd.conf b/tests/Functional.dhcpd/data/change_dhcpd.conf
new file mode 100644
index 0000000..8e79207
--- /dev/null
+++ b/tests/Functional.dhcpd/data/change_dhcpd.conf
@@ -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
diff --git a/tests/Functional.dhcpd/data/dhcpd.conf b/tests/Functional.dhcpd/data/dhcpd.conf
new file mode 100644
index 0000000..2ce38b8
--- /dev/null
+++ b/tests/Functional.dhcpd/data/dhcpd.conf
@@ -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
+
+}
+
diff --git a/tests/Functional.dhcpd/dhcpd_test.sh b/tests/Functional.dhcpd/dhcpd_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.dhcpd/dhcpd_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.dhcpd/fuego_test.sh b/tests/Functional.dhcpd/fuego_test.sh
new file mode 100644
index 0000000..7710bf6
--- /dev/null
+++ b/tests/Functional.dhcpd/fuego_test.sh
@@ -0,0 +1,21 @@
+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/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;\
+    export remote_ifeth=$IFETH;\
+    ./dhcpd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.dhcpd/parser.py b/tests/Functional.dhcpd/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.dhcpd/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.dhcpd/spec.json b/tests/Functional.dhcpd/spec.json
new file mode 100644
index 0000000..1cf5e10
--- /dev/null
+++ b/tests/Functional.dhcpd/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dhcpd",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.dhcpd/test.yaml b/tests/Functional.dhcpd/test.yaml
new file mode 100644
index 0000000..8af6bd6
--- /dev/null
+++ b/tests/Functional.dhcpd/test.yaml
@@ -0,0 +1,26 @@
+fuego_package_version: 1
+name: Functional.dhcpd
+description: |
+      The Internet Systems Consortium DHCP Server, dhcpd, implements the Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap Protocol (BOOTP).
+      DHCP allows hosts on a TCP/IP network to request and be assigned IP addresses, and also to discover information about the network to which they are attached.
+      BOOTP provides similar functionality, with certain restrictions.
+      This is a simple test to check the service can start successfully.
+license: Unknown
+author: Wang Mingyu <wangmy@cn.fujitsu.com>
+maintainer: Tim Bird <tim.bird@sony.com> 
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['vlan']
+params:
+      IFETH="the eth interface in your target board" Defined in board file
+data_files:
+ - dhcpd_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
+   dhcpd_ps.sh
+   dhcpd_pidfile.sh
+   dhcpd_syslog.sh
diff --git a/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh b/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
new file mode 100644
index 0000000..4970ee6
--- /dev/null
+++ b/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+#  In the target start dhcpd, and check if the /var/run/dhcpd.pid is exist
+#  check the keyword "dhcpd".
+
+test="pidfile"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+dhcpd_status=$(exec_service_on_target dhcpd is-active)
+dnsmasq_status=$(exec_service_on_target dnsmasq is-active)
+
+exec_service_on_target dhcpd stop
+exec_service_on_target dnsmasq stop
+
+if [ -f /var/run/dhcpd.pid ]
+then
+    rm -f /var/run/dhcpd.pid
+fi
+
+if [ -f /etc/dhcp/dhcpd.conf ]
+then
+    cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bak
+fi
+
+if [ -e /etc/default/dhcp-server ]
+then
+    cp /etc/default/dhcp-server /etc/default/dhcp-server_bak
+fi
+
+echo "INTERFACES="$remote_ifeth"" > /etc/default/dhcp-server
+
+cp data/change_dhcpd.conf /etc/
+
+chmod +x /etc/change_dhcpd.conf
+
+restore_target(){
+    rm -f /etc/change_dhcpd.conf
+    if [ -f /etc/dhcp/dhcpd.conf_bak ]
+    then
+        mv /etc/dhcp/dhcpd.conf_bak /etc/dhcp/dhcpd.conf
+    fi
+
+    if [ -e /etc/default/dhcp-server ]
+    then
+        mv /etc/default/dhcp-server_bak /etc/default/dhcp-server
+    fi
+    if [ "$dnsmasq_status" = "active" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
+    if [ "$dhcpd_status" = "active" ]
+    then
+        exec_service_on_target dhcpd start
+    fi
+}
+
+/etc/change_dhcpd.conf
+
+if exec_service_on_target dhcpd start
+then
+    echo " -> start of dhcpd succeeded."
+else
+    echo " -> start of dhcpd failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 10
+
+if test -f /var/run/dhcpd.pid
+then
+    echo " -> get the pidfile of dhcpd."
+else
+    echo " -> can't get the pidfile of dhcpd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target dhcpd stop
+    restore_target
+    exit
+fi
+
+exec_service_on_target dhcpd stop
+
+if test ! -f /var/run/dhcpd.pid
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+restore_target
diff --git a/tests/Functional.dhcpd/tests/dhcpd_ps.sh b/tests/Functional.dhcpd/tests/dhcpd_ps.sh
new file mode 100644
index 0000000..2896ba1
--- /dev/null
+++ b/tests/Functional.dhcpd/tests/dhcpd_ps.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+#  In the target start dhcpd, and confirm the process condition by command ps.
+#  check the keyword "dhcpd".
+
+test="ps"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+dhcpd_status=$(exec_service_on_target dhcpd is-active)
+dnsmasq_status=$(exec_service_on_target dnsmasq is-active)
+
+exec_service_on_target dhcpd stop
+exec_service_on_target dnsmasq stop
+
+if [ -e /etc/default/dhcp-server ]
+then
+    cp /etc/default/dhcp-server /etc/default/dhcp-server_bak
+fi
+
+echo "INTERFACES="$remote_ifeth"" > /etc/default/dhcp-server
+
+if [ -e /etc/dhcp/dhcpd.conf ]
+then
+    mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bak
+fi
+
+cp data/change_dhcpd.conf /etc/
+
+restore_target(){
+    rm -f /etc/change_dhcpd.conf
+    if [ -f /etc/dhcp/dhcpd.conf_bak ]
+    then
+        mv /etc/dhcp/dhcpd.conf_bak /etc/dhcp/dhcpd.conf
+    fi
+
+    if [ -e /etc/default/dhcp-server ]
+    then
+        mv /etc/default/dhcp-server_bak /etc/default/dhcp-server
+    fi
+    if [ "$dnsmasq_status" = "active" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
+    if [ "$dhcpd_status" = "active" ]
+    then
+        exec_service_on_target dhcpd start
+    fi
+}
+
+chmod +x /etc/change_dhcpd.conf
+
+/etc/change_dhcpd.conf
+
+if exec_service_on_target dhcpd start
+then
+    echo " -> start of dhcpd succeeded."
+else
+    echo " -> start of dhcpd failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 10
+
+if ps aux | grep "[/]usr/sbin/dhcpd"
+then
+    echo " -> get the pid of dhcpd."
+else
+    echo " -> can't get the pid of dhcpd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target dhcpd stop
+    restore_target
+    exit
+fi
+
+exec_service_on_target dhcpd stop
+
+if ps aux | grep "[/]usr/sbin/dhcpd"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
+restore_target
diff --git a/tests/Functional.dhcpd/tests/dhcpd_syslog.sh b/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
new file mode 100644
index 0000000..e53dd69
--- /dev/null
+++ b/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+#  In the target start dhcpd, and check the messages of /var/log/syslog.
+#  check the keyword "dhcpd".
+
+test="syslog"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+logger_service=$(detect_logger_service)
+
+dhcpd_status=$(exec_service_on_target dhcpd is-active)
+dnsmasq_status=$(exec_service_on_target dnsmasq is-active)
+
+exec_service_on_target dhcpd stop
+exec_service_on_target $logger_service stop
+
+if [ -f /var/log/syslog ]
+then
+    mv /var/log/syslog /var/log/syslog_bak
+fi
+
+if [ -e /etc/default/dhcp-server ]
+then
+    cp /etc/default/dhcp-server /etc/default/dhcp-server_bak
+fi
+
+echo "INTERFACES="$remote_ifeth"" > /etc/default/dhcp-server
+
+if [ -f /etc/dhcp/dhcpd.conf ]
+then
+    cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bak
+fi
+
+cp data/change_dhcpd.conf /etc/
+
+restore_target(){
+    rm -f /etc/change_dhcpd.conf
+    if [ -f /etc/dhcp/dhcpd.conf_bak ]
+    then
+        mv /etc/dhcp/dhcpd.conf_bak /etc/dhcp/dhcpd.conf
+    fi
+
+    if [ -e /etc/default/dhcp-server ]
+    then
+        mv /etc/default/dhcp-server_bak /etc/default/dhcp-server
+    fi
+
+    if [ -f /var/log/syslog_bak ]
+    then
+        mv /var/log/syslog_bak /var/log/syslog
+    fi
+    if [ "$dnsmasq_status" = "active" ]
+    then
+        exec_service_on_target dnsmasq start
+    fi
+    if [ "$dhcpd_status" = "active" ]
+    then
+        exec_service_on_target dhcpd start
+    fi
+}
+
+chmod +x /etc/change_dhcpd.conf
+
+/etc/change_dhcpd.conf
+
+exec_service_on_target $logger_service restart
+
+if exec_service_on_target dhcpd start
+then
+    echo " -> start of dhcpd succeeded."
+else
+    echo " -> start of dhcpd failed."
+    echo " -> $test: TEST-FAIL"
+    restore_target
+    exit
+fi
+
+sleep 10
+
+if cat /var/log/syslog | grep "dhcpd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target dhcpd stop
+restore_target
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Fuego] [PATCH v2] hostapd: Add test cases of command hostapd.
  2019-04-18 23:39 [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Wang Mingyu
  2019-04-18 23:39 ` [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd Wang Mingyu
@ 2019-04-18 23:39 ` Wang Mingyu
  2019-04-18 23:39 ` [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du Wang Mingyu
  2019-04-19  1:20 ` [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Tim.Bird
  3 siblings, 0 replies; 8+ messages in thread
From: Wang Mingyu @ 2019-04-18 23:39 UTC (permalink / raw)
  To: fuego

Hostapd is a user space software access point capable of turning normal network interface cards into access points
and authentication servers.
This is a simple test to check if the service of hostapd can work.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.hostapd/fuego_test.sh         | 19 ++++++++++++
 tests/Functional.hostapd/hostapd_test.sh       |  4 +++
 tests/Functional.hostapd/parser.py             | 20 ++++++++++++
 tests/Functional.hostapd/spec.json             |  6 ++++
 tests/Functional.hostapd/test.yaml             | 24 ++++++++++++++
 tests/Functional.hostapd/tests/hostapd_help.sh | 15 +++++++++
 tests/Functional.hostapd/tests/hostapd_ps.sh   | 43 ++++++++++++++++++++++++++
 7 files changed, 131 insertions(+)
 create mode 100644 tests/Functional.hostapd/fuego_test.sh
 create mode 100644 tests/Functional.hostapd/hostapd_test.sh
 create mode 100644 tests/Functional.hostapd/parser.py
 create mode 100644 tests/Functional.hostapd/spec.json
 create mode 100644 tests/Functional.hostapd/test.yaml
 create mode 100644 tests/Functional.hostapd/tests/hostapd_help.sh
 create mode 100644 tests/Functional.hostapd/tests/hostapd_ps.sh

diff --git a/tests/Functional.hostapd/fuego_test.sh b/tests/Functional.hostapd/fuego_test.sh
new file mode 100644
index 0000000..a9d7197
--- /dev/null
+++ b/tests/Functional.hostapd/fuego_test.sh
@@ -0,0 +1,19 @@
+function test_pre_check {
+    assert_has_program hostapd
+}
+
+function test_deploy {
+    put $TEST_HOME/hostapd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/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;\
+    export test_wlan=$BOARD_WLAN;\
+    ./hostapd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.hostapd/hostapd_test.sh b/tests/Functional.hostapd/hostapd_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.hostapd/hostapd_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.hostapd/parser.py b/tests/Functional.hostapd/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.hostapd/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.hostapd/spec.json b/tests/Functional.hostapd/spec.json
new file mode 100644
index 0000000..447448e
--- /dev/null
+++ b/tests/Functional.hostapd/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.hostapd",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.hostapd/test.yaml b/tests/Functional.hostapd/test.yaml
new file mode 100644
index 0000000..c76e2e1
--- /dev/null
+++ b/tests/Functional.hostapd/test.yaml
@@ -0,0 +1,24 @@
+fuego_package_version: 1
+name: Functional.hostapd
+description: |
+      Hostapd (Host access point daemon) is a user space software access point capable of turning normal network interface cards into access points
+      and authentication servers.
+      This is a simple test to check if the service of hostapd can work.
+license: Unknown
+author: Wang Mingyu <wangmy@cn.fujitsu.com>
+maintainer: Tim Bird <tim.bird@sony.com>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['vlan']
+params:
+      BOARD_WLAN="the name of WLAN in your target board" Defined in board file
+data_files:
+ - hostapd_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
+   hostapd_help.sh
+   hostapd_ps.sh
diff --git a/tests/Functional.hostapd/tests/hostapd_help.sh b/tests/Functional.hostapd/tests/hostapd_help.sh
new file mode 100644
index 0000000..a5b904b
--- /dev/null
+++ b/tests/Functional.hostapd/tests/hostapd_help.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command hostapd.
+#  option: --help.
+
+test="help"
+
+hostapd --help > help_log 2>&1
+if cat help_log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm help_log
diff --git a/tests/Functional.hostapd/tests/hostapd_ps.sh b/tests/Functional.hostapd/tests/hostapd_ps.sh
new file mode 100644
index 0000000..b67b5c7
--- /dev/null
+++ b/tests/Functional.hostapd/tests/hostapd_ps.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#  In the target start hostapd, and check if the service can execute.
+
+test="ps"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status hostapd)
+
+exec_service_on_target hostapd stop
+
+if [ -f /etc/hostapd.conf ]
+then
+    cp /etc/hostapd.conf /etc/hostapd.conf_bak
+fi
+
+sed -i 's/wlan0/'"$test_wlan"'/g' /etc/hostapd.conf
+
+sleep 5
+
+if exec_service_on_target hostapd start
+then
+    echo " -> start of hostapd succeeded."
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> start of hostapd failed."
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target hostapd stop
+
+if [ -f /etc/hostapd.conf_bak ]
+then
+    mv /etc/hostapd.conf_bak /etc/hostapd.conf
+fi
+
+if [ "$service_status" = "active" -o "$service_status" = "unknown" ]
+then
+    exec_service_on_target hostapd start
+fi
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du.
  2019-04-18 23:39 [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Wang Mingyu
  2019-04-18 23:39 ` [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd Wang Mingyu
  2019-04-18 23:39 ` [Fuego] [PATCH v2] hostapd: Add test cases of command hostapd Wang Mingyu
@ 2019-04-18 23:39 ` Wang Mingyu
  2019-04-19  1:27   ` Tim.Bird
  2019-04-19  1:20 ` [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Tim.Bird
  3 siblings, 1 reply; 8+ messages in thread
From: Wang Mingyu @ 2019-04-18 23:39 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.busybox/fuego_test.sh       | 5 ++---
 tests/Functional.busybox/tests/busybox_du.sh | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)
 mode change 100755 => 100644 tests/Functional.busybox/fuego_test.sh

diff --git a/tests/Functional.busybox/fuego_test.sh b/tests/Functional.busybox/fuego_test.sh
old mode 100755
new mode 100644
index a7aef3e..b866d99
--- a/tests/Functional.busybox/fuego_test.sh
+++ b/tests/Functional.busybox/fuego_test.sh
@@ -47,8 +47,7 @@ function skip_if_in_skiplist {
 }
 
 function test_pre_check {
-    is_on_target_path busybox PROGRAM_BUSYBOX
-    assert_define PROGRAM_BUSYBOX "Missing 'busybox' program on target board"
+    assert_has_program busybox
     echo "Tests skipped depending on the availability of a command on the target"
     touch ${LOGDIR}/skiplist.txt
     skip_if_command_unavailable expect "busybox_ash.sh busybox_passwd.sh"
@@ -79,7 +78,7 @@ function test_run {
         export test_tcpip_host=$SRV_IP; \
         export test_port_host=${SRV_PORT:=8080}; \
         export test_ipaddr=$IPADDR;\
-        sh -v busybox_test.sh"
+        ./busybox_test.sh"
 }
 
 function test_processing {
diff --git a/tests/Functional.busybox/tests/busybox_du.sh b/tests/Functional.busybox/tests/busybox_du.sh
index 4710fb8..0430954 100644
--- a/tests/Functional.busybox/tests/busybox_du.sh
+++ b/tests/Functional.busybox/tests/busybox_du.sh
@@ -8,7 +8,7 @@ test="du"
 mkdir test_dir
 touch ./test_dir/test1
 touch ./test_dir/test2
-if busybox du -k test_dir | grep "4.*test_dir"
+if busybox du -k test_dir | grep ".*test_dir"
 then
     echo " -> $test: TEST-PASS"
 else
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode.
  2019-04-18 23:39 [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Wang Mingyu
                   ` (2 preceding siblings ...)
  2019-04-18 23:39 ` [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du Wang Mingyu
@ 2019-04-19  1:20 ` Tim.Bird
  3 siblings, 0 replies; 8+ messages in thread
From: Tim.Bird @ 2019-04-19  1:20 UTC (permalink / raw)
  To: wangmy, fuego

Applied to the fuegotest 'next' branch.

Thanks!
 -- Tim


> -----Original Message-----
> From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> bounces@lists.linuxfoundation.org] On Behalf Of Wang Mingyu
> Sent: Thursday, April 18, 2019 4:39 PM
> To: fuego@lists.linuxfoundation.org
> Subject: [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server
> mode.
> 
> This test set is used to check if the network connection is OK when iperf is
> started with server mode.
> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.iperf3_server/fuego_test.sh       | 18 ++++++++++++++++
>  .../Functional.iperf3_server/iperf3_server_test.sh |  4 ++++
>  tests/Functional.iperf3_server/parser.py           | 20 +++++++++++++++++
>  tests/Functional.iperf3_server/spec.json           |  6 ++++++
>  .../Functional.iperf3_server/tests/iperf3_help.sh  | 13 +++++++++++
>  .../tests/iperf3_server_TCP.sh                     | 22 +++++++++++++++++++
>  .../tests/iperf3_server_TCP_port.sh                | 22 +++++++++++++++++++
>  .../tests/iperf3_server_UDP.sh                     | 18 ++++++++++++++++
>  .../tests/iperf3_server_client.sh                  | 22 +++++++++++++++++++
>  .../tests/iperf3_server_client_UDP.sh              | 20 +++++++++++++++++
>  .../tests/iperf3_server_client_port.sh             | 25
> ++++++++++++++++++++++
>  .../tests/iperf3_version.sh                        | 13 +++++++++++
>  12 files changed, 203 insertions(+)
>  create mode 100644 tests/Functional.iperf3_server/fuego_test.sh
>  create mode 100644 tests/Functional.iperf3_server/iperf3_server_test.sh
>  create mode 100644 tests/Functional.iperf3_server/parser.py
>  create mode 100644 tests/Functional.iperf3_server/spec.json
>  create mode 100644 tests/Functional.iperf3_server/tests/iperf3_help.sh
>  create mode 100644
> tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh
>  create mode 100644
> tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh
>  create mode 100644
> tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh
>  create mode 100644
> tests/Functional.iperf3_server/tests/iperf3_server_client.sh
>  create mode 100644
> tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh
>  create mode 100644
> tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh
>  create mode 100644 tests/Functional.iperf3_server/tests/iperf3_version.sh
> 
> diff --git a/tests/Functional.iperf3_server/fuego_test.sh
> b/tests/Functional.iperf3_server/fuego_test.sh
> new file mode 100644
> index 0000000..3cc380e
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/fuego_test.sh
> @@ -0,0 +1,18 @@
> +function test_pre_check {
> +    assert_has_program iperf3
> +    assert_has_program netstat
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/iperf3_server_test.sh
> $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
> +}
> +
> +function test_run {
> +    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
> +    ./iperf3_server_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/tests/Functional.iperf3_server/iperf3_server_test.sh
> b/tests/Functional.iperf3_server/iperf3_server_test.sh
> new file mode 100644
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/iperf3_server_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/tests/Functional.iperf3_server/parser.py
> b/tests/Functional.iperf3_server/parser.py
> new file mode 100644
> index 0000000..f25a608
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/parser.py
> @@ -0,0 +1,20 @@
> +#!/usr/bin/python
> +# See common.py for description of command-line arguments
> +
> +import os, sys, collections
> +import common as plib
> +
> +measurements = {}
> +measurements = collections.OrderedDict()
> +
> +regex_string = '^ -> (.*): TEST-(.*)$'
> +matches = plib.parse_log(regex_string)
> +
> +if matches:
> +    for m in matches:
> +        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
> +
> +# split the output for each testcase
> +plib.split_output_per_testcase(regex_string, measurements)
> +
> +sys.exit(plib.process(measurements))
> diff --git a/tests/Functional.iperf3_server/spec.json
> b/tests/Functional.iperf3_server/spec.json
> new file mode 100644
> index 0000000..dbd6d04
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/spec.json
> @@ -0,0 +1,6 @@
> +{
> +    "testName": "Functional.iperf3_server",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_help.sh
> b/tests/Functional.iperf3_server/tests/iperf3_help.sh
> new file mode 100644
> index 0000000..6928699
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_help.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  Test command iperf3 on target.
> +#  Option : --help
> +
> +test="help"
> +
> +if iperf3 --help | grep "Usage"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh
> b/tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh
> new file mode 100644
> index 0000000..f181445
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +#  Test command iperf3 on target.
> +#  Option : server(TCP)
> +
> +test="TCP"
> +
> +killall -KILL iperf3
> +iperf3 -s -D&
> +
> +ls .
> +netstat -l > iperf-test
> +
> +if cat iperf-test | grep "5201"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +
> +killall -KILL iperf3
> +rm -f iperf-test
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh
> b/tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh
> new file mode 100644
> index 0000000..865af0e
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +# Test command iperf3 on target.
> +# Option : server( TCP port 6000 )
> +
> +test="TCP port"
> +
> +killall -KILL iperf3
> +
> +iperf3 -s -p 6000 >iperf.log &
> +
> +sleep 3
> +
> +killall iperf3
> +
> +if grep "Server listening on 6000" iperf.log
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +rm iperf.log
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh
> b/tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh
> new file mode 100644
> index 0000000..a5c7ea5
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh
> @@ -0,0 +1,18 @@
> +#!/bin/sh
> +
> +#  Test command iperf3 on target.
> +#  Option : server(UDP)
> +
> +test="UDP"
> +
> +killall -KILL iperf3
> +iperf3 -s -D
> +
> +if netstat -l | grep "5201"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +
> +killall -KILL iperf3
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_client.sh
> b/tests/Functional.iperf3_server/tests/iperf3_server_client.sh
> new file mode 100644
> index 0000000..e7e1306
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_server_client.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +#  Test command iperf3 on target.
> +#  Option : -c
> +
> +test="client"
> +
> +killall -KILL iperf3
> +iperf3 -s -D&
> +
> +iperf3 -c 127.0.0.1 > log
> +sleep 5
> +
> +if grep "connected" log
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +
> +killall -KILL iperf3
> +rm log
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh
> b/tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh
> new file mode 100644
> index 0000000..ca4b57f
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh
> @@ -0,0 +1,20 @@
> +#!/bin/sh
> +
> +#  Test command iperf3 on target.
> +#  Option : -c (UDP)
> +
> +test="client_UDP"
> +
> +killall -KILL iperf3
> +iperf3 -s -D&
> +
> +sleep 3
> +
> +if iperf3 -c 127.0.0.1 -u | grep "connected"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +
> +killall -KILL iperf3
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh
> b/tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh
> new file mode 100644
> index 0000000..b26f659
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +
> +#  Test command iperf3 on target.
> +#  Option : -c(port opt)
> +
> +test="client_port"
> +
> +killall -KILL iperf3
> +iperf3 -s -D -p 6000&
> +
> +sleep 3
> +
> +iperf3 -c 127.0.0.1 -p 6000 >iperf.log &
> +
> +sleep 3
> +
> +killall iperf3
> +if grep "connected" iperf.log
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +rm iperf.log
> diff --git a/tests/Functional.iperf3_server/tests/iperf3_version.sh
> b/tests/Functional.iperf3_server/tests/iperf3_version.sh
> new file mode 100644
> index 0000000..7327ecc
> --- /dev/null
> +++ b/tests/Functional.iperf3_server/tests/iperf3_version.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  Test command iperf3 on target.
> +#  Option : version
> +
> +test="version"
> +
> +if iperf3 --version | grep "iperf 3.*"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> --
> 1.8.3.1
> 
> 
> 
> _______________________________________________
> Fuego mailing list
> Fuego@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du.
  2019-04-18 23:39 ` [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du Wang Mingyu
@ 2019-04-19  1:27   ` Tim.Bird
  2019-04-19  5:38     ` Wang, Mingyu
  0 siblings, 1 reply; 8+ messages in thread
From: Tim.Bird @ 2019-04-19  1:27 UTC (permalink / raw)
  To: wangmy, fuego

See comments inline below.

> -----Original Message-----
> From: Wang Mingyu
> 

There is no text explaining the reason for these changes.  This is unacceptable.

> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.busybox/fuego_test.sh       | 5 ++---
>  tests/Functional.busybox/tests/busybox_du.sh | 2 +-
>  2 files changed, 3 insertions(+), 4 deletions(-)
>  mode change 100755 => 100644 tests/Functional.busybox/fuego_test.sh
> 
> diff --git a/tests/Functional.busybox/fuego_test.sh
> b/tests/Functional.busybox/fuego_test.sh
> old mode 100755
> new mode 100644
> index a7aef3e..b866d99
> --- a/tests/Functional.busybox/fuego_test.sh
> +++ b/tests/Functional.busybox/fuego_test.sh
> @@ -47,8 +47,7 @@ function skip_if_in_skiplist {
>  }
> 
>  function test_pre_check {
> -    is_on_target_path busybox PROGRAM_BUSYBOX
> -    assert_define PROGRAM_BUSYBOX "Missing 'busybox' program on target
> board"
> +    assert_has_program busybox
Good.

>      echo "Tests skipped depending on the availability of a command on the
> target"
>      touch ${LOGDIR}/skiplist.txt
>      skip_if_command_unavailable expect "busybox_ash.sh
> busybox_passwd.sh"
> @@ -79,7 +78,7 @@ function test_run {
>          export test_tcpip_host=$SRV_IP; \
>          export test_port_host=${SRV_PORT:=8080}; \
>          export test_ipaddr=$IPADDR;\
> -        sh -v busybox_test.sh"
> +        ./busybox_test.sh"
OK.  But why was this change made?

>  }
> 
>  function test_processing {
> diff --git a/tests/Functional.busybox/tests/busybox_du.sh
> b/tests/Functional.busybox/tests/busybox_du.sh
> index 4710fb8..0430954 100644
> --- a/tests/Functional.busybox/tests/busybox_du.sh
> +++ b/tests/Functional.busybox/tests/busybox_du.sh
> @@ -8,7 +8,7 @@ test="du"
>  mkdir test_dir
>  touch ./test_dir/test1
>  touch ./test_dir/test2
> -if busybox du -k test_dir | grep "4.*test_dir"
> +if busybox du -k test_dir | grep ".*test_dir"
Why was this change made?  This is a major change in test behavior.
Previously, the test is validating the number returned by  'du -k',
but now it is not.  This reduces the test coverage substantially.

Please explain.
>  then
>      echo " -> $test: TEST-PASS"
>  else
> --
> 1.8.3.1

Thanks for the patch, but please address the issues I have raised.
 -- Tim


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd.
  2019-04-18 23:39 ` [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd Wang Mingyu
@ 2019-04-19  1:51   ` Tim.Bird
  0 siblings, 0 replies; 8+ messages in thread
From: Tim.Bird @ 2019-04-19  1:51 UTC (permalink / raw)
  To: wangmy, fuego

See comments inline below.

> -----Original Message-----
> From: Wang Mingyu
> 
> DHCP allows hosts on a TCP/IP network to request and be assigned IP
> addresses, and also to discover information about the network to which they
> are attached.
> This is a simple test to check the service can start successfully.
> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.dhcpd/data/change_dhcpd.conf |  5 ++
>  tests/Functional.dhcpd/data/dhcpd.conf        | 18 ++++++
>  tests/Functional.dhcpd/dhcpd_test.sh          |  4 ++
>  tests/Functional.dhcpd/fuego_test.sh          | 21 ++++++
>  tests/Functional.dhcpd/parser.py              | 20 ++++++
>  tests/Functional.dhcpd/spec.json              |  6 ++
>  tests/Functional.dhcpd/test.yaml              | 26 ++++++++
>  tests/Functional.dhcpd/tests/dhcpd_pidfile.sh | 93
> +++++++++++++++++++++++++++
>  tests/Functional.dhcpd/tests/dhcpd_ps.sh      | 88
> +++++++++++++++++++++++++
>  tests/Functional.dhcpd/tests/dhcpd_syslog.sh  | 90
> ++++++++++++++++++++++++++
>  10 files changed, 371 insertions(+)
>  create mode 100644 tests/Functional.dhcpd/data/change_dhcpd.conf
>  create mode 100644 tests/Functional.dhcpd/data/dhcpd.conf
>  create mode 100644 tests/Functional.dhcpd/dhcpd_test.sh
>  create mode 100644 tests/Functional.dhcpd/fuego_test.sh
>  create mode 100644 tests/Functional.dhcpd/parser.py
>  create mode 100644 tests/Functional.dhcpd/spec.json
>  create mode 100644 tests/Functional.dhcpd/test.yaml
>  create mode 100644 tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
>  create mode 100644 tests/Functional.dhcpd/tests/dhcpd_ps.sh
>  create mode 100644 tests/Functional.dhcpd/tests/dhcpd_syslog.sh
> 
> diff --git a/tests/Functional.dhcpd/data/change_dhcpd.conf
> b/tests/Functional.dhcpd/data/change_dhcpd.conf
> new file mode 100644
> index 0000000..8e79207
> --- /dev/null
> +++ b/tests/Functional.dhcpd/data/change_dhcpd.conf
> @@ -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
Does this sample configuration work no matter what network the board
is on at the start of the test?

> diff --git a/tests/Functional.dhcpd/data/dhcpd.conf
> b/tests/Functional.dhcpd/data/dhcpd.conf
> new file mode 100644
> index 0000000..2ce38b8
> --- /dev/null
> +++ b/tests/Functional.dhcpd/data/dhcpd.conf
> @@ -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
> +
> +}
> +
Please remove this extra whitespace at end of file.

Does this sample configuration work no matter what network the
board was on before the test started?

> diff --git a/tests/Functional.dhcpd/dhcpd_test.sh
> b/tests/Functional.dhcpd/dhcpd_test.sh
> new file mode 100644
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/tests/Functional.dhcpd/dhcpd_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/tests/Functional.dhcpd/fuego_test.sh
> b/tests/Functional.dhcpd/fuego_test.sh
> new file mode 100644
> index 0000000..7710bf6
> --- /dev/null
> +++ b/tests/Functional.dhcpd/fuego_test.sh
> @@ -0,0 +1,21 @@
> +function test_pre_check {
> +    is_on_target_path dhcpd PROGRAM_DHCPD
> +    assert_define PROGRAM_DHCPD "Missing 'dhcpd' program on target
> board"
Should use assert_has_program here.

> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/dhcpd_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put $FUEGO_CORE/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;\
> +    export remote_ifeth=$IFETH;\
> +    ./dhcpd_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/tests/Functional.dhcpd/parser.py
> b/tests/Functional.dhcpd/parser.py
> new file mode 100644
> index 0000000..f25a608
> --- /dev/null
> +++ b/tests/Functional.dhcpd/parser.py
> @@ -0,0 +1,20 @@
> +#!/usr/bin/python
> +# See common.py for description of command-line arguments
> +
> +import os, sys, collections
> +import common as plib
> +
> +measurements = {}
> +measurements = collections.OrderedDict()
> +
> +regex_string = '^ -> (.*): TEST-(.*)$'
> +matches = plib.parse_log(regex_string)
> +
> +if matches:
> +    for m in matches:
> +        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
> +
> +# split the output for each testcase
> +plib.split_output_per_testcase(regex_string, measurements)
> +
> +sys.exit(plib.process(measurements))
> diff --git a/tests/Functional.dhcpd/spec.json
> b/tests/Functional.dhcpd/spec.json
> new file mode 100644
> index 0000000..1cf5e10
> --- /dev/null
> +++ b/tests/Functional.dhcpd/spec.json
> @@ -0,0 +1,6 @@
> +{
> +    "testName": "Functional.dhcpd",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> diff --git a/tests/Functional.dhcpd/test.yaml
> b/tests/Functional.dhcpd/test.yaml
> new file mode 100644
> index 0000000..8af6bd6
> --- /dev/null
> +++ b/tests/Functional.dhcpd/test.yaml
> @@ -0,0 +1,26 @@
> +fuego_package_version: 1
> +name: Functional.dhcpd
> +description: |
> +      The Internet Systems Consortium DHCP Server, dhcpd, implements the
> Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap
> Protocol (BOOTP).
> +      DHCP allows hosts on a TCP/IP network to request and be assigned IP
> addresses, and also to discover information about the network to which they
> are attached.
> +      BOOTP provides similar functionality, with certain restrictions.
> +      This is a simple test to check the service can start successfully.
> +license: Unknown
If you wrote the test, you should assign it a license.  If your company
doesn't have a policy, I would recommend that you use the default
license for Fuego itself, which is "BSD-3-Clause".

> +author: Wang Mingyu <wangmy@cn.fujitsu.com>
> +maintainer: Tim Bird <tim.bird@sony.com>
You should list yourself as the maintainer.  I am already maintaining
a lot of other tests, and I need to reduce the number of tests
that I am the maintainer of.

> +version: 1.00
> +fuego_release: 1
> +type: Functional
> +tags: ['vlan']
> +params:
> +      IFETH="the eth interface in your target board" Defined in board file
> +data_files:
> + - dhcpd_test.sh
> + - fuego_test.sh
> + - parser.py
> + - spec.json
> + - test.yaml
> + - tests
> +   dhcpd_ps.sh
> +   dhcpd_pidfile.sh
> +   dhcpd_syslog.sh
I believe you should just list the directories 'tests' and 'data', and that you
don't need to list each individual file in this test manifest.

You should test this by trying to package the test using:
ftc package-test -t Functional.dhcpd
and then checking the resulting package file using 'tar -tzvf'.

> diff --git a/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
> b/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
> new file mode 100644
> index 0000000..4970ee6
> --- /dev/null
> +++ b/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
> @@ -0,0 +1,93 @@
> +#!/bin/sh
> +
> +#  In the target start dhcpd, and check if the /var/run/dhcpd.pid is exist
> +#  check the keyword "dhcpd".
> +
> +test="pidfile"
> +
> +. ./fuego_board_function_lib.sh
> +
> +set_init_manager
> +
> +dhcpd_status=$(exec_service_on_target dhcpd is-active)
> +dnsmasq_status=$(exec_service_on_target dnsmasq is-active)
> +
> +exec_service_on_target dhcpd stop
> +exec_service_on_target dnsmasq stop
> +
> +if [ -f /var/run/dhcpd.pid ]
> +then
> +    rm -f /var/run/dhcpd.pid
> +fi
> +
> +if [ -f /etc/dhcp/dhcpd.conf ]
> +then
> +    cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bak
> +fi
> +
> +if [ -e /etc/default/dhcp-server ]
> +then
> +    cp /etc/default/dhcp-server /etc/default/dhcp-server_bak
> +fi
> +
> +echo "INTERFACES="$remote_ifeth"" > /etc/default/dhcp-server
> +
> +cp data/change_dhcpd.conf /etc/
> +
> +chmod +x /etc/change_dhcpd.conf
> +
> +restore_target(){
> +    rm -f /etc/change_dhcpd.conf
> +    if [ -f /etc/dhcp/dhcpd.conf_bak ]
> +    then
> +        mv /etc/dhcp/dhcpd.conf_bak /etc/dhcp/dhcpd.conf
> +    fi
> +
> +    if [ -e /etc/default/dhcp-server ]
> +    then
> +        mv /etc/default/dhcp-server_bak /etc/default/dhcp-server
> +    fi
> +    if [ "$dnsmasq_status" = "active" ]
> +    then
> +        exec_service_on_target dnsmasq start
> +    fi
> +    if [ "$dhcpd_status" = "active" ]
> +    then
> +        exec_service_on_target dhcpd start
> +    fi
> +}
> +
> +/etc/change_dhcpd.conf
> +
> +if exec_service_on_target dhcpd start
> +then
> +    echo " -> start of dhcpd succeeded."
> +else
> +    echo " -> start of dhcpd failed."
> +    echo " -> $test: TEST-FAIL"
> +    restore_target
> +    exit
> +fi
> +
> +sleep 10
> +
> +if test -f /var/run/dhcpd.pid
> +then
> +    echo " -> get the pidfile of dhcpd."
> +else
> +    echo " -> can't get the pidfile of dhcpd."
> +    echo " -> $test: TEST-FAIL"
> +    exec_service_on_target dhcpd stop
> +    restore_target
> +    exit
> +fi
> +
> +exec_service_on_target dhcpd stop
> +
> +if test ! -f /var/run/dhcpd.pid
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +restore_target
> diff --git a/tests/Functional.dhcpd/tests/dhcpd_ps.sh
> b/tests/Functional.dhcpd/tests/dhcpd_ps.sh
> new file mode 100644
> index 0000000..2896ba1
> --- /dev/null
> +++ b/tests/Functional.dhcpd/tests/dhcpd_ps.sh
> @@ -0,0 +1,88 @@
> +#!/bin/sh
> +
> +#  In the target start dhcpd, and confirm the process condition by command
> ps.
> +#  check the keyword "dhcpd".
> +
> +test="ps"
> +
> +. ./fuego_board_function_lib.sh
> +
> +set_init_manager
> +
> +dhcpd_status=$(exec_service_on_target dhcpd is-active)
> +dnsmasq_status=$(exec_service_on_target dnsmasq is-active)
> +
> +exec_service_on_target dhcpd stop
> +exec_service_on_target dnsmasq stop
> +
> +if [ -e /etc/default/dhcp-server ]
> +then
> +    cp /etc/default/dhcp-server /etc/default/dhcp-server_bak
> +fi
> +
> +echo "INTERFACES="$remote_ifeth"" > /etc/default/dhcp-server
> +
> +if [ -e /etc/dhcp/dhcpd.conf ]
> +then
> +    mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bak
> +fi
> +
> +cp data/change_dhcpd.conf /etc/
> +
> +restore_target(){
> +    rm -f /etc/change_dhcpd.conf
> +    if [ -f /etc/dhcp/dhcpd.conf_bak ]
> +    then
> +        mv /etc/dhcp/dhcpd.conf_bak /etc/dhcp/dhcpd.conf
> +    fi
> +
> +    if [ -e /etc/default/dhcp-server ]
> +    then
> +        mv /etc/default/dhcp-server_bak /etc/default/dhcp-server
> +    fi
> +    if [ "$dnsmasq_status" = "active" ]
> +    then
> +        exec_service_on_target dnsmasq start
> +    fi
> +    if [ "$dhcpd_status" = "active" ]
> +    then
> +        exec_service_on_target dhcpd start
> +    fi
> +}
> +
> +chmod +x /etc/change_dhcpd.conf
> +
> +/etc/change_dhcpd.conf
> +
> +if exec_service_on_target dhcpd start
> +then
> +    echo " -> start of dhcpd succeeded."
> +else
> +    echo " -> start of dhcpd failed."
> +    echo " -> $test: TEST-FAIL"
> +    restore_target
> +    exit
> +fi
> +
> +sleep 10
> +
> +if ps aux | grep "[/]usr/sbin/dhcpd"
> +then
> +    echo " -> get the pid of dhcpd."
> +else
> +    echo " -> can't get the pid of dhcpd."
> +    echo " -> $test: TEST-FAIL"
> +    exec_service_on_target dhcpd stop
> +    restore_target
> +    exit
> +fi
> +
> +exec_service_on_target dhcpd stop
> +
> +if ps aux | grep "[/]usr/sbin/dhcpd"
> +then
> +    echo " -> $test: TEST-FAIL"
> +else
> +    echo " -> $test: TEST-PASS"
> +fi
> +restore_target
> diff --git a/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
> b/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
> new file mode 100644
> index 0000000..e53dd69
> --- /dev/null
> +++ b/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
> @@ -0,0 +1,90 @@
> +#!/bin/sh
> +
> +#  In the target start dhcpd, and check the messages of /var/log/syslog.
> +#  check the keyword "dhcpd".
> +
> +test="syslog"
> +
> +. ./fuego_board_function_lib.sh
> +
> +set_init_manager
> +logger_service=$(detect_logger_service)
> +
> +dhcpd_status=$(exec_service_on_target dhcpd is-active)
> +dnsmasq_status=$(exec_service_on_target dnsmasq is-active)
> +
> +exec_service_on_target dhcpd stop
> +exec_service_on_target $logger_service stop
> +
> +if [ -f /var/log/syslog ]
> +then
> +    mv /var/log/syslog /var/log/syslog_bak
> +fi
> +
> +if [ -e /etc/default/dhcp-server ]
> +then
> +    cp /etc/default/dhcp-server /etc/default/dhcp-server_bak
> +fi
> +
> +echo "INTERFACES="$remote_ifeth"" > /etc/default/dhcp-server
> +
> +if [ -f /etc/dhcp/dhcpd.conf ]
> +then
> +    cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bak
> +fi
> +
> +cp data/change_dhcpd.conf /etc/
> +
> +restore_target(){
> +    rm -f /etc/change_dhcpd.conf
> +    if [ -f /etc/dhcp/dhcpd.conf_bak ]
> +    then
> +        mv /etc/dhcp/dhcpd.conf_bak /etc/dhcp/dhcpd.conf
> +    fi
> +
> +    if [ -e /etc/default/dhcp-server ]
> +    then
> +        mv /etc/default/dhcp-server_bak /etc/default/dhcp-server
> +    fi
> +
> +    if [ -f /var/log/syslog_bak ]
> +    then
> +        mv /var/log/syslog_bak /var/log/syslog
> +    fi
> +    if [ "$dnsmasq_status" = "active" ]
> +    then
> +        exec_service_on_target dnsmasq start
> +    fi
> +    if [ "$dhcpd_status" = "active" ]
> +    then
> +        exec_service_on_target dhcpd start
> +    fi
> +}
> +
> +chmod +x /etc/change_dhcpd.conf
> +
> +/etc/change_dhcpd.conf
> +
> +exec_service_on_target $logger_service restart
> +
> +if exec_service_on_target dhcpd start
> +then
> +    echo " -> start of dhcpd succeeded."
> +else
> +    echo " -> start of dhcpd failed."
> +    echo " -> $test: TEST-FAIL"
> +    restore_target
> +    exit
> +fi
> +
> +sleep 10
> +
> +if cat /var/log/syslog | grep "dhcpd"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +exec_service_on_target dhcpd stop
> +restore_target
> --
> 1.8.3.1
> 

The rest of this looks OK.  Please address my comments and re-submit.

Thanks.
 -- Tim


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du.
  2019-04-19  1:27   ` Tim.Bird
@ 2019-04-19  5:38     ` Wang, Mingyu
  0 siblings, 0 replies; 8+ messages in thread
From: Wang, Mingyu @ 2019-04-19  5:38 UTC (permalink / raw)
  To: fuego

Hi Tim,

>There is no text explaining the reason for these changes.  This is unacceptable.
Reason will be added when resubmit.

>> @@ -79,7 +78,7 @@ function test_run {
>>          export test_tcpip_host=$SRV_IP; \
>>          export test_port_host=${SRV_PORT:=8080}; \
>>          export test_ipaddr=$IPADDR;\
>> -        sh -v busybox_test.sh"
>> +        ./busybox_test.sh"
>OK.  But why was this change made?
In the previous submission, you gave the following comment, and since then, no longer use sh -v.

"You should use "./ethtool_test.sh" instead of 'sh -v ethtool_test.sh'.
If you really want the '-v' argument, you can add it to the ethtool_test.sh invocation line (the so-called 'shebang'), like so:
#!/bin/sh -v
It's a bit better if Fuego doesn't know whether the test program it's executing is a script or a program."

>> --- a/tests/Functional.busybox/tests/busybox_du.sh
>> +++ b/tests/Functional.busybox/tests/busybox_du.sh
>> @@ -8,7 +8,7 @@ test="du"
>>  mkdir test_dir
>>  touch ./test_dir/test1
>>  touch ./test_dir/test2
>> -if busybox du -k test_dir | grep "4.*test_dir"
>> +if busybox du -k test_dir | grep ".*test_dir"
>Why was this change made?  This is a major change in test behavior.
>Previously, the test is validating the number returned by  'du -k', but now it is not.  This reduces 
>the test coverage substantially.
On all my machines, busybox du -k gives 0, not 4.
Can you use hexdump to confirm the contents of the file?
 
Thanks!

by wangmy


-----Original Message-----
From: Tim.Bird@sony.com [mailto:Tim.Bird@sony.com] 
Sent: Friday, April 19, 2019 9:28 AM
To: Wang, Mingyu/王 鸣瑜 <wangmy@cn.fujitsu.com>; fuego@lists.linuxfoundation.org
Subject: RE: [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du.

See comments inline below.

> -----Original Message-----
> From: Wang Mingyu
> 

There is no text explaining the reason for these changes.  This is unacceptable.

> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  tests/Functional.busybox/fuego_test.sh       | 5 ++---
>  tests/Functional.busybox/tests/busybox_du.sh | 2 +-
>  2 files changed, 3 insertions(+), 4 deletions(-)  mode change 100755 
> => 100644 tests/Functional.busybox/fuego_test.sh
> 
> diff --git a/tests/Functional.busybox/fuego_test.sh
> b/tests/Functional.busybox/fuego_test.sh
> old mode 100755
> new mode 100644
> index a7aef3e..b866d99
> --- a/tests/Functional.busybox/fuego_test.sh
> +++ b/tests/Functional.busybox/fuego_test.sh
> @@ -47,8 +47,7 @@ function skip_if_in_skiplist {  }
> 
>  function test_pre_check {
> -    is_on_target_path busybox PROGRAM_BUSYBOX
> -    assert_define PROGRAM_BUSYBOX "Missing 'busybox' program on target
> board"
> +    assert_has_program busybox
Good.

>      echo "Tests skipped depending on the availability of a command on 
> the target"
>      touch ${LOGDIR}/skiplist.txt
>      skip_if_command_unavailable expect "busybox_ash.sh 
> busybox_passwd.sh"
> @@ -79,7 +78,7 @@ function test_run {
>          export test_tcpip_host=$SRV_IP; \
>          export test_port_host=${SRV_PORT:=8080}; \
>          export test_ipaddr=$IPADDR;\
> -        sh -v busybox_test.sh"
> +        ./busybox_test.sh"
OK.  But why was this change made?

>  }
> 
>  function test_processing {
> diff --git a/tests/Functional.busybox/tests/busybox_du.sh
> b/tests/Functional.busybox/tests/busybox_du.sh
> index 4710fb8..0430954 100644
> --- a/tests/Functional.busybox/tests/busybox_du.sh
> +++ b/tests/Functional.busybox/tests/busybox_du.sh
> @@ -8,7 +8,7 @@ test="du"
>  mkdir test_dir
>  touch ./test_dir/test1
>  touch ./test_dir/test2
> -if busybox du -k test_dir | grep "4.*test_dir"
> +if busybox du -k test_dir | grep ".*test_dir"
Why was this change made?  This is a major change in test behavior.
Previously, the test is validating the number returned by  'du -k', but now it is not.  This reduces the test coverage substantially.

Please explain.
>  then
>      echo " -> $test: TEST-PASS"
>  else
> --
> 1.8.3.1

Thanks for the patch, but please address the issues I have raised.
 -- Tim






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-19  5:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18 23:39 [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Wang Mingyu
2019-04-18 23:39 ` [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd Wang Mingyu
2019-04-19  1:51   ` Tim.Bird
2019-04-18 23:39 ` [Fuego] [PATCH v2] hostapd: Add test cases of command hostapd Wang Mingyu
2019-04-18 23:39 ` [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du Wang Mingyu
2019-04-19  1:27   ` Tim.Bird
2019-04-19  5:38     ` Wang, Mingyu
2019-04-19  1:20 ` [Fuego] [PATCH] iperf3: Add test cases for command iperf3 in server mode Tim.Bird

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.