Skip to contentSkip to conversation

iperf3: Add test cases for command iperf3 in server mode.

PATCH In review Wang Mingyu 2 participants 8 messages Apr 18, 2019 – Apr 19, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 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
tests/Functional.iperf3_server/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..3cc380e
@@ -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"
+}
tests/Functional.iperf3_server/iperf3_server_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.iperf3_server/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.iperf3_server/spec.json new file +6 -0
new file mode 100644
index 0000000..dbd6d04
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.iperf3_server",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.iperf3_server/tests/iperf3_help.sh new file +13 -0
new file mode 100644
index 0000000..6928699
@@ -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;
tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh new file +22 -0
new file mode 100644
index 0000000..f181445
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh new file +22 -0
new file mode 100644
index 0000000..865af0e
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh new file +18 -0
new file mode 100644
index 0000000..a5c7ea5
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_client.sh new file +22 -0
new file mode 100644
index 0000000..e7e1306
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh new file +20 -0
new file mode 100644
index 0000000..ca4b57f
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh new file +25 -0
new file mode 100644
index 0000000..b26f659
@@ -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
tests/Functional.iperf3_server/tests/iperf3_version.sh new file +13 -0
new file mode 100644
index 0000000..7327ecc
@@ -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
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/1 dhcpd: Add test cases of service dhcpd.

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.

---
 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
tests/Functional.dhcpd/data/change_dhcpd.conf new file +5 -0
new file mode 100644
index 0000000..8e79207
@@ -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
tests/Functional.dhcpd/data/dhcpd.conf new file +18 -0
new file mode 100644
index 0000000..2ce38b8
@@ -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
+
+}
+
tests/Functional.dhcpd/dhcpd_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.dhcpd/fuego_test.sh new file +21 -0
new file mode 100644
index 0000000..7710bf6
@@ -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"
+}
tests/Functional.dhcpd/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.dhcpd/spec.json new file +6 -0
new file mode 100644
index 0000000..1cf5e10
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dhcpd",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.dhcpd/test.yaml new file +26 -0
new file mode 100644
index 0000000..8af6bd6
@@ -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 <[email protected]>
+maintainer: Tim Bird <[email protected]> 
+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
tests/Functional.dhcpd/tests/dhcpd_pidfile.sh new file +93 -0

93 lines not on this page · raw message

tests/Functional.dhcpd/tests/dhcpd_ps.sh new file +88 -0

88 lines not on this page · raw message

tests/Functional.dhcpd/tests/dhcpd_syslog.sh new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

Re: [Fuego] [PATCH v2] dhcpd: Add test cases of service dhcpd.

See comments inline below.

Quoted 46 lines

-----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.

---
 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
tests/Functional.dhcpd/data/change_dhcpd.conf new file +3 -0
new file mode 100644
index 0000000..8e79207
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+echo " subnet 192.168.246.0 netmask 255.255.255.0 {" >>

/etc/dhcp/dhcpd.conf

tests/Functional.dhcpd/data/change_dhcpd.conf line 5

Quoted 2 lines
tests/Functional.dhcpd/data/change_dhcpd.conf new file +2 -0
+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?

Quoted 15 lines
tests/Functional.dhcpd/data/dhcpd.conf new file +8 -0
new file mode 100644
index 0000000..2ce38b8
@@ -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 {

tests/Functional.dhcpd/data/dhcpd.conf line 18

Quoted 10 lines
tests/Functional.dhcpd/data/dhcpd.conf new file +10 -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?

Quoted 21 lines
tests/Functional.dhcpd/dhcpd_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.dhcpd/fuego_test.sh new file +3 -0
new file mode 100644
index 0000000..7710bf6
@@ -0,0 +1,21 @@
+function test_pre_check {
+    is_on_target_path dhcpd PROGRAM_DHCPD
+    assert_define PROGRAM_DHCPD "Missing 'dhcpd' program on target
Quoted 1 line

board"

Should use assert_has_program here.

Quoted 75 lines
tests/Functional.dhcpd/fuego_test.sh new file +5 -0
+}
+
+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

tests/Functional.dhcpd/fuego_test.sh new file +13 -0
+    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"
+}
tests/Functional.dhcpd/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.dhcpd/spec.json new file +6 -0
new file mode 100644
index 0000000..1cf5e10
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dhcpd",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.dhcpd/test.yaml new file +4 -0
new file mode 100644
index 0000000..8af6bd6
@@ -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.

tests/Functional.dhcpd/test.yaml line 8

Quoted 3 lines
tests/Functional.dhcpd/test.yaml new file +3 -0
+      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".

tests/Functional.dhcpd/test.yaml line 10

Quoted 2 lines
tests/Functional.dhcpd/test.yaml new file +2 -0
+author: Wang Mingyu <[email protected]>
+maintainer: Tim Bird <[email protected]>

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.

Quoted 6 lines
tests/Functional.dhcpd/test.yaml new file +6 -0
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['vlan']
+params:
+      IFETH="the eth interface in your target board" Defined in board file

tests/Functional.dhcpd/test.yaml line 26

Quoted 10 lines
tests/Functional.dhcpd/test.yaml new file +10 -0
+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'.

Quoted 294 lines
tests/Functional.dhcpd/tests/dhcpd_pidfile.sh new file +93 -0
new file mode 100644
index 0000000..4970ee6
@@ -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
tests/Functional.dhcpd/tests/dhcpd_ps.sh new file +3 -0
new file mode 100644
index 0000000..2896ba1
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+#  In the target start dhcpd, and confirm the process condition by command

ps.

tests/Functional.dhcpd/tests/dhcpd_ps.sh new file +85 -0
+#  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
tests/Functional.dhcpd/tests/dhcpd_syslog.sh new file +90 -1
new file mode 100644
index 0000000..e53dd69
@@ -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
--
Quoted 2 lines

1.8.3.1

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

Thanks.
-- Tim

#3 lore raw

PATCH v2 1/1 hostapd: Add test cases of command hostapd.

In reply to Wang Mingyu

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.

---
 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
tests/Functional.hostapd/fuego_test.sh new file +19 -0
new file mode 100644
index 0000000..a9d7197
@@ -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"
+}
tests/Functional.hostapd/hostapd_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.hostapd/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.hostapd/spec.json new file +6 -0
new file mode 100644
index 0000000..447448e
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.hostapd",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.hostapd/test.yaml new file +24 -0
new file mode 100644
index 0000000..c76e2e1
@@ -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 <[email protected]>
+maintainer: Tim Bird <[email protected]>
+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
tests/Functional.hostapd/tests/hostapd_help.sh new file +15 -0
new file mode 100644
index 0000000..a5b904b
@@ -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
tests/Functional.hostapd/tests/hostapd_ps.sh new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 1/1 busybox: Modify fuego_test.sh and the test of du.

In reply to Wang Mingyu
---
 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
tests/Functional.busybox/fuego_test.sh +2 -3
old mode 100755
new mode 100644
index a7aef3e..b866d99
@@ -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 {
tests/Functional.busybox/tests/busybox_du.sh +1 -1
index 4710fb8..0430954 100644
@@ -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
Signature · 1 line
1.8.3.1
#5 lore raw

Re: [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du.

See comments inline below.

Quoted 3 lines

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

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

Quoted 20 lines
---
 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
tests/Functional.busybox/fuego_test.sh +0 -2
old mode 100755
new mode 100644
index a7aef3e..b866d99
@@ -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
Quoted 2 lines

board"
+ assert_has_program busybox

Good.

tests/Functional.busybox/fuego_test.sh function test_run { · line 81

Quoted 11 lines

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"

tests/Functional.busybox/fuego_test.sh +1 -1
@@ -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?

Quoted 9 lines
tests/Functional.busybox/fuego_test.sh +0 -0
 }
 
 function test_processing {
tests/Functional.busybox/tests/busybox_du.sh +0 -0
index 4710fb8..0430954 100644

tests/Functional.busybox/tests/busybox_du.sh test="du" · line 11

Quoted 5 lines
tests/Functional.busybox/tests/busybox_du.sh +1 -1
@@ -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.

Quoted 5 lines
tests/Functional.busybox/tests/busybox_du.sh +0 -1
 then
     echo " -> $test: TEST-PASS"
 else
--

1.8.3.1

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

#6 lore raw

Re: [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du.

Hi Tim,

Quoted 1 line

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

Reason will be added when resubmit.

Quoted 7 lines

tests/Functional.busybox/fuego_test.sh function test_run { · line 81

Quoted 6 lines
tests/Functional.busybox/fuego_test.sh +1 -1
@@ -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."

Quoted 11 lines

tests/Functional.busybox/tests/busybox_du.sh test="du" · line 11

Quoted 8 lines
tests/Functional.busybox/tests/busybox_du.sh +1 -1
@@ -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: [email protected] [mailto:[email protected]]
Sent: Friday, April 19, 2019 9:28 AM
To: Wang, Mingyu/王 鸣瑜 <[email protected]>; [email protected]
Subject: RE: [Fuego] [PATCH] busybox: Modify fuego_test.sh and the test of du.

See comments inline below.

Quoted 3 lines

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

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

Quoted 19 lines
---
 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

tests/Functional.busybox/fuego_test.sh +0 -2
old mode 100755
new mode 100644
index a7aef3e..b866d99
@@ -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
Quoted 2 lines

board"
+ assert_has_program busybox

Good.

tests/Functional.busybox/fuego_test.sh function test_run { · line 81

Quoted 11 lines

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"

tests/Functional.busybox/fuego_test.sh +1 -1
@@ -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?

Quoted 9 lines
tests/Functional.busybox/fuego_test.sh +0 -0
 }
 
 function test_processing {
tests/Functional.busybox/tests/busybox_du.sh +0 -0
index 4710fb8..0430954 100644

tests/Functional.busybox/tests/busybox_du.sh test="du" · line 11

Quoted 5 lines
tests/Functional.busybox/tests/busybox_du.sh +1 -1
@@ -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.

Quoted 5 lines
tests/Functional.busybox/tests/busybox_du.sh +0 -1
 then
     echo " -> $test: TEST-PASS"
 else
--

1.8.3.1

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

#7 lore raw
In reply to Wang Mingyu

Applied to the fuegotest 'next' branch.

Thanks!
-- Tim

Quoted 343 lines

-----Original Message-----
From: [email protected] [mailto:fuego- [email protected]] On Behalf Of Wang Mingyu
Sent: Thursday, April 18, 2019 4:39 PM
To: [email protected]
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.

---
 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
tests/Functional.iperf3_server/fuego_test.sh new file +7 -0
new file mode 100644
index 0000000..3cc380e
@@ -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/

tests/Functional.iperf3_server/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;\
+    ./iperf3_server_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.iperf3_server/iperf3_server_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.iperf3_server/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.iperf3_server/spec.json new file +6 -0
new file mode 100644
index 0000000..dbd6d04
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.iperf3_server",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.iperf3_server/tests/iperf3_help.sh new file +13 -0
new file mode 100644
index 0000000..6928699
@@ -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;
tests/Functional.iperf3_server/tests/iperf3_server_TCP.sh new file +22 -0
new file mode 100644
index 0000000..f181445
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_TCP_port.sh new file +22 -0
new file mode 100644
index 0000000..865af0e
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_UDP.sh new file +18 -0
new file mode 100644
index 0000000..a5c7ea5
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_client.sh new file +22 -0
new file mode 100644
index 0000000..e7e1306
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_client_UDP.sh new file +20 -0
new file mode 100644
index 0000000..ca4b57f
@@ -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
tests/Functional.iperf3_server/tests/iperf3_server_client_port.sh new file +25 -0
new file mode 100644
index 0000000..b26f659
@@ -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
tests/Functional.iperf3_server/tests/iperf3_version.sh new file +13 -1
new file mode 100644
index 0000000..7327ecc
@@ -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
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego