Skip to contentSkip to conversation

dumpsexp: Add test cases for command dumpsexp.

PATCH Superseded Wang Mingyu 2 participants 4 messages Apr 4, 2019 – May 20, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dumpsexp: Add test cases for command dumpsexp.

This test set checks the option to print offsets of file, help message and version.

---
 tests/Functional.dumpsexp/dumpsexp_test.sh    |  4 ++++
 tests/Functional.dumpsexp/fuego_test.sh       | 17 +++++++++++++++++
 tests/Functional.dumpsexp/parser.py           | 20 ++++++++++++++++++++
 tests/Functional.dumpsexp/spec.json           |  6 ++++++
 tests/Functional.dumpsexp/tests/dumpsexp01.sh | 16 ++++++++++++++++
 tests/Functional.dumpsexp/tests/dumpsexp02.sh | 13 +++++++++++++
 tests/Functional.dumpsexp/tests/dumpsexp03.sh | 13 +++++++++++++
 7 files changed, 89 insertions(+)
 create mode 100755 tests/Functional.dumpsexp/dumpsexp_test.sh
 create mode 100644 tests/Functional.dumpsexp/fuego_test.sh
 create mode 100644 tests/Functional.dumpsexp/parser.py
 create mode 100644 tests/Functional.dumpsexp/spec.json
 create mode 100644 tests/Functional.dumpsexp/tests/dumpsexp01.sh
 create mode 100644 tests/Functional.dumpsexp/tests/dumpsexp02.sh
 create mode 100644 tests/Functional.dumpsexp/tests/dumpsexp03.sh
tests/Functional.dumpsexp/dumpsexp_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.dumpsexp/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..d7eb7dc
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program dumpsexp
+}
+
+function test_deploy {
+    put $TEST_HOME/dumpsexp_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./dumpsexp_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.dumpsexp/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.dumpsexp/spec.json new file +6 -0
new file mode 100644
index 0000000..0d4d706
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dumpsexp",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.dumpsexp/tests/dumpsexp01.sh new file +16 -0
new file mode 100644
index 0000000..65d578d
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run the command dumpsexp to print offsets of file.
+#  option: none
+
+test="dumpsexp"
+
+mkdir test_dir
+echo test > test_dir/libgcrypt_test
+if dumpsexp test_dir/libgcrypt_test | grep "74 65 73 74 0a"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -fr test_dir
tests/Functional.dumpsexp/tests/dumpsexp02.sh new file +13 -0
new file mode 100644
index 0000000..6308428
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run the command dumpsexp to print help message.
+#  option: --help
+
+test="dumpsexp02"
+
+if dumpsexp --help | grep "Usage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.dumpsexp/tests/dumpsexp03.sh new file +13 -0
new file mode 100644
index 0000000..bab1354
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run the command dumpsexp to print version.
+#  option: --version
+
+test="dumpsexp03"
+
+if dumpsexp --version | grep "Copyright"
+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 keyctl: Add test cases for command keyctl.

This test set is used to add/show/clear the data of key.

---
 tests/Functional.keyctl/fuego_test.sh           | 17 +++++++++++++++++
 tests/Functional.keyctl/keyctl_test.sh          |  4 ++++
 tests/Functional.keyctl/parser.py               | 20 ++++++++++++++++++++
 tests/Functional.keyctl/spec.json               |  6 ++++++
 tests/Functional.keyctl/tests/keyctl_add.sh     | 14 ++++++++++++++
 tests/Functional.keyctl/tests/keyctl_clear.sh   | 14 ++++++++++++++
 tests/Functional.keyctl/tests/keyctl_show.sh    | 13 +++++++++++++
 tests/Functional.keyctl/tests/keyctl_version.sh | 13 +++++++++++++
 8 files changed, 101 insertions(+)
 create mode 100644 tests/Functional.keyctl/fuego_test.sh
 create mode 100755 tests/Functional.keyctl/keyctl_test.sh
 create mode 100644 tests/Functional.keyctl/parser.py
 create mode 100644 tests/Functional.keyctl/spec.json
 create mode 100644 tests/Functional.keyctl/tests/keyctl_add.sh
 create mode 100644 tests/Functional.keyctl/tests/keyctl_clear.sh
 create mode 100644 tests/Functional.keyctl/tests/keyctl_show.sh
 create mode 100644 tests/Functional.keyctl/tests/keyctl_version.sh
tests/Functional.keyctl/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..63aaeb8
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program keyctl
+}
+
+function test_deploy {
+    put $TEST_HOME/keyctl_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./keyctl_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.keyctl/keyctl_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.keyctl/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.keyctl/spec.json new file +6 -0
new file mode 100644
index 0000000..ff0b8dd
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.keyctl",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.keyctl/tests/keyctl_add.sh new file +14 -0
new file mode 100644
index 0000000..98f6472
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  The testscript checks the command keyctl.
+#  option: add
+
+test="add"
+
+keyctl add user _display  data  @u
+if keyctl show | grep "user: _display"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.keyctl/tests/keyctl_clear.sh new file +14 -0
new file mode 100644
index 0000000..c93b26c
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+#  The testscript checks the command keyctl.
+#  option: clear
+
+test="clear"
+
+keyctl clear @u
+if keyctl show | grep "Session Keyring"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.keyctl/tests/keyctl_show.sh new file +13 -0
new file mode 100644
index 0000000..31cce30
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command keyctl.
+#  option: show
+
+test="show"
+
+if keyctl show | grep "_ses"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.keyctl/tests/keyctl_version.sh new file +13 -0
new file mode 100644
index 0000000..eca4e63
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command keyctl.
+#  option: --version
+
+test="version"
+
+if keyctl --version | grep "keyctl"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v3 1/1 vconfig: Add test cases of command vconfig.

In reply to Wang Mingyu

Command vconfig is VLAN (802.1q) configuration program.
This test set is used to check the option to add/remove the vlan-device and set flat for it.

---
 tests/Functional.vconfig/fuego_test.sh             | 22 +++++++++++++++
 tests/Functional.vconfig/parser.py                 | 20 ++++++++++++++
 tests/Functional.vconfig/spec.json                 |  6 +++++
 tests/Functional.vconfig/test.yaml                 | 31 ++++++++++++++++++++++
 tests/Functional.vconfig/tests/vconfig_add.sh      | 16 +++++++++++
 tests/Functional.vconfig/tests/vconfig_addaddr.sh  | 17 ++++++++++++
 tests/Functional.vconfig/tests/vconfig_help.sh     | 13 +++++++++
 tests/Functional.vconfig/tests/vconfig_remove.sh   | 15 +++++++++++
 tests/Functional.vconfig/tests/vconfig_set_flag.sh | 16 +++++++++++
 tests/Functional.vconfig/tests/vconfig_tag.sh      | 29 ++++++++++++++++++++
 tests/Functional.vconfig/vconfig_test.sh           |  4 +++
 11 files changed, 189 insertions(+)
 create mode 100644 tests/Functional.vconfig/fuego_test.sh
 create mode 100644 tests/Functional.vconfig/parser.py
 create mode 100644 tests/Functional.vconfig/spec.json
 create mode 100644 tests/Functional.vconfig/test.yaml
 create mode 100644 tests/Functional.vconfig/tests/vconfig_add.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_addaddr.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_help.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_remove.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_set_flag.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_tag.sh
 create mode 100755 tests/Functional.vconfig/vconfig_test.sh
tests/Functional.vconfig/fuego_test.sh new file +22 -0
new file mode 100644
index 0000000..a73fdca
@@ -0,0 +1,22 @@
+function test_pre_check {
+    assert_has_program vconfig
+    assert_has_program tcpdump
+    assert_has_program ping
+}
+
+function test_deploy {
+    put $TEST_HOME/vconfig_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export vcon_ifeth=$IFETH;\
+    export vcon_ip1=$VCON_IP1;\
+    export vcon_ip2=$VCON_IP2;\
+    ./vconfig_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.vconfig/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.vconfig/spec.json new file +6 -0
new file mode 100644
index 0000000..a7a2618
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.vconfig",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.vconfig/test.yaml new file +31 -0
new file mode 100644
index 0000000..4b562e8
@@ -0,0 +1,31 @@
+fuego_package_version: 1
+name: Functional.vconfig
+description: |
+      The vconfig program allows you to create and remove vlan-devices on a vlan enabled kernel. 
+      Vlan-devices are virtual ethernet devices which represents the virtual lans on the physical lan.
+      This is a simple test to check the option help/add/rem/set_flag
+      of command vconfig. 
+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
+      VCON_IP1="IP address configured for eth interface" Defined in board file
+      VCON_IP2="IP address which the eth to access" Defined in board file
+data_files:
+ - vconfig_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
+   vconfig_addaddr.sh
+   vconfig_add.sh
+   vconfig_help.sh
+   vconfig_remove.sh
+   vconfig_set_flag.sh
+   vconfig_tag.sh
tests/Functional.vconfig/tests/vconfig_add.sh new file +16 -0
new file mode 100644
index 0000000..1e2da17
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: add
+
+test="add"
+
+vconfig add $vcon_ifeth 4
+
+if ifconfig $vcon_ifeth.4 | grep "$vcon_ifeth.4"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+vconfig rem $vcon_ifeth.4
tests/Functional.vconfig/tests/vconfig_addaddr.sh new file +17 -0
new file mode 100644
index 0000000..c434e19
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: add/rem
+
+test="addaddr"
+
+vconfig add $vcon_ifeth 100
+ifconfig $vcon_ifeth.100 inet 192.168.255.1 netmask 0xffffff00
+
+if ifconfig $vcon_ifeth.100 | grep "192.168.255.1"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+vconfig rem $vcon_ifeth.100
tests/Functional.vconfig/tests/vconfig_help.sh new file +13 -0
new file mode 100644
index 0000000..43314f3
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: none
+
+test="help"
+
+if vconfig | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.vconfig/tests/vconfig_remove.sh new file +15 -0
new file mode 100644
index 0000000..76a1047
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: rem
+
+test="remove"
+
+vconfig add $vcon_ifeth 4
+
+if vconfig rem $vcon_ifeth.4 | grep "Removed VLAN"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.vconfig/tests/vconfig_set_flag.sh new file +16 -0
new file mode 100644
index 0000000..9194278
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: set_flag
+
+test="set_flag"
+
+vconfig add $vcon_ifeth 4
+
+if vconfig set_flag $vcon_ifeth.4 1 | grep "Set flag on device"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+vconfig rem $vcon_ifeth.4
tests/Functional.vconfig/tests/vconfig_tag.sh new file +29 -0
new file mode 100644
index 0000000..f1298fd
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: add/rem
+
+test="tag"
+
+mkdir test_dir
+
+ifconfig $vcon_ifeth up
+vconfig add $vcon_ifeth 100
+
+# specify the address to vlanif by ifconfig. 
+ifconfig $vcon_ifeth.100 inet $vcon_ip1 netmask 0xffffff00
+
+# to verify the IP address exists and can accept requests.
+ping -q -c 50 -I $vcon_ifeth.100 $vcon_ip2 &
+
+# check the VLAN tag by tcpdump.
+tcpdump -c 10 -ex -i $vcon_ifeth ether broadcast > test_dir/dumpdata
+
+if cat test_dir/dumpdata | grep "vlan 100"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -fr test_dir
+vconfig rem $vcon_ifeth.100
tests/Functional.vconfig/vconfig_test.sh new file +4 -0
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
Signature · 1 line
1.8.3.1
#3 lore raw

Re: [Fuego] [PATCH v3] vconfig: Add test cases of command vconfig.

See comments inline below.

Quoted 6 lines

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

Command vconfig is VLAN (802.1q) configuration program.
This test set is used to check the option to add/remove the vlan-device and set flat for it.

I think you mean 'flag'.
This could be wrapped better. I fixed it.

Quoted 111 lines
---
 tests/Functional.vconfig/fuego_test.sh             | 22 +++++++++++++++
 tests/Functional.vconfig/parser.py                 | 20 ++++++++++++++
 tests/Functional.vconfig/spec.json                 |  6 +++++
 tests/Functional.vconfig/test.yaml                 | 31 ++++++++++++++++++++++
 tests/Functional.vconfig/tests/vconfig_add.sh      | 16 +++++++++++
 tests/Functional.vconfig/tests/vconfig_addaddr.sh  | 17 ++++++++++++
 tests/Functional.vconfig/tests/vconfig_help.sh     | 13 +++++++++
 tests/Functional.vconfig/tests/vconfig_remove.sh   | 15 +++++++++++
 tests/Functional.vconfig/tests/vconfig_set_flag.sh | 16 +++++++++++
 tests/Functional.vconfig/tests/vconfig_tag.sh      | 29
++++++++++++++++++++
 tests/Functional.vconfig/vconfig_test.sh           |  4 +++
 11 files changed, 189 insertions(+)
 create mode 100644 tests/Functional.vconfig/fuego_test.sh
 create mode 100644 tests/Functional.vconfig/parser.py
 create mode 100644 tests/Functional.vconfig/spec.json
 create mode 100644 tests/Functional.vconfig/test.yaml
 create mode 100644 tests/Functional.vconfig/tests/vconfig_add.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_addaddr.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_help.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_remove.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_set_flag.sh
 create mode 100644 tests/Functional.vconfig/tests/vconfig_tag.sh
 create mode 100755 tests/Functional.vconfig/vconfig_test.sh
tests/Functional.vconfig/fuego_test.sh new file +22 -0
new file mode 100644
index 0000000..a73fdca
@@ -0,0 +1,22 @@
+function test_pre_check {
+    assert_has_program vconfig
+    assert_has_program tcpdump
+    assert_has_program ping
+}
+
+function test_deploy {
+    put $TEST_HOME/vconfig_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    export vcon_ifeth=$IFETH;\
+    export vcon_ip1=$VCON_IP1;\
+    export vcon_ip2=$VCON_IP2;\
+    ./vconfig_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.vconfig/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.vconfig/spec.json new file +6 -0
new file mode 100644
index 0000000..a7a2618
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.vconfig",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.vconfig/test.yaml new file +4 -0
new file mode 100644
index 0000000..4b562e8
@@ -0,0 +1,31 @@
+fuego_package_version: 1
+name: Functional.vconfig
+description: |
+      The vconfig program allows you to create and remove vlan-devices on a

vlan enabled kernel.
+ Vlan-devices are virtual ethernet devices which represents the virtual
lans on the physical lan.

tests/Functional.vconfig/test.yaml line 10

Quoted 5 lines
tests/Functional.vconfig/test.yaml new file +5 -0
+      This is a simple test to check the option help/add/rem/set_flag
+      of command vconfig.
+license: Unknown
+author: Wang Mingyu <[email protected]>
+maintainer: Tim Bird <[email protected]>

I changed the maintainer to you. :-)

Quoted 9 lines
tests/Functional.vconfig/test.yaml new file +7 -0
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['vlan']
+params:
+      IFETH="the eth interface in your target board" Defined in board file
+      VCON_IP1="IP address configured for eth interface" Defined in board

file
+ VCON_IP2="IP address which the eth to access" Defined in board file

Usually, this section described the items that come from the spec file, or are defined in dynamic variables on the command line. I don't know if we've used this to describe variables from the board file before.

In any event, this is probably not the correct syntax for that. Here's the syntax we should probably use:

IFETH:
description: The Ethernet interface in your target board
example: "eth1"
optional: no

I changed this, but I'm still thinking about if this is the right approach. I believe these should be documented, and the yaml file is a good place to do that (IMHO), but I'm not sure about the syntax.

tests/Functional.vconfig/test.yaml line 31

Quoted 13 lines
tests/Functional.vconfig/test.yaml new file +13 -0
+data_files:
+ - vconfig_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
+   vconfig_addaddr.sh
+   vconfig_add.sh
+   vconfig_help.sh
+   vconfig_remove.sh
+   vconfig_set_flag.sh
+   vconfig_tag.sh

These don't need to be listed individually. These sub-files will get added to the test package file (when doing 'ftc package-test'), because you have the parent directory listed ('tests'). I removed these.

Quoted 160 lines
tests/Functional.vconfig/tests/vconfig_add.sh new file +16 -0
new file mode 100644
index 0000000..1e2da17
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: add
+
+test="add"
+
+vconfig add $vcon_ifeth 4
+
+if ifconfig $vcon_ifeth.4 | grep "$vcon_ifeth.4"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+vconfig rem $vcon_ifeth.4
tests/Functional.vconfig/tests/vconfig_addaddr.sh new file +17 -0
new file mode 100644
index 0000000..c434e19
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: add/rem
+
+test="addaddr"
+
+vconfig add $vcon_ifeth 100
+ifconfig $vcon_ifeth.100 inet 192.168.255.1 netmask 0xffffff00
+
+if ifconfig $vcon_ifeth.100 | grep "192.168.255.1"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+vconfig rem $vcon_ifeth.100
tests/Functional.vconfig/tests/vconfig_help.sh new file +13 -0
new file mode 100644
index 0000000..43314f3
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: none
+
+test="help"
+
+if vconfig | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
tests/Functional.vconfig/tests/vconfig_remove.sh new file +15 -0
new file mode 100644
index 0000000..76a1047
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: rem
+
+test="remove"
+
+vconfig add $vcon_ifeth 4
+
+if vconfig rem $vcon_ifeth.4 | grep "Removed VLAN"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.vconfig/tests/vconfig_set_flag.sh new file +16 -0
new file mode 100644
index 0000000..9194278
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: set_flag
+
+test="set_flag"
+
+vconfig add $vcon_ifeth 4
+
+if vconfig set_flag $vcon_ifeth.4 1 | grep "Set flag on device"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+vconfig rem $vcon_ifeth.4
tests/Functional.vconfig/tests/vconfig_tag.sh new file +29 -0
new file mode 100644
index 0000000..f1298fd
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+#  In target, run command vconfig.
+#  option: add/rem
+
+test="tag"
+
+mkdir test_dir
+
+ifconfig $vcon_ifeth up
+vconfig add $vcon_ifeth 100
+
+# specify the address to vlanif by ifconfig.
+ifconfig $vcon_ifeth.100 inet $vcon_ip1 netmask 0xffffff00
+
+# to verify the IP address exists and can accept requests.
+ping -q -c 50 -I $vcon_ifeth.100 $vcon_ip2 &
+
+# check the VLAN tag by tcpdump.
+tcpdump -c 10 -ex -i $vcon_ifeth ether broadcast > test_dir/dumpdata
+
+if cat test_dir/dumpdata | grep "vlan 100"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -fr test_dir
+vconfig rem $vcon_ifeth.100
tests/Functional.vconfig/vconfig_test.sh new file +4 -1
new file mode 100755
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
--
Quoted 1 line

1.8.3.1

This patch is applied in the fuego-test 'next' branch.

Please try it out, and let me know if I broke anything.
-- Tim