All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH v2] dumpsexp: Add test cases for command dumpsexp.
@ 2019-04-04 10:34 Wang Mingyu
  2019-04-04 10:34 ` [Fuego] [PATCH v2] keyctl: Add test cases for command keyctl Wang Mingyu
  2019-04-04 10:34 ` [Fuego] [PATCH v3] vconfig: Add test cases of command vconfig Wang Mingyu
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Mingyu @ 2019-04-04 10:34 UTC (permalink / raw)
  To: fuego

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

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 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

diff --git a/tests/Functional.dumpsexp/dumpsexp_test.sh b/tests/Functional.dumpsexp/dumpsexp_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.dumpsexp/dumpsexp_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.dumpsexp/fuego_test.sh b/tests/Functional.dumpsexp/fuego_test.sh
new file mode 100644
index 0000000..d7eb7dc
--- /dev/null
+++ b/tests/Functional.dumpsexp/fuego_test.sh
@@ -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"
+}
diff --git a/tests/Functional.dumpsexp/parser.py b/tests/Functional.dumpsexp/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.dumpsexp/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.dumpsexp/spec.json b/tests/Functional.dumpsexp/spec.json
new file mode 100644
index 0000000..0d4d706
--- /dev/null
+++ b/tests/Functional.dumpsexp/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.dumpsexp",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.dumpsexp/tests/dumpsexp01.sh b/tests/Functional.dumpsexp/tests/dumpsexp01.sh
new file mode 100644
index 0000000..65d578d
--- /dev/null
+++ b/tests/Functional.dumpsexp/tests/dumpsexp01.sh
@@ -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
diff --git a/tests/Functional.dumpsexp/tests/dumpsexp02.sh b/tests/Functional.dumpsexp/tests/dumpsexp02.sh
new file mode 100644
index 0000000..6308428
--- /dev/null
+++ b/tests/Functional.dumpsexp/tests/dumpsexp02.sh
@@ -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
diff --git a/tests/Functional.dumpsexp/tests/dumpsexp03.sh b/tests/Functional.dumpsexp/tests/dumpsexp03.sh
new file mode 100644
index 0000000..bab1354
--- /dev/null
+++ b/tests/Functional.dumpsexp/tests/dumpsexp03.sh
@@ -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
-- 
1.8.3.1




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

* [Fuego] [PATCH v2] keyctl: Add test cases for command keyctl.
  2019-04-04 10:34 [Fuego] [PATCH v2] dumpsexp: Add test cases for command dumpsexp Wang Mingyu
@ 2019-04-04 10:34 ` Wang Mingyu
  2019-04-04 10:34 ` [Fuego] [PATCH v3] vconfig: Add test cases of command vconfig Wang Mingyu
  1 sibling, 0 replies; 4+ messages in thread
From: Wang Mingyu @ 2019-04-04 10:34 UTC (permalink / raw)
  To: fuego

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

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 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

diff --git a/tests/Functional.keyctl/fuego_test.sh b/tests/Functional.keyctl/fuego_test.sh
new file mode 100644
index 0000000..63aaeb8
--- /dev/null
+++ b/tests/Functional.keyctl/fuego_test.sh
@@ -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"
+}
diff --git a/tests/Functional.keyctl/keyctl_test.sh b/tests/Functional.keyctl/keyctl_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.keyctl/keyctl_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.keyctl/parser.py b/tests/Functional.keyctl/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.keyctl/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.keyctl/spec.json b/tests/Functional.keyctl/spec.json
new file mode 100644
index 0000000..ff0b8dd
--- /dev/null
+++ b/tests/Functional.keyctl/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.keyctl",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.keyctl/tests/keyctl_add.sh b/tests/Functional.keyctl/tests/keyctl_add.sh
new file mode 100644
index 0000000..98f6472
--- /dev/null
+++ b/tests/Functional.keyctl/tests/keyctl_add.sh
@@ -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;
diff --git a/tests/Functional.keyctl/tests/keyctl_clear.sh b/tests/Functional.keyctl/tests/keyctl_clear.sh
new file mode 100644
index 0000000..c93b26c
--- /dev/null
+++ b/tests/Functional.keyctl/tests/keyctl_clear.sh
@@ -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;
diff --git a/tests/Functional.keyctl/tests/keyctl_show.sh b/tests/Functional.keyctl/tests/keyctl_show.sh
new file mode 100644
index 0000000..31cce30
--- /dev/null
+++ b/tests/Functional.keyctl/tests/keyctl_show.sh
@@ -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;
diff --git a/tests/Functional.keyctl/tests/keyctl_version.sh b/tests/Functional.keyctl/tests/keyctl_version.sh
new file mode 100644
index 0000000..eca4e63
--- /dev/null
+++ b/tests/Functional.keyctl/tests/keyctl_version.sh
@@ -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;
-- 
1.8.3.1




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

* [Fuego] [PATCH v3] vconfig: Add test cases of command vconfig.
  2019-04-04 10:34 [Fuego] [PATCH v2] dumpsexp: Add test cases for command dumpsexp Wang Mingyu
  2019-04-04 10:34 ` [Fuego] [PATCH v2] keyctl: Add test cases for command keyctl Wang Mingyu
@ 2019-04-04 10:34 ` Wang Mingyu
  2019-05-20 20:18   ` Tim.Bird
  1 sibling, 1 reply; 4+ messages in thread
From: Wang Mingyu @ 2019-04-04 10:34 UTC (permalink / raw)
  To: fuego

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.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 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

diff --git a/tests/Functional.vconfig/fuego_test.sh b/tests/Functional.vconfig/fuego_test.sh
new file mode 100644
index 0000000..a73fdca
--- /dev/null
+++ b/tests/Functional.vconfig/fuego_test.sh
@@ -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"
+}
diff --git a/tests/Functional.vconfig/parser.py b/tests/Functional.vconfig/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.vconfig/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.vconfig/spec.json b/tests/Functional.vconfig/spec.json
new file mode 100644
index 0000000..a7a2618
--- /dev/null
+++ b/tests/Functional.vconfig/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.vconfig",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.vconfig/test.yaml b/tests/Functional.vconfig/test.yaml
new file mode 100644
index 0000000..4b562e8
--- /dev/null
+++ b/tests/Functional.vconfig/test.yaml
@@ -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 <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
+      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
diff --git a/tests/Functional.vconfig/tests/vconfig_add.sh b/tests/Functional.vconfig/tests/vconfig_add.sh
new file mode 100644
index 0000000..1e2da17
--- /dev/null
+++ b/tests/Functional.vconfig/tests/vconfig_add.sh
@@ -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
diff --git a/tests/Functional.vconfig/tests/vconfig_addaddr.sh b/tests/Functional.vconfig/tests/vconfig_addaddr.sh
new file mode 100644
index 0000000..c434e19
--- /dev/null
+++ b/tests/Functional.vconfig/tests/vconfig_addaddr.sh
@@ -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
diff --git a/tests/Functional.vconfig/tests/vconfig_help.sh b/tests/Functional.vconfig/tests/vconfig_help.sh
new file mode 100644
index 0000000..43314f3
--- /dev/null
+++ b/tests/Functional.vconfig/tests/vconfig_help.sh
@@ -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;
diff --git a/tests/Functional.vconfig/tests/vconfig_remove.sh b/tests/Functional.vconfig/tests/vconfig_remove.sh
new file mode 100644
index 0000000..76a1047
--- /dev/null
+++ b/tests/Functional.vconfig/tests/vconfig_remove.sh
@@ -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
diff --git a/tests/Functional.vconfig/tests/vconfig_set_flag.sh b/tests/Functional.vconfig/tests/vconfig_set_flag.sh
new file mode 100644
index 0000000..9194278
--- /dev/null
+++ b/tests/Functional.vconfig/tests/vconfig_set_flag.sh
@@ -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
diff --git a/tests/Functional.vconfig/tests/vconfig_tag.sh b/tests/Functional.vconfig/tests/vconfig_tag.sh
new file mode 100644
index 0000000..f1298fd
--- /dev/null
+++ b/tests/Functional.vconfig/tests/vconfig_tag.sh
@@ -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
diff --git a/tests/Functional.vconfig/vconfig_test.sh b/tests/Functional.vconfig/vconfig_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.vconfig/vconfig_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
-- 
1.8.3.1




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

* Re: [Fuego] [PATCH v3] vconfig: Add test cases of command vconfig.
  2019-04-04 10:34 ` [Fuego] [PATCH v3] vconfig: Add test cases of command vconfig Wang Mingyu
@ 2019-05-20 20:18   ` Tim.Bird
  0 siblings, 0 replies; 4+ messages in thread
From: Tim.Bird @ 2019-05-20 20:18 UTC (permalink / raw)
  To: wangmy, fuego

See comments inline below.

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

> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  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
> 
> diff --git a/tests/Functional.vconfig/fuego_test.sh
> b/tests/Functional.vconfig/fuego_test.sh
> new file mode 100644
> index 0000000..a73fdca
> --- /dev/null
> +++ b/tests/Functional.vconfig/fuego_test.sh
> @@ -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"
> +}
> diff --git a/tests/Functional.vconfig/parser.py
> b/tests/Functional.vconfig/parser.py
> new file mode 100644
> index 0000000..f25a608
> --- /dev/null
> +++ b/tests/Functional.vconfig/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.vconfig/spec.json
> b/tests/Functional.vconfig/spec.json
> new file mode 100644
> index 0000000..a7a2618
> --- /dev/null
> +++ b/tests/Functional.vconfig/spec.json
> @@ -0,0 +1,6 @@
> +{
> +    "testName": "Functional.vconfig",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> diff --git a/tests/Functional.vconfig/test.yaml
> b/tests/Functional.vconfig/test.yaml
> new file mode 100644
> index 0000000..4b562e8
> --- /dev/null
> +++ b/tests/Functional.vconfig/test.yaml
> @@ -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 <wangmy@cn.fujitsu.com>
> +maintainer: Tim Bird <tim.bird@sony.com>
I changed the maintainer to you.  :-)

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

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

> diff --git a/tests/Functional.vconfig/tests/vconfig_add.sh
> b/tests/Functional.vconfig/tests/vconfig_add.sh
> new file mode 100644
> index 0000000..1e2da17
> --- /dev/null
> +++ b/tests/Functional.vconfig/tests/vconfig_add.sh
> @@ -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
> diff --git a/tests/Functional.vconfig/tests/vconfig_addaddr.sh
> b/tests/Functional.vconfig/tests/vconfig_addaddr.sh
> new file mode 100644
> index 0000000..c434e19
> --- /dev/null
> +++ b/tests/Functional.vconfig/tests/vconfig_addaddr.sh
> @@ -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
> diff --git a/tests/Functional.vconfig/tests/vconfig_help.sh
> b/tests/Functional.vconfig/tests/vconfig_help.sh
> new file mode 100644
> index 0000000..43314f3
> --- /dev/null
> +++ b/tests/Functional.vconfig/tests/vconfig_help.sh
> @@ -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;
> diff --git a/tests/Functional.vconfig/tests/vconfig_remove.sh
> b/tests/Functional.vconfig/tests/vconfig_remove.sh
> new file mode 100644
> index 0000000..76a1047
> --- /dev/null
> +++ b/tests/Functional.vconfig/tests/vconfig_remove.sh
> @@ -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
> diff --git a/tests/Functional.vconfig/tests/vconfig_set_flag.sh
> b/tests/Functional.vconfig/tests/vconfig_set_flag.sh
> new file mode 100644
> index 0000000..9194278
> --- /dev/null
> +++ b/tests/Functional.vconfig/tests/vconfig_set_flag.sh
> @@ -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
> diff --git a/tests/Functional.vconfig/tests/vconfig_tag.sh
> b/tests/Functional.vconfig/tests/vconfig_tag.sh
> new file mode 100644
> index 0000000..f1298fd
> --- /dev/null
> +++ b/tests/Functional.vconfig/tests/vconfig_tag.sh
> @@ -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
> diff --git a/tests/Functional.vconfig/vconfig_test.sh
> b/tests/Functional.vconfig/vconfig_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/tests/Functional.vconfig/vconfig_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> --
> 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


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

end of thread, other threads:[~2019-05-20 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04 10:34 [Fuego] [PATCH v2] dumpsexp: Add test cases for command dumpsexp Wang Mingyu
2019-04-04 10:34 ` [Fuego] [PATCH v2] keyctl: Add test cases for command keyctl Wang Mingyu
2019-04-04 10:34 ` [Fuego] [PATCH v3] vconfig: Add test cases of command vconfig Wang Mingyu
2019-05-20 20:18   ` 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.