All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH v2] Add test cases for command ethtool.
@ 2018-09-18 15:57 Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command cryptsetup Wang Mingyu
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 engine/tests/Functional.ethtool/ethtool_test.sh    |  4 ++++
 engine/tests/Functional.ethtool/fuego_test.sh      | 18 +++++++++++++++
 engine/tests/Functional.ethtool/parser.py          | 22 ++++++++++++++++++
 engine/tests/Functional.ethtool/spec.json          |  7 ++++++
 .../Functional.ethtool/tests/ethtool_driver.sh     | 25 +++++++++++++++++++++
 .../tests/Functional.ethtool/tests/ethtool_help.sh | 13 +++++++++++
 .../tests/Functional.ethtool/tests/ethtool_show.sh | 26 ++++++++++++++++++++++
 7 files changed, 115 insertions(+)
 create mode 100755 engine/tests/Functional.ethtool/ethtool_test.sh
 create mode 100644 engine/tests/Functional.ethtool/fuego_test.sh
 create mode 100644 engine/tests/Functional.ethtool/parser.py
 create mode 100644 engine/tests/Functional.ethtool/spec.json
 create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_driver.sh
 create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_help.sh
 create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_show.sh

diff --git a/engine/tests/Functional.ethtool/ethtool_test.sh b/engine/tests/Functional.ethtool/ethtool_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.ethtool/ethtool_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.ethtool/fuego_test.sh b/engine/tests/Functional.ethtool/fuego_test.sh
new file mode 100644
index 0000000..233d367
--- /dev/null
+++ b/engine/tests/Functional.ethtool/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path ethtool PROGRAM_ETHTOOL
+    assert_define PROGRAM_ETHTOOL "Missing 'ethtool' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/ethtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./ethtool_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.ethtool/parser.py b/engine/tests/Functional.ethtool/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.ethtool/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.ethtool/spec.json b/engine/tests/Functional.ethtool/spec.json
new file mode 100644
index 0000000..c16b2d5
--- /dev/null
+++ b/engine/tests/Functional.ethtool/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.ethtool",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.ethtool/tests/ethtool_driver.sh b/engine/tests/Functional.ethtool/tests/ethtool_driver.sh
new file mode 100644
index 0000000..6f6d576
--- /dev/null
+++ b/engine/tests/Functional.ethtool/tests/ethtool_driver.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#  In target, run command ethtool.
+#  option: -i
+
+test="driver"
+
+ETHERNET_DEVICE_NAME="have no Ethernet device"
+ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
+
+for line in $(cat driver_list)
+do
+    if ethtool $line | grep "baseT"
+    then
+        ETHERNET_DEVICE_NAME=$line
+        break
+    fi
+done
+
+if ethtool -i $ETHERNET_DEVICE_NAME | grep driver
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.ethtool/tests/ethtool_help.sh b/engine/tests/Functional.ethtool/tests/ethtool_help.sh
new file mode 100644
index 0000000..4554de3
--- /dev/null
+++ b/engine/tests/Functional.ethtool/tests/ethtool_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command ethtool.
+#  option: help
+
+test="help"
+
+if ethtool -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.ethtool/tests/ethtool_show.sh b/engine/tests/Functional.ethtool/tests/ethtool_show.sh
new file mode 100644
index 0000000..98abe40
--- /dev/null
+++ b/engine/tests/Functional.ethtool/tests/ethtool_show.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+#  In target, run command ethtool.
+#  option: none
+
+test="show"
+
+ETHERNET_DEVICE_NAME="have no Ethernet device"
+ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
+
+for line in $(cat driver_list)
+do
+    if ethtool $line | grep "baseT"
+    then
+        ETHERNET_DEVICE_NAME=$line
+        break
+    fi
+done
+
+
+if ethtool $ETHERNET_DEVICE_NAME | grep "Settings for"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
-- 
1.8.3.1




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

* [Fuego] [PATCH] Add test cases for command cryptsetup.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-10-12  0:03   ` Tim.Bird
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command ecryptfs-manager Wang Mingyu
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 .../tests/Functional.cryptsetup/cryptsetup_test.sh |  4 +++
 engine/tests/Functional.cryptsetup/fuego_test.sh   | 18 ++++++++++++
 engine/tests/Functional.cryptsetup/parser.py       | 22 +++++++++++++++
 engine/tests/Functional.cryptsetup/spec.json       |  7 +++++
 .../tests/cryptsetup_create.sh                     | 32 ++++++++++++++++++++++
 .../Functional.cryptsetup/tests/cryptsetup_help.sh | 13 +++++++++
 6 files changed, 96 insertions(+)
 create mode 100755 engine/tests/Functional.cryptsetup/cryptsetup_test.sh
 create mode 100644 engine/tests/Functional.cryptsetup/fuego_test.sh
 create mode 100644 engine/tests/Functional.cryptsetup/parser.py
 create mode 100644 engine/tests/Functional.cryptsetup/spec.json
 create mode 100644 engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh
 create mode 100644 engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh

diff --git a/engine/tests/Functional.cryptsetup/cryptsetup_test.sh b/engine/tests/Functional.cryptsetup/cryptsetup_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.cryptsetup/cryptsetup_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.cryptsetup/fuego_test.sh b/engine/tests/Functional.cryptsetup/fuego_test.sh
new file mode 100644
index 0000000..7354b01
--- /dev/null
+++ b/engine/tests/Functional.cryptsetup/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path cryptsetup PROGRAM_CRYPTSETUP
+    assert_define PROGRAM_CRYPTSETUP "Missing 'cryptsetup' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/cryptsetup_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./cryptsetup_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.cryptsetup/parser.py b/engine/tests/Functional.cryptsetup/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.cryptsetup/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.cryptsetup/spec.json b/engine/tests/Functional.cryptsetup/spec.json
new file mode 100644
index 0000000..ec65501
--- /dev/null
+++ b/engine/tests/Functional.cryptsetup/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.cryptsetup",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh b/engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh
new file mode 100644
index 0000000..98eb5d2
--- /dev/null
+++ b/engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command cryptsetup
+#  option: create
+
+test="create"
+
+modprobe loop
+
+dd if=/dev/zero of=/tmp/cryptloop bs=1k count=1000
+losetup -f
+losetup /dev/loop0 /tmp/cryptloop
+
+expect <<-EOF
+spawn cryptsetup create loop_test /dev/loop0
+expect {                
+ -re "Enter passphrase:" { 
+           send "test\n" 
+           send_user " -> $test: create loop_test succeeded.\n"
+          }
+ default { send_user " -> $test: TEST-FAIL\n" }  }
+expect eof
+EOF
+
+if ls /dev/mapper | grep loop_test
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+cryptsetup remove loop_test
+losetup -d /dev/loop0
diff --git a/engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh b/engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh
new file mode 100644
index 0000000..caa625d
--- /dev/null
+++ b/engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command cryptsetup
+#  option: --help
+
+test="help"
+
+if cryptsetup --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
-- 
1.8.3.1




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

* [Fuego] [PATCH] Add test cases for command ecryptfs-manager.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command cryptsetup Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command zabbix Wang Mingyu
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 .../ecryptfs-manager_test.sh                       |  4 ++++
 .../Functional.ecryptfs-manager/fuego_test.sh      | 18 ++++++++++++++++
 engine/tests/Functional.ecryptfs-manager/parser.py | 22 ++++++++++++++++++++
 engine/tests/Functional.ecryptfs-manager/spec.json |  7 +++++++
 .../tests/ecryptfs-manager01.sh                    | 23 +++++++++++++++++++++
 .../tests/ecryptfs-manager02.sh                    | 24 ++++++++++++++++++++++
 6 files changed, 98 insertions(+)
 create mode 100755 engine/tests/Functional.ecryptfs-manager/ecryptfs-manager_test.sh
 create mode 100644 engine/tests/Functional.ecryptfs-manager/fuego_test.sh
 create mode 100644 engine/tests/Functional.ecryptfs-manager/parser.py
 create mode 100644 engine/tests/Functional.ecryptfs-manager/spec.json
 create mode 100644 engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager01.sh
 create mode 100644 engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager02.sh

diff --git a/engine/tests/Functional.ecryptfs-manager/ecryptfs-manager_test.sh b/engine/tests/Functional.ecryptfs-manager/ecryptfs-manager_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.ecryptfs-manager/ecryptfs-manager_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.ecryptfs-manager/fuego_test.sh b/engine/tests/Functional.ecryptfs-manager/fuego_test.sh
new file mode 100644
index 0000000..aab171d
--- /dev/null
+++ b/engine/tests/Functional.ecryptfs-manager/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path ecryptfs-manager PROGRAM_ECRYPTFS_MANAGER
+    assert_define PROGRAM_ECRYPTFS_MANAGER "Missing 'ecryptfs-manager' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/ecryptfs-manager_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./ecryptfs-manager_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.ecryptfs-manager/parser.py b/engine/tests/Functional.ecryptfs-manager/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.ecryptfs-manager/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.ecryptfs-manager/spec.json b/engine/tests/Functional.ecryptfs-manager/spec.json
new file mode 100644
index 0000000..4168659
--- /dev/null
+++ b/engine/tests/Functional.ecryptfs-manager/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.ecryptfs-manager",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager01.sh b/engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager01.sh
new file mode 100644
index 0000000..57bf971
--- /dev/null
+++ b/engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager01.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#  The testscript execute the command ecryptfs-manager and check the passphrase.
+#  option: none
+
+test="ecryptfs-manager01"
+
+expect <<-EOF
+spawn ecryptfs-manager
+expect "Make selection:"
+send "1\r"
+expect "Mount-wide passphrase:"
+send "test123\r"
+expect ".*Confirm passphrase:"
+send "test123\r"
+expect {
+ -re ".*Using the default salt value.*" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+default { send_user " -> $test: TEST-FAIL\n" }  }
+send "4\r"
+expect eof
+EOF
diff --git a/engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager02.sh b/engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager02.sh
new file mode 100644
index 0000000..b34b360
--- /dev/null
+++ b/engine/tests/Functional.ecryptfs-manager/tests/ecryptfs-manager02.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#  The testscript execute the command ecryptfs-manager and check the passphrase.
+#  option: none
+
+test="ecryptfs-manager02"
+
+expect <<-EOF
+spawn ecryptfs-manager
+expect "Make selection:"
+send "1\r"
+expect "Mount-wide passphrase:"
+send "test123\r"
+expect ".*Confirm passphrase:"
+send "test123\r"
+expect "Using the default salt value"
+expect {
+ -re "That key was already" {
+           send_user " -> $test: TEST-PASS\n"
+          }
+default { send_user " -> $test: TEST-FAIL\n" }  }
+send "4\r"
+expect eof
+EOF
-- 
1.8.3.1




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

* [Fuego] [PATCH] Add test cases for command zabbix.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command cryptsetup Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command ecryptfs-manager Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-09-25  2:00   ` Tim.Bird
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command dumpsexp Wang Mingyu
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 engine/tests/Functional.zabbix/fuego_test.sh       | 18 ++++++++++++++++++
 engine/tests/Functional.zabbix/parser.py           | 22 ++++++++++++++++++++++
 engine/tests/Functional.zabbix/spec.json           |  7 +++++++
 .../tests/Functional.zabbix/tests/zabbix_help.sh   | 13 +++++++++++++
 .../tests/Functional.zabbix/tests/zabbix_print.sh  | 13 +++++++++++++
 engine/tests/Functional.zabbix/zabbix_test.sh      |  4 ++++
 6 files changed, 77 insertions(+)
 create mode 100644 engine/tests/Functional.zabbix/fuego_test.sh
 create mode 100644 engine/tests/Functional.zabbix/parser.py
 create mode 100644 engine/tests/Functional.zabbix/spec.json
 create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_help.sh
 create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_print.sh
 create mode 100755 engine/tests/Functional.zabbix/zabbix_test.sh

diff --git a/engine/tests/Functional.zabbix/fuego_test.sh b/engine/tests/Functional.zabbix/fuego_test.sh
new file mode 100644
index 0000000..0a142bf
--- /dev/null
+++ b/engine/tests/Functional.zabbix/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path zabbix_agentd PROGRAM_ZABBIX_AGENTD
+    assert_define PROGRAM_ZABBIX_AGENTD "Missing 'zabbix_agentd' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/zabbix_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./zabbix_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.zabbix/parser.py b/engine/tests/Functional.zabbix/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.zabbix/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.zabbix/spec.json b/engine/tests/Functional.zabbix/spec.json
new file mode 100644
index 0000000..50ab91d
--- /dev/null
+++ b/engine/tests/Functional.zabbix/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.v10pkgs",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.zabbix/tests/zabbix_help.sh b/engine/tests/Functional.zabbix/tests/zabbix_help.sh
new file mode 100644
index 0000000..6d7bbd0
--- /dev/null
+++ b/engine/tests/Functional.zabbix/tests/zabbix_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command zabbix_agentd.
+#  option: -h
+
+test="help"
+
+if zabbix_agentd -h | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.zabbix/tests/zabbix_print.sh b/engine/tests/Functional.zabbix/tests/zabbix_print.sh
new file mode 100644
index 0000000..98760d4
--- /dev/null
+++ b/engine/tests/Functional.zabbix/tests/zabbix_print.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command zabbix_agentd.
+#  option: -p
+
+test="print"
+
+if zabbix_agentd -p | grep localhost
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.zabbix/zabbix_test.sh b/engine/tests/Functional.zabbix/zabbix_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.zabbix/zabbix_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] 13+ messages in thread

* [Fuego] [PATCH] Add test cases for command dumpsexp.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
                   ` (2 preceding siblings ...)
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command zabbix Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command keyctl Wang Mingyu
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 engine/tests/Functional.dumpsexp/dumpsexp_test.sh  |  4 ++++
 engine/tests/Functional.dumpsexp/fuego_test.sh     | 18 ++++++++++++++++++
 engine/tests/Functional.dumpsexp/parser.py         | 22 ++++++++++++++++++++++
 engine/tests/Functional.dumpsexp/spec.json         |  7 +++++++
 engine/tests/Functional.dumpsexp/tests/dumpsexp.sh | 15 +++++++++++++++
 5 files changed, 66 insertions(+)
 create mode 100755 engine/tests/Functional.dumpsexp/dumpsexp_test.sh
 create mode 100644 engine/tests/Functional.dumpsexp/fuego_test.sh
 create mode 100644 engine/tests/Functional.dumpsexp/parser.py
 create mode 100644 engine/tests/Functional.dumpsexp/spec.json
 create mode 100644 engine/tests/Functional.dumpsexp/tests/dumpsexp.sh

diff --git a/engine/tests/Functional.dumpsexp/dumpsexp_test.sh b/engine/tests/Functional.dumpsexp/dumpsexp_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.dumpsexp/dumpsexp_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.dumpsexp/fuego_test.sh b/engine/tests/Functional.dumpsexp/fuego_test.sh
new file mode 100644
index 0000000..4c6b7a9
--- /dev/null
+++ b/engine/tests/Functional.dumpsexp/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path dumpsexp PROGRAM_DUMPSEXP
+    assert_define PROGRAM_DUMPSEXP "Missing 'dumpsexp' program on target board"
+}
+
+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/engine/tests/Functional.dumpsexp/parser.py b/engine/tests/Functional.dumpsexp/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.dumpsexp/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.dumpsexp/spec.json b/engine/tests/Functional.dumpsexp/spec.json
new file mode 100644
index 0000000..3d43e5a
--- /dev/null
+++ b/engine/tests/Functional.dumpsexp/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.dumpsexp",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.dumpsexp/tests/dumpsexp.sh b/engine/tests/Functional.dumpsexp/tests/dumpsexp.sh
new file mode 100644
index 0000000..cf5eb82
--- /dev/null
+++ b/engine/tests/Functional.dumpsexp/tests/dumpsexp.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command dumpsexp.
+#  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;
-- 
1.8.3.1




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

* [Fuego] [PATCH] Add test cases for command keyctl.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
                   ` (3 preceding siblings ...)
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command dumpsexp Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH v2] Add test cases for commands of module-init-tools Wang Mingyu
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 engine/tests/Functional.keyctl/fuego_test.sh       | 18 ++++++++++++++++++
 engine/tests/Functional.keyctl/keyctl_test.sh      |  4 ++++
 engine/tests/Functional.keyctl/parser.py           | 22 ++++++++++++++++++++++
 engine/tests/Functional.keyctl/spec.json           |  7 +++++++
 engine/tests/Functional.keyctl/tests/keyctl_add.sh | 14 ++++++++++++++
 .../tests/Functional.keyctl/tests/keyctl_clear.sh  | 14 ++++++++++++++
 .../tests/Functional.keyctl/tests/keyctl_show.sh   | 13 +++++++++++++
 .../Functional.keyctl/tests/keyctl_version.sh      | 13 +++++++++++++
 8 files changed, 105 insertions(+)
 create mode 100644 engine/tests/Functional.keyctl/fuego_test.sh
 create mode 100755 engine/tests/Functional.keyctl/keyctl_test.sh
 create mode 100644 engine/tests/Functional.keyctl/parser.py
 create mode 100644 engine/tests/Functional.keyctl/spec.json
 create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_add.sh
 create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_clear.sh
 create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_show.sh
 create mode 100644 engine/tests/Functional.keyctl/tests/keyctl_version.sh

diff --git a/engine/tests/Functional.keyctl/fuego_test.sh b/engine/tests/Functional.keyctl/fuego_test.sh
new file mode 100644
index 0000000..c2d4082
--- /dev/null
+++ b/engine/tests/Functional.keyctl/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    is_on_target_path keyctl PROGRAM_KEYCTL
+    assert_define PROGRAM_KEYCTL "Missing 'keyctl' program on target board"
+}
+
+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/engine/tests/Functional.keyctl/keyctl_test.sh b/engine/tests/Functional.keyctl/keyctl_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.keyctl/keyctl_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.keyctl/parser.py b/engine/tests/Functional.keyctl/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.keyctl/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.keyctl/spec.json b/engine/tests/Functional.keyctl/spec.json
new file mode 100644
index 0000000..8f2ee80
--- /dev/null
+++ b/engine/tests/Functional.keyctl/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.keyctl",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.keyctl/tests/keyctl_add.sh b/engine/tests/Functional.keyctl/tests/keyctl_add.sh
new file mode 100644
index 0000000..98f6472
--- /dev/null
+++ b/engine/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/engine/tests/Functional.keyctl/tests/keyctl_clear.sh b/engine/tests/Functional.keyctl/tests/keyctl_clear.sh
new file mode 100644
index 0000000..c93b26c
--- /dev/null
+++ b/engine/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/engine/tests/Functional.keyctl/tests/keyctl_show.sh b/engine/tests/Functional.keyctl/tests/keyctl_show.sh
new file mode 100644
index 0000000..31cce30
--- /dev/null
+++ b/engine/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/engine/tests/Functional.keyctl/tests/keyctl_version.sh b/engine/tests/Functional.keyctl/tests/keyctl_version.sh
new file mode 100644
index 0000000..eca4e63
--- /dev/null
+++ b/engine/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] 13+ messages in thread

* [Fuego] [PATCH v2] Add test cases for commands of module-init-tools.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
                   ` (4 preceding siblings ...)
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command keyctl Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-11-14 22:41   ` Tim.Bird
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command dhcpd Wang Mingyu
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 .../Functional.module-init-tools/fuego_test.sh     | 29 +++++++++++++++
 .../module-init-tools_test.sh                      |  4 ++
 .../tests/Functional.module-init-tools/parser.py   | 22 +++++++++++
 .../tests/Functional.module-init-tools/spec.json   |  7 ++++
 .../tests/module-init-tools_depmod.sh              | 29 +++++++++++++++
 .../tests/module-init-tools_insmod.sh              | 40 ++++++++++++++++++++
 .../tests/module-init-tools_lsmod.sh               | 39 ++++++++++++++++++++
 .../tests/module-init-tools_modinfo.sh             | 18 +++++++++
 .../tests/module-init-tools_modprobe.sh            | 35 ++++++++++++++++++
 .../tests/module-init-tools_rmmod.sh               | 43 ++++++++++++++++++++++
 10 files changed, 266 insertions(+)
 create mode 100644 engine/tests/Functional.module-init-tools/fuego_test.sh
 create mode 100755 engine/tests/Functional.module-init-tools/module-init-tools_test.sh
 create mode 100644 engine/tests/Functional.module-init-tools/parser.py
 create mode 100644 engine/tests/Functional.module-init-tools/spec.json
 create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_depmod.sh
 create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh
 create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_lsmod.sh
 create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_modinfo.sh
 create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_modprobe.sh
 create mode 100644 engine/tests/Functional.module-init-tools/tests/module-init-tools_rmmod.sh

diff --git a/engine/tests/Functional.module-init-tools/fuego_test.sh b/engine/tests/Functional.module-init-tools/fuego_test.sh
new file mode 100644
index 0000000..ac18334
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/fuego_test.sh
@@ -0,0 +1,29 @@
+function test_pre_check {
+    is_on_target_path depmod PROGRAM_DEPMOD
+    assert_define PROGRAM_DEPMOD "Missing 'depmod' program on target board"
+    is_on_target_path insmod PROGRAM_INSMOD
+    assert_define PROGRAM_INSMOD "Missing 'insmod' program on target board"
+    is_on_target_path lsmod PROGRAM_LSMOD
+    assert_define PROGRAM_LSMOD "Missing 'lsmod' program on target board"
+    is_on_target_path rmmod PROGRAM_RMMOD
+    assert_define PROGRAM_RMMOD "Missing 'rmmod' program on target board"
+    is_on_target_path modinfo PROGRAM_MODINFO
+    assert_define PROGRAM_MODINFO "Missing 'modinfo' program on target board"
+    is_on_target_path modprobe PROGRAM_MODPROBE
+    assert_define PROGRAM_MODPROBE "Missing 'modprobe' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/module-init-tools_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh $BOARD_TESTDIR/fuego.$TESTDIR
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./module-init-tools_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.module-init-tools/module-init-tools_test.sh b/engine/tests/Functional.module-init-tools/module-init-tools_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/module-init-tools_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.module-init-tools/parser.py b/engine/tests/Functional.module-init-tools/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.module-init-tools/spec.json b/engine/tests/Functional.module-init-tools/spec.json
new file mode 100644
index 0000000..8e45a5d
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.module-init-tools",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-tools_depmod.sh b/engine/tests/Functional.module-init-tools/tests/module-init-tools_depmod.sh
new file mode 100644
index 0000000..c80f0aa
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/tests/module-init-tools_depmod.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+#  In target, run command depmod.
+#  option: none
+
+test="depmod"
+
+test_krnl_rel=$(uname -r)
+
+if [ -f /lib/modules/$test_krnl_rel/modules.dep ]
+then
+    mv /lib/modules/$test_krnl_rel/modules.dep /lib/modules/$test_krnl_rel/modules.dep_bak
+fi
+
+depmod
+
+if ls -l /lib/modules/$test_krnl_rel/modules.dep
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ -e /lib/modules/$test_krnl_rel/modules.dep_bak ]
+then
+    mv /lib/modules/$test_krnl_rel/modules.dep_bak /lib/modules/$test_krnl_rel/modules.dep
+else
+    rm /lib/modules/$test_krnl_rel/modules.de
+fi
diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh b/engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh
new file mode 100644
index 0000000..443c088
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/tests/module-init-tools_insmod.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+#  In target, run command insmod.
+#  option: none
+
+test="insmod"
+
+tst_mod_file="ko file of module"
+tst_mod_flag=0
+
+if modinfo uvesafb
+then
+    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
+else
+    echo " -> module uvesafb is not exist."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+mkdir test_dir
+cp $tst_mod_file test_dir/
+
+if lsmod | grep uvesafb
+then
+    tst_mod_flag=1
+    rmmod $tst_mod_file
+fi
+
+if insmod test_dir/*.ko
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+if [ $tst_mod_flag=0 ]
+then
+    rmmod $tst_mod_file
+fi
+rm -fr test_dir
diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-tools_lsmod.sh b/engine/tests/Functional.module-init-tools/tests/module-init-tools_lsmod.sh
new file mode 100644
index 0000000..77acb18
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/tests/module-init-tools_lsmod.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#  In target, run command lsmod.
+#  option: none
+
+test="lsmod"
+
+tst_mod_file="ko file of module"
+
+if modinfo uvesafb
+then
+    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
+else
+    echo " -> module uvesafb is not exist."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if lsmod | grep uvesafb
+then
+    echo " -> $test: TEST-PASS"
+    exit
+fi
+
+mkdir test_dir
+cp $tst_mod_file test_dir/
+
+insmod test_dir/*.ko
+
+if lsmod | grep uvesafb
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+rmmod $tst_mod_file
+rm -fr test_dir
+
diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-tools_modinfo.sh b/engine/tests/Functional.module-init-tools/tests/module-init-tools_modinfo.sh
new file mode 100644
index 0000000..4265887
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/tests/module-init-tools_modinfo.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#  In target, run command modinfo.
+#  option: none
+
+test="modinfo"
+
+tst_mod_file="ko file of module"
+tst_mod_flag=0
+
+if modinfo uvesafb | grep "filename"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> module uvesafb is not exist."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-tools_modprobe.sh b/engine/tests/Functional.module-init-tools/tests/module-init-tools_modprobe.sh
new file mode 100644
index 0000000..13823f9
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/tests/module-init-tools_modprobe.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#  In target, run command modprobe.
+#  option: modprobe
+
+test="modprobe"
+
+tst_mod_file="ko file of module"
+tst_mod_flag=0
+test_krnl_rel=$(uname -r)
+
+if modinfo uvesafb
+then
+    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
+else
+    echo " -> module uvesafb is not exist."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if modprobe -D uvesafb | grep "insmod $tst_mod_file"
+then
+    echo " -> $test: modprobe -D is succeeded."
+else
+    echo " -> $test: modprobe -D is failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if cat /lib/modules/$test_krnl_rel/modules.dep | grep "uvesafb.ko"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-tools_rmmod.sh b/engine/tests/Functional.module-init-tools/tests/module-init-tools_rmmod.sh
new file mode 100644
index 0000000..bdd2d30
--- /dev/null
+++ b/engine/tests/Functional.module-init-tools/tests/module-init-tools_rmmod.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#  In target, run command rmmod.
+#  option: none
+
+test="rmmod"
+
+tst_mod_file="ko file of module"
+tst_mod_flag=0
+
+if modinfo uvesafb
+then
+    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
+else
+    echo " -> module uvesafb is not exist."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+mkdir test_dir
+cp $tst_mod_file test_dir/
+
+if lsmod | grep uvesafb
+then
+    tst_mod_flag=1
+fi
+
+insmod test_dir/*.ko
+
+rmmod $tst_mod_file
+
+if lsmod | grep uvesafb
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
+
+if [ $tst_mod_flag=1 ]
+then
+    insmod $tst_mod_file
+fi
+rm -fr test_dir
-- 
1.8.3.1




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

* [Fuego] [PATCH] Add test cases for command dhcpd.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
                   ` (5 preceding siblings ...)
  2018-09-18 15:57 ` [Fuego] [PATCH v2] Add test cases for commands of module-init-tools Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for commands of cross_compilation Wang Mingyu
  2018-09-25  0:23 ` [Fuego] [PATCH v2] Add test cases for command ethtool Tim.Bird
  8 siblings, 0 replies; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 .../tests/Functional.dhcpd/data/change_dhcpd.conf  |  5 ++
 engine/tests/Functional.dhcpd/data/dhcpd.conf      | 18 +++++
 engine/tests/Functional.dhcpd/dhcpd_test.sh        |  4 ++
 engine/tests/Functional.dhcpd/fuego_test.sh        | 20 ++++++
 engine/tests/Functional.dhcpd/parser.py            | 22 ++++++
 engine/tests/Functional.dhcpd/spec.json            |  7 ++
 .../tests/Functional.dhcpd/tests/dhcpd_pidfile.sh  | 82 ++++++++++++++++++++++
 engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh    | 77 ++++++++++++++++++++
 .../tests/Functional.dhcpd/tests/dhcpd_syslog.sh   | 79 +++++++++++++++++++++
 9 files changed, 314 insertions(+)
 create mode 100644 engine/tests/Functional.dhcpd/data/change_dhcpd.conf
 create mode 100644 engine/tests/Functional.dhcpd/data/dhcpd.conf
 create mode 100755 engine/tests/Functional.dhcpd/dhcpd_test.sh
 create mode 100644 engine/tests/Functional.dhcpd/fuego_test.sh
 create mode 100644 engine/tests/Functional.dhcpd/parser.py
 create mode 100644 engine/tests/Functional.dhcpd/spec.json
 create mode 100644 engine/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
 create mode 100644 engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh
 create mode 100644 engine/tests/Functional.dhcpd/tests/dhcpd_syslog.sh

diff --git a/engine/tests/Functional.dhcpd/data/change_dhcpd.conf b/engine/tests/Functional.dhcpd/data/change_dhcpd.conf
new file mode 100644
index 0000000..8e79207
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/data/change_dhcpd.conf
@@ -0,0 +1,5 @@
+#! /bin/sh
+
+echo " subnet 192.168.246.0 netmask 255.255.255.0 {" >> /etc/dhcp/dhcpd.conf
+echo "    range 192.168.246.200 192.168.246.210;" >> /etc/dhcp/dhcpd.conf
+echo " } " >> /etc/dhcp/dhcpd.conf
diff --git a/engine/tests/Functional.dhcpd/data/dhcpd.conf b/engine/tests/Functional.dhcpd/data/dhcpd.conf
new file mode 100644
index 0000000..2ce38b8
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/data/dhcpd.conf
@@ -0,0 +1,18 @@
+# /etc/dhcpd.conf
+
+ddns-update-style none;
+#deny unknown-clients;
+#allow bootp;
+
+# subnet 192.168.0.0 netmask 255.255.255.0 {
+subnet 192.168.246.0 netmask 255.255.255.0 {
+
+  range 192.168.246.100 192.168.246.110; 
+#  option routers 192.168.0.1; 
+  option broadcast-address 192.168.246.255;
+
+  default-lease-time 3600;	# 1h
+  max-lease-time 7200;		# 2h
+
+}
+
diff --git a/engine/tests/Functional.dhcpd/dhcpd_test.sh b/engine/tests/Functional.dhcpd/dhcpd_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/dhcpd_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.dhcpd/fuego_test.sh b/engine/tests/Functional.dhcpd/fuego_test.sh
new file mode 100644
index 0000000..a519db4
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/fuego_test.sh
@@ -0,0 +1,20 @@
+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/engine/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;\
+    ./dhcpd_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.dhcpd/parser.py b/engine/tests/Functional.dhcpd/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.dhcpd/spec.json b/engine/tests/Functional.dhcpd/spec.json
new file mode 100644
index 0000000..b731ab7
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.dhcpd",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh b/engine/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
new file mode 100644
index 0000000..d70c3b8
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/tests/dhcpd_pidfile.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+#  In the target start dhcpd, and check if the /var/run/dhcpd.pid is exist
+#  check the keyword "dhcpd".
+
+test="pidfile"
+remote_ifeth=$(ifconfig | cut -d' ' -f1 | sed -n 1p)
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+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
+}
+
+/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 5
+
+if test -f /var/run/dhcpd.pid
+then
+    echo " -> get the pidfile of dhcpd."
+else
+    echo " -> can't get the pidfile of dhcpd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target dhcpd stop
+    restore_target
+    exit
+fi
+
+exec_service_on_target dhcpd stop
+
+if test ! -f /var/run/dhcpd.pid
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+restore_target
diff --git a/engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh b/engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh
new file mode 100644
index 0000000..5ddc23b
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/tests/dhcpd_ps.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#  In the target start dhcpd, and confirm the process condition by command ps.
+#  check the keyword "dhcpd".
+
+test="ps"
+remote_ifeth=$(ifconfig | cut -d' ' -f1 | sed -n 1p)
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+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
+}
+
+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 5
+
+if ps aux | grep "[/]usr/sbin/dhcpd"
+then
+    echo " -> get the pid of dhcpd."
+else
+    echo " -> can't get the pid of dhcpd."
+    echo " -> $test: TEST-FAIL"
+    exec_service_on_target dhcpd stop
+    restore_target
+    exit
+fi
+
+exec_service_on_target dhcpd stop
+
+if ps aux | grep "[/]usr/sbin/dhcpd"
+then
+    echo " -> $test: TEST-FAIL"
+else
+    echo " -> $test: TEST-PASS"
+fi
+restore_target
diff --git a/engine/tests/Functional.dhcpd/tests/dhcpd_syslog.sh b/engine/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
new file mode 100644
index 0000000..17c2ab5
--- /dev/null
+++ b/engine/tests/Functional.dhcpd/tests/dhcpd_syslog.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+#  In the target start dhcpd, and check the messages of /var/log/syslog.
+#  check the keyword "dhcpd".
+
+test="syslog"
+remote_ifeth=$(ifconfig | cut -d' ' -f1 | sed -n 1p)
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+logger_service=$(detect_logger_service)
+
+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
+}
+
+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 5
+
+if cat /var/log/syslog | grep "dhcpd"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+exec_service_on_target dhcpd stop
+restore_target
-- 
1.8.3.1




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

* [Fuego] [PATCH] Add test cases for commands of cross_compilation.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
                   ` (6 preceding siblings ...)
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command dhcpd Wang Mingyu
@ 2018-09-18 15:57 ` Wang Mingyu
  2018-09-25  0:23 ` [Fuego] [PATCH v2] Add test cases for command ethtool Tim.Bird
  8 siblings, 0 replies; 13+ messages in thread
From: Wang Mingyu @ 2018-09-18 15:57 UTC (permalink / raw)
  To: fuego

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 .../cross_compilation_test.sh                      |  4 +++
 .../Functional.cross_compilation/fuego_test.sh     | 42 ++++++++++++++++++++++
 .../tests/Functional.cross_compilation/parser.py   | 22 ++++++++++++
 .../tests/Functional.cross_compilation/spec.json   |  7 ++++
 .../tests/cross_compilation_dotlockfile.sh         | 15 ++++++++
 .../tests/cross_compilation_drbdsetup.sh           | 13 +++++++
 .../tests/cross_compilation_jpegtran.sh            | 15 ++++++++
 .../tests/cross_compilation_lockfile-create.sh     | 15 ++++++++
 .../tests/cross_compilation_logcheck.sh            | 13 +++++++
 .../tests/cross_compilation_mip6d.sh               | 15 ++++++++
 .../tests/cross_compilation_ntfsend.sh             | 13 +++++++
 .../tests/cross_compilation_numactl.sh             | 13 +++++++
 .../tests/cross_compilation_openhpid.sh            | 13 +++++++
 .../tests/cross_compilation_openl2tpd.sh           | 15 ++++++++
 .../tests/cross_compilation_ptpd2.sh               | 13 +++++++
 .../tests/cross_compilation_setuidgid.sh           | 15 ++++++++
 .../tests/cross_compilation_smartctl.sh            | 13 +++++++
 17 files changed, 256 insertions(+)
 create mode 100755 engine/tests/Functional.cross_compilation/cross_compilation_test.sh
 create mode 100644 engine/tests/Functional.cross_compilation/fuego_test.sh
 create mode 100644 engine/tests/Functional.cross_compilation/parser.py
 create mode 100644 engine/tests/Functional.cross_compilation/spec.json
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh
 create mode 100644 engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh

diff --git a/engine/tests/Functional.cross_compilation/cross_compilation_test.sh b/engine/tests/Functional.cross_compilation/cross_compilation_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/cross_compilation_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/engine/tests/Functional.cross_compilation/fuego_test.sh b/engine/tests/Functional.cross_compilation/fuego_test.sh
new file mode 100644
index 0000000..36ec7bc
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/fuego_test.sh
@@ -0,0 +1,42 @@
+function test_pre_check {
+    is_on_target_path dotlockfile PROGRAM_DOTLOCKFILE
+    assert_define PROGRAM_DOTLOCKFILE "Missing 'dotlockfile' program on target board"
+    is_on_target_path drbdsetup PROGRAM_DRBDSETUP
+    assert_define PROGRAM_DRBDSETUP "Missing 'drbdsetup' program on target board"
+    is_on_target_path jpegtran PROGRAM_JPEGTRAN
+    assert_define PROGRAM_JPEGTRAN "Missing 'jpegtran' program on target board"
+    is_on_target_path lockfile-create PROGRAM_LOCKFILE_CREATE
+    assert_define PROGRAM_LOCKFILE_CREATE "Missing 'lockfile-create' program on target board"
+    is_on_target_path logcheck PROGRAM_LOGCHECK
+    assert_define PROGRAM_LOGCHECK "Missing 'logcheck' program on target board"
+    is_on_target_path mip6d PROGRAM_MIP6D
+    assert_define PROGRAM_MIP6D "Missing 'mip6d' program on target board"
+    is_on_target_path ntfsend PROGRAM_NTFSEND
+    assert_define PROGRAM_NTFSEND "Missing 'ntfsend' program on target board"
+    is_on_target_path numactl PROGRAM_NUMACTL
+    assert_define PROGRAM_NUMACTL "Missing 'numactl' program on target board"
+    is_on_target_path openhpid PROGRAM_OPENHPID
+    assert_define PROGRAM_OPENHPID "Missing 'openhpid' program on target board"
+    is_on_target_path openl2tpd PROGRAM_OPENL2TPD
+    assert_define PROGRAM_OPENL2TPD "Missing 'openl2tpd' program on target board"
+    is_on_target_path ptpd2 PROGRAM_PTPD2
+    assert_define PROGRAM_PTPD2 "Missing 'ptpd2' program on target board"
+    is_on_target_path setuidgid PROGRAM_SETUIDGID
+    assert_define PROGRAM_SETUIDGID "Missing 'setuidgid' program on target board"
+    is_on_target_path smartctl PROGRAM_SMARTCTL
+    assert_define PROGRAM_SMARTCTL "Missing 'smartctl' program on target board"
+}
+
+function test_deploy {
+    put $TEST_HOME/cross_compilation_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./cross_compilation_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.cross_compilation/parser.py b/engine/tests/Functional.cross_compilation/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/parser.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+
+sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/engine/tests/Functional.cross_compilation/spec.json b/engine/tests/Functional.cross_compilation/spec.json
new file mode 100644
index 0000000..a88109e
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.cross_compilation",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh
new file mode 100644
index 0000000..20b19b5
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_dotlockfile.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command dotlockfile.
+#  option: none
+
+test="dotlockfile"
+
+dotlockfile > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh
new file mode 100644
index 0000000..29d2b9b
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_drbdsetup.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command drbdsetup.
+#  option: -h
+
+test="drbdsetup"
+
+if drbdsetup -h | grep USAGE
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh
new file mode 100644
index 0000000..4fce7ab
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_jpegtran.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command jpegtran.
+#  option: -h
+
+test="jpegtran"
+
+jpegtran -h > log 2>&1
+if cat log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh
new file mode 100644
index 0000000..e9c1286
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_lockfile-create.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command lockfile-create.
+#  option: none
+
+test="lockfile-create"
+
+lockfile-create > log 2>&1
+if cat log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
+rm log
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh
new file mode 100644
index 0000000..269999d
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_logcheck.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command logcheck.
+#  option: -h
+
+test="logcheck"
+
+if sudo -u logcheck logcheck -h | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh
new file mode 100644
index 0000000..4c6ee01
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_mip6d.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command mip6d.
+#  option: -h
+
+test="mip6d"
+
+mip6d -h > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh
new file mode 100644
index 0000000..3f80215
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ntfsend.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command ntfsend.
+#  option: --help
+
+test="ntfsend"
+
+if ntfsend --help | grep "ntfsend - send notification"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh
new file mode 100644
index 0000000..61f7870
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_numactl.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command numactl.
+#  option: none
+
+test="numactl"
+
+if numactl -s | grep "policy"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh
new file mode 100644
index 0000000..308497e
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openhpid.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command openhpid.
+#  option: -h
+
+test="openhpid"
+
+if openhpid -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh
new file mode 100644
index 0000000..d49224a
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_openl2tpd.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the command openl2tpd.
+#  option: -h
+
+test="openl2tpd"
+
+openl2tpd -h > log 2>&1
+if cat log | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh
new file mode 100644
index 0000000..f00d4ce
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_ptpd2.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command ptpd2.
+#  option: -h
+
+test="ptpd2"
+
+if ptpd2 -h | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh
new file mode 100644
index 0000000..18acea7
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_setuidgid.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  The testscript checks the following options of the command setuidgid.
+#  option: --help
+
+test="setuidgid"
+
+setuidgid --help > log 2>&1
+if cat log | grep usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm log
diff --git a/engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh b/engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh
new file mode 100644
index 0000000..8188d1b
--- /dev/null
+++ b/engine/tests/Functional.cross_compilation/tests/cross_compilation_smartctl.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  The testscript checks the command smartctl.
+#  option: -h
+
+test="smartctl"
+
+if smartctl -h | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
-- 
1.8.3.1




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

* Re: [Fuego] [PATCH v2] Add test cases for command ethtool.
  2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
                   ` (7 preceding siblings ...)
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for commands of cross_compilation Wang Mingyu
@ 2018-09-25  0:23 ` Tim.Bird
  8 siblings, 0 replies; 13+ messages in thread
From: Tim.Bird @ 2018-09-25  0:23 UTC (permalink / raw)
  To: wangmy, fuego



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

There should be something in the commit message body here.

> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  engine/tests/Functional.ethtool/ethtool_test.sh    |  4 ++++
>  engine/tests/Functional.ethtool/fuego_test.sh      | 18 +++++++++++++++
>  engine/tests/Functional.ethtool/parser.py          | 22 ++++++++++++++++++
>  engine/tests/Functional.ethtool/spec.json          |  7 ++++++
>  .../Functional.ethtool/tests/ethtool_driver.sh     | 25
> +++++++++++++++++++++
>  .../tests/Functional.ethtool/tests/ethtool_help.sh | 13 +++++++++++
>  .../tests/Functional.ethtool/tests/ethtool_show.sh | 26
> ++++++++++++++++++++++
>  7 files changed, 115 insertions(+)
>  create mode 100755 engine/tests/Functional.ethtool/ethtool_test.sh
>  create mode 100644 engine/tests/Functional.ethtool/fuego_test.sh
>  create mode 100644 engine/tests/Functional.ethtool/parser.py
>  create mode 100644 engine/tests/Functional.ethtool/spec.json
>  create mode 100644
> engine/tests/Functional.ethtool/tests/ethtool_driver.sh
>  create mode 100644 engine/tests/Functional.ethtool/tests/ethtool_help.sh
>  create mode 100644
> engine/tests/Functional.ethtool/tests/ethtool_show.sh
> 
> diff --git a/engine/tests/Functional.ethtool/ethtool_test.sh
> b/engine/tests/Functional.ethtool/ethtool_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/engine/tests/Functional.ethtool/ethtool_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/engine/tests/Functional.ethtool/fuego_test.sh
> b/engine/tests/Functional.ethtool/fuego_test.sh
> new file mode 100644
> index 0000000..233d367
> --- /dev/null
> +++ b/engine/tests/Functional.ethtool/fuego_test.sh
> @@ -0,0 +1,18 @@
> +function test_pre_check {
> +    is_on_target_path ethtool PROGRAM_ETHTOOL
> +    assert_define PROGRAM_ETHTOOL "Missing 'ethtool' program on target
> board"
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/ethtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
> +}
> +
> +function test_run {
> +    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
> +    ./ethtool_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/engine/tests/Functional.ethtool/parser.py
> b/engine/tests/Functional.ethtool/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/engine/tests/Functional.ethtool/parser.py
> @@ -0,0 +1,22 @@
> +#!/usr/bin/python
> +# See common.py for description of command-line arguments
> +
> +import os, sys, collections
> +
> +sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
> +import common as plib
> +
> +measurements = {}
> +measurements = collections.OrderedDict()
> +
> +regex_string = '^ -> (.*): TEST-(.*)$'
> +matches = plib.parse_log(regex_string)
> +
> +if matches:
> +    for m in matches:
> +        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
> +
> +# split the output for each testcase
> +plib.split_output_per_testcase(regex_string, measurements)
> +
> +sys.exit(plib.process(measurements))
> diff --git a/engine/tests/Functional.ethtool/spec.json
> b/engine/tests/Functional.ethtool/spec.json
> new file mode 100644
> index 0000000..c16b2d5
> --- /dev/null
> +++ b/engine/tests/Functional.ethtool/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.ethtool",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
> diff --git a/engine/tests/Functional.ethtool/tests/ethtool_driver.sh
> b/engine/tests/Functional.ethtool/tests/ethtool_driver.sh
> new file mode 100644
> index 0000000..6f6d576
> --- /dev/null
> +++ b/engine/tests/Functional.ethtool/tests/ethtool_driver.sh
> @@ -0,0 +1,25 @@
> +#!/bin/sh
> +
> +#  In target, run command ethtool.
> +#  option: -i
> +
> +test="driver"
> +
> +ETHERNET_DEVICE_NAME="have no Ethernet device"
> +ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
> +
> +for line in $(cat driver_list)
> +do
> +    if ethtool $line | grep "baseT"
> +    then
> +        ETHERNET_DEVICE_NAME=$line
> +        break
> +    fi
> +done

Very nice!  Thanks for setting this up to autodetect the Ethernet device.

It would be good to check that ETHERNET_DEVICE_NAME got set, or fail
the test here.  You could do it with:
if echo $ETHERNET_DEVICE_NAME | grep "have no Ethernet device"
    echo " -> $test: TEST-FAIL"
    exit 1
fi

> +
> +if ethtool -i $ETHERNET_DEVICE_NAME | grep driver
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> diff --git a/engine/tests/Functional.ethtool/tests/ethtool_help.sh
> b/engine/tests/Functional.ethtool/tests/ethtool_help.sh
> new file mode 100644
> index 0000000..4554de3
> --- /dev/null
> +++ b/engine/tests/Functional.ethtool/tests/ethtool_help.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  In target, run command ethtool.
> +#  option: help
> +
> +test="help"
> +
> +if ethtool -h | grep Usage
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.ethtool/tests/ethtool_show.sh
> b/engine/tests/Functional.ethtool/tests/ethtool_show.sh
> new file mode 100644
> index 0000000..98abe40
> --- /dev/null
> +++ b/engine/tests/Functional.ethtool/tests/ethtool_show.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh
> +
> +#  In target, run command ethtool.
> +#  option: none
> +
> +test="show"
> +
> +ETHERNET_DEVICE_NAME="have no Ethernet device"
> +ifconfig | cut -d' ' -f1 | sed '/^$/d' > driver_list
> +
> +for line in $(cat driver_list)
> +do
> +    if ethtool $line | grep "baseT"
> +    then
> +        ETHERNET_DEVICE_NAME=$line
> +        break
> +    fi
> +done
> +
I would be nice to put this into a test-specific library.

> +
> +if ethtool $ETHERNET_DEVICE_NAME | grep "Settings for"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> --
> 1.8.3.1

Despite my list of possible improvements, I'm applying this as is
(well, I'm going to add some text to the commit body).
Please feel free to send a patch with the requested improvements,
if you can.

Thanks,
 -- Tim


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

* Re: [Fuego] [PATCH] Add test cases for command zabbix.
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command zabbix Wang Mingyu
@ 2018-09-25  2:00   ` Tim.Bird
  0 siblings, 0 replies; 13+ messages in thread
From: Tim.Bird @ 2018-09-25  2:00 UTC (permalink / raw)
  To: wangmy, fuego



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

The commit message body should rarely be empty.  Please put a synopsis
of test features here.

Also, a test.yaml file describing what 'zabbix' is would be nice.
I'm not familiar with it.

> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  engine/tests/Functional.zabbix/fuego_test.sh       | 18
> ++++++++++++++++++
>  engine/tests/Functional.zabbix/parser.py           | 22
> ++++++++++++++++++++++
>  engine/tests/Functional.zabbix/spec.json           |  7 +++++++
>  .../tests/Functional.zabbix/tests/zabbix_help.sh   | 13 +++++++++++++
>  .../tests/Functional.zabbix/tests/zabbix_print.sh  | 13 +++++++++++++
>  engine/tests/Functional.zabbix/zabbix_test.sh      |  4 ++++
>  6 files changed, 77 insertions(+)
>  create mode 100644 engine/tests/Functional.zabbix/fuego_test.sh
>  create mode 100644 engine/tests/Functional.zabbix/parser.py
>  create mode 100644 engine/tests/Functional.zabbix/spec.json
>  create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_help.sh
>  create mode 100644 engine/tests/Functional.zabbix/tests/zabbix_print.sh
>  create mode 100755 engine/tests/Functional.zabbix/zabbix_test.sh
> 
> diff --git a/engine/tests/Functional.zabbix/fuego_test.sh
> b/engine/tests/Functional.zabbix/fuego_test.sh
> new file mode 100644
> index 0000000..0a142bf
> --- /dev/null
> +++ b/engine/tests/Functional.zabbix/fuego_test.sh
> @@ -0,0 +1,18 @@
> +function test_pre_check {
> +    is_on_target_path zabbix_agentd PROGRAM_ZABBIX_AGENTD
> +    assert_define PROGRAM_ZABBIX_AGENTD "Missing 'zabbix_agentd'
> program on target board"
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/zabbix_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
> +}
> +
> +function test_run {
> +    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
> +    ./zabbix_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/engine/tests/Functional.zabbix/parser.py
> b/engine/tests/Functional.zabbix/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/engine/tests/Functional.zabbix/parser.py
> @@ -0,0 +1,22 @@
> +#!/usr/bin/python
> +# See common.py for description of command-line arguments
> +
> +import os, sys, collections
> +
> +sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
> +import common as plib
> +
> +measurements = {}
> +measurements = collections.OrderedDict()
> +
> +regex_string = '^ -> (.*): TEST-(.*)$'
> +matches = plib.parse_log(regex_string)
> +
> +if matches:
> +    for m in matches:
> +        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
> +
> +# split the output for each testcase
> +plib.split_output_per_testcase(regex_string, measurements)
> +
> +sys.exit(plib.process(measurements))
> diff --git a/engine/tests/Functional.zabbix/spec.json
> b/engine/tests/Functional.zabbix/spec.json
> new file mode 100644
> index 0000000..50ab91d
> --- /dev/null
> +++ b/engine/tests/Functional.zabbix/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.v10pkgs",'
This is incorrect.  Should be "Functional.zabbix".

> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
> diff --git a/engine/tests/Functional.zabbix/tests/zabbix_help.sh
> b/engine/tests/Functional.zabbix/tests/zabbix_help.sh
> new file mode 100644
> index 0000000..6d7bbd0
> --- /dev/null
> +++ b/engine/tests/Functional.zabbix/tests/zabbix_help.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  The testscript checks the command zabbix_agentd.
> +#  option: -h
> +
> +test="help"
> +
> +if zabbix_agentd -h | grep usage
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.zabbix/tests/zabbix_print.sh
> b/engine/tests/Functional.zabbix/tests/zabbix_print.sh
> new file mode 100644
> index 0000000..98760d4
> --- /dev/null
> +++ b/engine/tests/Functional.zabbix/tests/zabbix_print.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  The testscript checks the command zabbix_agentd.
> +#  option: -p
> +
> +test="print"
> +
> +if zabbix_agentd -p | grep localhost
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> diff --git a/engine/tests/Functional.zabbix/zabbix_test.sh
> b/engine/tests/Functional.zabbix/zabbix_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/engine/tests/Functional.zabbix/zabbix_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> --
> 1.8.3.1

These tests that only check the usage line and some trivial output
are not useful in the long run.  I guess they detect that the command is
present.  But the likelihood that this test will catch a bug is extremely
low.  Commands don't change their usage very often, and this is extremely
unlikely to catch anything of importance for the operation of the tool.

I've been letting these "stub" tests through, on the theory that it's good to have
a placeholder and the infrastructure for a test of a command, even if
I'm unfamiliar with it, because then it will be easier for someone to add
additional testcases for that command in the future.  However, if no
additional testcases are ever written, these tests are not very useful.
They are actually detrimental, because they provide a false sense that
the command has been tested thoroughly, which is not really true.

Please let me know if Fujitsu plans to enhance these simple tests with
additional testcases over time.

If so, please add at least one more testcase now, which tests some actual
functionality of zabbix_agentd.  And, please fix the other issues listed above.

For now, this is NOT applied.

Regards,
 -- Tim



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

* Re: [Fuego] [PATCH] Add test cases for command cryptsetup.
  2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command cryptsetup Wang Mingyu
@ 2018-10-12  0:03   ` Tim.Bird
  0 siblings, 0 replies; 13+ messages in thread
From: Tim.Bird @ 2018-10-12  0:03 UTC (permalink / raw)
  To: wangmy, fuego

Sorry to only get to this now.

Applied, but see comments inline below.


> -----Original Message-----
> From: Wang Mingyu
> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  .../tests/Functional.cryptsetup/cryptsetup_test.sh |  4 +++
>  engine/tests/Functional.cryptsetup/fuego_test.sh   | 18 ++++++++++++
>  engine/tests/Functional.cryptsetup/parser.py       | 22 +++++++++++++++
>  engine/tests/Functional.cryptsetup/spec.json       |  7 +++++
>  .../tests/cryptsetup_create.sh                     | 32 ++++++++++++++++++++++
>  .../Functional.cryptsetup/tests/cryptsetup_help.sh | 13 +++++++++
>  6 files changed, 96 insertions(+)
>  create mode 100755 engine/tests/Functional.cryptsetup/cryptsetup_test.sh
>  create mode 100644 engine/tests/Functional.cryptsetup/fuego_test.sh
>  create mode 100644 engine/tests/Functional.cryptsetup/parser.py
>  create mode 100644 engine/tests/Functional.cryptsetup/spec.json
>  create mode 100644
> engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh
>  create mode 100644
> engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh
> 
> diff --git a/engine/tests/Functional.cryptsetup/cryptsetup_test.sh
> b/engine/tests/Functional.cryptsetup/cryptsetup_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/engine/tests/Functional.cryptsetup/cryptsetup_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/engine/tests/Functional.cryptsetup/fuego_test.sh
> b/engine/tests/Functional.cryptsetup/fuego_test.sh
> new file mode 100644
> index 0000000..7354b01
> --- /dev/null
> +++ b/engine/tests/Functional.cryptsetup/fuego_test.sh
> @@ -0,0 +1,18 @@
> +function test_pre_check {
> +    is_on_target_path cryptsetup PROGRAM_CRYPTSETUP
> +    assert_define PROGRAM_CRYPTSETUP "Missing 'cryptsetup' program on
> target board"
> +}

You should check for 'expect' here also, as it is used in individual test cases.

> +
> +function test_deploy {
> +    put $TEST_HOME/cryptsetup_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
> +}
> +
> +function test_run {
> +    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
> +    ./cryptsetup_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/engine/tests/Functional.cryptsetup/parser.py
> b/engine/tests/Functional.cryptsetup/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/engine/tests/Functional.cryptsetup/parser.py
> @@ -0,0 +1,22 @@
> +#!/usr/bin/python
> +# See common.py for description of command-line arguments
> +
> +import os, sys, collections
> +
> +sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
> +import common as plib
> +
> +measurements = {}
> +measurements = collections.OrderedDict()
> +
> +regex_string = '^ -> (.*): TEST-(.*)$'
> +matches = plib.parse_log(regex_string)
> +
> +if matches:
> +    for m in matches:
> +        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
> +
> +# split the output for each testcase
> +plib.split_output_per_testcase(regex_string, measurements)
> +
> +sys.exit(plib.process(measurements))
> diff --git a/engine/tests/Functional.cryptsetup/spec.json
> b/engine/tests/Functional.cryptsetup/spec.json
> new file mode 100644
> index 0000000..ec65501
> --- /dev/null
> +++ b/engine/tests/Functional.cryptsetup/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.cryptsetup",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
> diff --git a/engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh
> b/engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh
> new file mode 100644
> index 0000000..98eb5d2
> --- /dev/null
> +++ b/engine/tests/Functional.cryptsetup/tests/cryptsetup_create.sh
> @@ -0,0 +1,32 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command cryptsetup
> +#  option: create
> +
> +test="create"
> +
> +modprobe loop
> +
> +dd if=/dev/zero of=/tmp/cryptloop bs=1k count=1000
> +losetup -f
> +losetup /dev/loop0 /tmp/cryptloop
> +
> +expect <<-EOF
> +spawn cryptsetup create loop_test /dev/loop0
> +expect {
> + -re "Enter passphrase:" {
> +           send "test\n"
> +           send_user " -> $test: create loop_test succeeded.\n"
> +          }
> + default { send_user " -> $test: TEST-FAIL\n" }  }
> +expect eof
> +EOF
> +
> +if ls /dev/mapper | grep loop_test
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +cryptsetup remove loop_test
> +losetup -d /dev/loop0
> diff --git a/engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh
> b/engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh
> new file mode 100644
> index 0000000..caa625d
> --- /dev/null
> +++ b/engine/tests/Functional.cryptsetup/tests/cryptsetup_help.sh
> @@ -0,0 +1,13 @@
> +#!/bin/sh
> +
> +#  The testscript checks the following options of the command cryptsetup
> +#  option: --help
> +
> +test="help"
> +
> +if cryptsetup --help | grep Usage
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> --
> 1.8.3.1

Applied - but it would be nice to get a patch on top of this
for checking for 'expect' in test_pre_check()
 -- Tim


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

* Re: [Fuego] [PATCH v2] Add test cases for commands of module-init-tools.
  2018-09-18 15:57 ` [Fuego] [PATCH v2] Add test cases for commands of module-init-tools Wang Mingyu
@ 2018-11-14 22:41   ` Tim.Bird
  0 siblings, 0 replies; 13+ messages in thread
From: Tim.Bird @ 2018-11-14 22:41 UTC (permalink / raw)
  To: wangmy, fuego

Sorry for the slow response.  See comments inline below.

> -----Original Message-----
> From: Wang Mingyu on Tuesday, September 18, 2018 8:58 AM

There should be some text in the commit body here.

> 
> Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
> ---
>  .../Functional.module-init-tools/fuego_test.sh     | 29 +++++++++++++++

Fuego test names should use underscores and not dashes.
Please change this to Functional.module_init_tools
See http://fuegotest.org/wiki/Fuego_naming_rules


>  .../module-init-tools_test.sh                      |  4 ++
>  .../tests/Functional.module-init-tools/parser.py   | 22 +++++++++++
>  .../tests/Functional.module-init-tools/spec.json   |  7 ++++
>  .../tests/module-init-tools_depmod.sh              | 29 +++++++++++++++
>  .../tests/module-init-tools_insmod.sh              | 40 ++++++++++++++++++++
>  .../tests/module-init-tools_lsmod.sh               | 39 ++++++++++++++++++++
>  .../tests/module-init-tools_modinfo.sh             | 18 +++++++++
>  .../tests/module-init-tools_modprobe.sh            | 35 ++++++++++++++++++
>  .../tests/module-init-tools_rmmod.sh               | 43
> ++++++++++++++++++++++
>  10 files changed, 266 insertions(+)
>  create mode 100644 engine/tests/Functional.module-init-
> tools/fuego_test.sh
>  create mode 100755 engine/tests/Functional.module-init-tools/module-init-
> tools_test.sh
>  create mode 100644 engine/tests/Functional.module-init-tools/parser.py
>  create mode 100644 engine/tests/Functional.module-init-tools/spec.json
>  create mode 100644 engine/tests/Functional.module-init-
> tools/tests/module-init-tools_depmod.sh
>  create mode 100644 engine/tests/Functional.module-init-
> tools/tests/module-init-tools_insmod.sh
>  create mode 100644 engine/tests/Functional.module-init-
> tools/tests/module-init-tools_lsmod.sh
>  create mode 100644 engine/tests/Functional.module-init-
> tools/tests/module-init-tools_modinfo.sh
>  create mode 100644 engine/tests/Functional.module-init-
> tools/tests/module-init-tools_modprobe.sh
>  create mode 100644 engine/tests/Functional.module-init-
> tools/tests/module-init-tools_rmmod.sh
> 
> diff --git a/engine/tests/Functional.module-init-tools/fuego_test.sh
> b/engine/tests/Functional.module-init-tools/fuego_test.sh
> new file mode 100644
> index 0000000..ac18334
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/fuego_test.sh
> @@ -0,0 +1,29 @@
> +function test_pre_check {
> +    is_on_target_path depmod PROGRAM_DEPMOD
> +    assert_define PROGRAM_DEPMOD "Missing 'depmod' program on target
> board"
> +    is_on_target_path insmod PROGRAM_INSMOD
> +    assert_define PROGRAM_INSMOD "Missing 'insmod' program on target
> board"
> +    is_on_target_path lsmod PROGRAM_LSMOD
> +    assert_define PROGRAM_LSMOD "Missing 'lsmod' program on target
> board"
> +    is_on_target_path rmmod PROGRAM_RMMOD
> +    assert_define PROGRAM_RMMOD "Missing 'rmmod' program on target
> board"
> +    is_on_target_path modinfo PROGRAM_MODINFO
> +    assert_define PROGRAM_MODINFO "Missing 'modinfo' program on
> target board"
> +    is_on_target_path modprobe PROGRAM_MODPROBE
> +    assert_define PROGRAM_MODPROBE "Missing 'modprobe' program on
> target board"
Please switch these to assert_has_program

Also, I think you need a NEED_ROOT=1 somewhere.
I believe many of these tests will not run without root privileges (depmod?)

> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/module-init-tools_test.sh
> $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put $FUEGO_CORE/engine/scripts/fuego_board_function_lib.sh
> $BOARD_TESTDIR/fuego.$TESTDIR
> +    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
> +}
> +
> +function test_run {
> +    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
> +    ./module-init-tools_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/engine/tests/Functional.module-init-tools/module-init-
> tools_test.sh b/engine/tests/Functional.module-init-tools/module-init-
> tools_test.sh
> new file mode 100755
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/module-init-tools_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/engine/tests/Functional.module-init-tools/parser.py
> b/engine/tests/Functional.module-init-tools/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/parser.py
> @@ -0,0 +1,22 @@
> +#!/usr/bin/python
> +# See common.py for description of command-line arguments
> +
> +import os, sys, collections
> +
> +sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
> +import common as plib
> +
> +measurements = {}
> +measurements = collections.OrderedDict()
> +
> +regex_string = '^ -> (.*): TEST-(.*)$'
> +matches = plib.parse_log(regex_string)
> +
> +if matches:
> +    for m in matches:
> +        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
> +
> +# split the output for each testcase
> +plib.split_output_per_testcase(regex_string, measurements)
> +
> +sys.exit(plib.process(measurements))
> diff --git a/engine/tests/Functional.module-init-tools/spec.json
> b/engine/tests/Functional.module-init-tools/spec.json
> new file mode 100644
> index 0000000..8e45a5d
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/spec.json
> @@ -0,0 +1,7 @@
> +{
> +    "testName": "Functional.module-init-tools",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> +
> diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_depmod.sh b/engine/tests/Functional.module-init-
> tools/tests/module-init-tools_depmod.sh
> new file mode 100644
> index 0000000..c80f0aa
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_depmod.sh
> @@ -0,0 +1,29 @@
> +#!/bin/sh
> +
> +#  In target, run command depmod.
> +#  option: none
> +
> +test="depmod"
> +
> +test_krnl_rel=$(uname -r)
> +
> +if [ -f /lib/modules/$test_krnl_rel/modules.dep ]
> +then
> +    mv /lib/modules/$test_krnl_rel/modules.dep
> /lib/modules/$test_krnl_rel/modules.dep_bak
> +fi
> +
> +depmod
> +
> +if ls -l /lib/modules/$test_krnl_rel/modules.dep
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +if [ -e /lib/modules/$test_krnl_rel/modules.dep_bak ]
> +then
> +    mv /lib/modules/$test_krnl_rel/modules.dep_bak
> /lib/modules/$test_krnl_rel/modules.dep
> +else
> +    rm /lib/modules/$test_krnl_rel/modules.de

Missing a 'p' at the end of this filename.

> +fi
> diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_insmod.sh b/engine/tests/Functional.module-init-tools/tests/module-
> init-tools_insmod.sh
> new file mode 100644
> index 0000000..443c088
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_insmod.sh
> @@ -0,0 +1,40 @@
> +#!/bin/sh
> +
> +#  In target, run command insmod.
> +#  option: none
> +
> +test="insmod"
> +
> +tst_mod_file="ko file of module"
> +tst_mod_flag=0
> +
> +if modinfo uvesafb

How was this chosen as the module to use?  I only have this module on
2 of my boards (both x86_64).

Is there another module that is more common?

It would be difficult, but maybe we should provide a stub module
ourselves: fuego_stub.ko, and build it and put it on the target.
 
> +then
> +    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
Please use 'head' instead of sed here, to get the first line of the
output.

> +else
> +    echo " -> module uvesafb is not exist."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi
> +
> +mkdir test_dir
> +cp $tst_mod_file test_dir/
> +
> +if lsmod | grep uvesafb
> +then
> +    tst_mod_flag=1
> +    rmmod $tst_mod_file
> +fi
> +
> +if insmod test_dir/*.ko
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +if [ $tst_mod_flag=0 ]
> +then
> +    rmmod $tst_mod_file
> +fi
> +rm -fr test_dir
> diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_lsmod.sh b/engine/tests/Functional.module-init-tools/tests/module-
> init-tools_lsmod.sh
> new file mode 100644
> index 0000000..77acb18
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_lsmod.sh
> @@ -0,0 +1,39 @@
> +#!/bin/sh
> +
> +#  In target, run command lsmod.
> +#  option: none
> +
> +test="lsmod"
> +
> +tst_mod_file="ko file of module"
> +
> +if modinfo uvesafb
> +then
> +    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
Please use head here instead of sed to get first line of output.

> +else
> +    echo " -> module uvesafb is not exist."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi
> +
> +if lsmod | grep uvesafb
> +then
> +    echo " -> $test: TEST-PASS"
> +    exit
> +fi
> +
> +mkdir test_dir
> +cp $tst_mod_file test_dir/
> +
> +insmod test_dir/*.ko
> +
> +if lsmod | grep uvesafb
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> +
> +rmmod $tst_mod_file
> +rm -fr test_dir
> +
> diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_modinfo.sh b/engine/tests/Functional.module-init-
> tools/tests/module-init-tools_modinfo.sh
> new file mode 100644
> index 0000000..4265887
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_modinfo.sh
> @@ -0,0 +1,18 @@
> +#!/bin/sh
> +
> +#  In target, run command modinfo.
> +#  option: none
> +
> +test="modinfo"
> +
> +tst_mod_file="ko file of module"
> +tst_mod_flag=0
> +
> +if modinfo uvesafb | grep "filename"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> module uvesafb is not exist."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi
> diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_modprobe.sh b/engine/tests/Functional.module-init-
> tools/tests/module-init-tools_modprobe.sh
> new file mode 100644
> index 0000000..13823f9
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_modprobe.sh
> @@ -0,0 +1,35 @@
> +#!/bin/sh
> +
> +#  In target, run command modprobe.
> +#  option: modprobe
> +
> +test="modprobe"
> +
> +tst_mod_file="ko file of module"
> +tst_mod_flag=0
> +test_krnl_rel=$(uname -r)
> +
> +if modinfo uvesafb
> +then
> +    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
> +else
> +    echo " -> module uvesafb is not exist."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi
> +
> +if modprobe -D uvesafb | grep "insmod $tst_mod_file"
> +then
> +    echo " -> $test: modprobe -D is succeeded."
> +else
> +    echo " -> $test: modprobe -D is failed."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi
> +
> +if cat /lib/modules/$test_krnl_rel/modules.dep | grep "uvesafb.ko"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi
> diff --git a/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_rmmod.sh b/engine/tests/Functional.module-init-tools/tests/module-
> init-tools_rmmod.sh
> new file mode 100644
> index 0000000..bdd2d30
> --- /dev/null
> +++ b/engine/tests/Functional.module-init-tools/tests/module-init-
> tools_rmmod.sh
> @@ -0,0 +1,43 @@
> +#!/bin/sh
> +
> +#  In target, run command rmmod.
> +#  option: none
> +
> +test="rmmod"
> +
> +tst_mod_file="ko file of module"
> +tst_mod_flag=0
> +
> +if modinfo uvesafb
> +then
> +    tst_mod_file=$(modinfo uvesafb | sed -n 1p | cut -d' ' -f8)
> +else
> +    echo " -> module uvesafb is not exist."
> +    echo " -> $test: TEST-FAIL"
> +    exit
> +fi
> +
> +mkdir test_dir
> +cp $tst_mod_file test_dir/
> +
> +if lsmod | grep uvesafb
> +then
> +    tst_mod_flag=1
> +fi
> +
> +insmod test_dir/*.ko
> +
> +rmmod $tst_mod_file
> +
> +if lsmod | grep uvesafb
> +then
> +    echo " -> $test: TEST-FAIL"
> +else
> +    echo " -> $test: TEST-PASS"
> +fi
> +
> +if [ $tst_mod_flag=1 ]
> +then
> +    insmod $tst_mod_file
> +fi
> +rm -fr test_dir
> --
> 1.8.3.1

Thanks for working on this.
Please address my comments and re-submit.

Thanks,
 -- Tim


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

end of thread, other threads:[~2018-11-14 22:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 15:57 [Fuego] [PATCH v2] Add test cases for command ethtool Wang Mingyu
2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command cryptsetup Wang Mingyu
2018-10-12  0:03   ` Tim.Bird
2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command ecryptfs-manager Wang Mingyu
2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command zabbix Wang Mingyu
2018-09-25  2:00   ` Tim.Bird
2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command dumpsexp Wang Mingyu
2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command keyctl Wang Mingyu
2018-09-18 15:57 ` [Fuego] [PATCH v2] Add test cases for commands of module-init-tools Wang Mingyu
2018-11-14 22:41   ` Tim.Bird
2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for command dhcpd Wang Mingyu
2018-09-18 15:57 ` [Fuego] [PATCH] Add test cases for commands of cross_compilation Wang Mingyu
2018-09-25  0:23 ` [Fuego] [PATCH v2] Add test cases for command ethtool 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.