All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH] lvm: Add test cases for lvm.
@ 2019-09-11  1:20 Wang Mingyu
  2019-09-11  1:20 ` [Fuego] [PATCH] net-snmp: Add test cases for Net-SNMP Wang Mingyu
  2019-09-30 21:46 ` [Fuego] [PATCH] lvm: Add test cases for lvm Tim.Bird
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Mingyu @ 2019-09-11  1:20 UTC (permalink / raw)
  To: fuego

Lvm provides the command-line tools for LVM2.
This test set is used to check built-in commands of lvm.

Signed-off-by: Wang Mingyu <wangmy@cn.fujitsu.com>
---
 tests/Functional.lvm/fuego_test.sh            | 18 ++++++++++
 tests/Functional.lvm/lvm_test.sh              |  4 +++
 tests/Functional.lvm/parser.py                | 22 ++++++++++++
 tests/Functional.lvm/spec.json                |  7 ++++
 tests/Functional.lvm/tests/lvm2-monitor_ps.sh | 34 +++++++++++++++++++
 tests/Functional.lvm/tests/lvm_dumpconfig.sh  | 13 +++++++
 tests/Functional.lvm/tests/lvm_formats.sh     | 13 +++++++
 tests/Functional.lvm/tests/lvm_help.sh        | 13 +++++++
 tests/Functional.lvm/tests/lvm_lvmdiskscan.sh | 13 +++++++
 tests/Functional.lvm/tests/lvm_segtypes.sh    | 13 +++++++
 tests/Functional.lvm/tests/lvm_version.sh     | 13 +++++++
 tests/Functional.lvm/tests/lvm_vgdisplay.sh   | 13 +++++++
 12 files changed, 176 insertions(+)
 create mode 100644 tests/Functional.lvm/fuego_test.sh
 create mode 100644 tests/Functional.lvm/lvm_test.sh
 create mode 100644 tests/Functional.lvm/parser.py
 create mode 100644 tests/Functional.lvm/spec.json
 create mode 100644 tests/Functional.lvm/tests/lvm2-monitor_ps.sh
 create mode 100644 tests/Functional.lvm/tests/lvm_dumpconfig.sh
 create mode 100644 tests/Functional.lvm/tests/lvm_formats.sh
 create mode 100644 tests/Functional.lvm/tests/lvm_help.sh
 create mode 100644 tests/Functional.lvm/tests/lvm_lvmdiskscan.sh
 create mode 100644 tests/Functional.lvm/tests/lvm_segtypes.sh
 create mode 100644 tests/Functional.lvm/tests/lvm_version.sh
 create mode 100644 tests/Functional.lvm/tests/lvm_vgdisplay.sh

diff --git a/tests/Functional.lvm/fuego_test.sh b/tests/Functional.lvm/fuego_test.sh
new file mode 100644
index 0000000..22cb514
--- /dev/null
+++ b/tests/Functional.lvm/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program lvm
+}
+
+function test_deploy {
+    put $TEST_HOME/lvm_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;\
+    ./lvm_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.lvm/lvm_test.sh b/tests/Functional.lvm/lvm_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.lvm/lvm_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.lvm/parser.py b/tests/Functional.lvm/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/tests/Functional.lvm/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/tests/Functional.lvm/spec.json b/tests/Functional.lvm/spec.json
new file mode 100644
index 0000000..62e1efd
--- /dev/null
+++ b/tests/Functional.lvm/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.lvm",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/tests/Functional.lvm/tests/lvm2-monitor_ps.sh b/tests/Functional.lvm/tests/lvm2-monitor_ps.sh
new file mode 100644
index 0000000..abee513
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm2-monitor_ps.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+#  In the target start lvm2-monitor, and confirm the process condition by command ps.
+
+test="ps"
+
+. ./fuego_board_function_lib.sh
+
+set_init_manager
+
+service_status=$(get_service_status lvm2-monitor)
+
+exec_service_on_target lvm2-monitor stop
+
+if exec_service_on_target lvm2-monitor start
+then
+    echo " -> start of lvm2-monitor succeeded."
+else
+    echo " -> start of lvm2-monitor failed."
+    echo " -> $test: TEST-FAIL"
+    exit
+fi
+
+if ps aux | grep "[/]usr/sbin/lvmetad"
+then
+    echo " -> get the pid of lvmetad."
+else
+    echo " -> can't get the pid of lvmetad."
+    echo " -> $test: TEST-FAIL"
+fi
+if [ "$service_status" = "inactive" ]
+then
+    exec_service_on_target lvm2-monitor stop
+fi
diff --git a/tests/Functional.lvm/tests/lvm_dumpconfig.sh b/tests/Functional.lvm/tests/lvm_dumpconfig.sh
new file mode 100644
index 0000000..45dc46e
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm_dumpconfig.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, display the configuration information.
+#  option: none
+
+test="dumpconfig"
+
+if lvm dumpconfig | grep "devices"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.lvm/tests/lvm_formats.sh b/tests/Functional.lvm/tests/lvm_formats.sh
new file mode 100644
index 0000000..993c761
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm_formats.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, display recognised metadata formats.
+#  option: none
+
+test="formats"
+
+if lvm formats | grep "lvm"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.lvm/tests/lvm_help.sh b/tests/Functional.lvm/tests/lvm_help.sh
new file mode 100644
index 0000000..dcfe566
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, display the help text.
+#  option: none
+
+test="help"
+
+if lvm help
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.lvm/tests/lvm_lvmdiskscan.sh b/tests/Functional.lvm/tests/lvm_lvmdiskscan.sh
new file mode 100644
index 0000000..a015dfa
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm_lvmdiskscan.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, scan for all devices visible to LVM2.
+#  option: none
+
+test="lvmdiskscan"
+
+if lvmdiskscan | grep "partitions"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.lvm/tests/lvm_segtypes.sh b/tests/Functional.lvm/tests/lvm_segtypes.sh
new file mode 100644
index 0000000..e30bcf2
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm_segtypes.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, display recognised Logical Volume segment types.
+#  option: none
+
+test="segtypes"
+
+if lvm segtypes
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.lvm/tests/lvm_version.sh b/tests/Functional.lvm/tests/lvm_version.sh
new file mode 100644
index 0000000..f52710d
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm_version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, display the version information.
+#  option: none
+
+test="version"
+
+if lvm version | grep "LVM version"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
diff --git a/tests/Functional.lvm/tests/lvm_vgdisplay.sh b/tests/Functional.lvm/tests/lvm_vgdisplay.sh
new file mode 100644
index 0000000..a72fd4d
--- /dev/null
+++ b/tests/Functional.lvm/tests/lvm_vgdisplay.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, display attributes of volume groups.
+#  option: none
+
+test="vgdisplay"
+
+if vgdisplay
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
-- 
2.17.1




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

end of thread, other threads:[~2019-09-30 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  1:20 [Fuego] [PATCH] lvm: Add test cases for lvm Wang Mingyu
2019-09-11  1:20 ` [Fuego] [PATCH] net-snmp: Add test cases for Net-SNMP Wang Mingyu
2019-09-30 22:20   ` Tim.Bird
2019-09-30 21:46 ` [Fuego] [PATCH] lvm: Add test cases for lvm 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.