[Fuego] [PATCH] edac-util: Add test cases of command edac-util.

Yuan Chao yuanc.fnst at cn.fujitsu.com
Wed Jun 12 00:55:57 UTC 2019


This is a simple test to check the option help/report/status of command edac-util.

Signed-off-by: Yuan Chao <yuanc.fnst at cn.fujitsu.com>
---
 tests/Functional.edac-util/edac-util_test.sh         |  4 ++++
 tests/Functional.edac-util/fuego_test.sh             | 17 +++++++++++++++++
 tests/Functional.edac-util/parser.py                 | 20 ++++++++++++++++++++
 tests/Functional.edac-util/spec.json                 |  6 ++++++
 tests/Functional.edac-util/test.yaml                 | 19 +++++++++++++++++++
 tests/Functional.edac-util/tests/edac-util_help.sh   | 16 ++++++++++++++++
 tests/Functional.edac-util/tests/edac-util_report.sh | 16 ++++++++++++++++
 tests/Functional.edac-util/tests/edac-util_status.sh | 16 ++++++++++++++++
 8 files changed, 114 insertions(+)
 create mode 100644 tests/Functional.edac-util/edac-util_test.sh
 create mode 100644 tests/Functional.edac-util/fuego_test.sh
 create mode 100644 tests/Functional.edac-util/parser.py
 create mode 100644 tests/Functional.edac-util/spec.json
 create mode 100644 tests/Functional.edac-util/test.yaml
 create mode 100644 tests/Functional.edac-util/tests/edac-util_help.sh
 create mode 100644 tests/Functional.edac-util/tests/edac-util_report.sh
 create mode 100644 tests/Functional.edac-util/tests/edac-util_status.sh

diff --git a/tests/Functional.edac-util/edac-util_test.sh b/tests/Functional.edac-util/edac-util_test.sh
new file mode 100644
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.edac-util/edac-util_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.edac-util/fuego_test.sh b/tests/Functional.edac-util/fuego_test.sh
new file mode 100644
index 0000000..1bde191
--- /dev/null
+++ b/tests/Functional.edac-util/fuego_test.sh
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program edac-util
+}
+
+function test_deploy {
+    put $TEST_HOME/edac-util_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./edac-util_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.edac-util/parser.py b/tests/Functional.edac-util/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.edac-util/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+    for m in matches:
+        measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.edac-util/spec.json b/tests/Functional.edac-util/spec.json
new file mode 100644
index 0000000..8dc919b
--- /dev/null
+++ b/tests/Functional.edac-util/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.edac-util",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.edac-util/test.yaml b/tests/Functional.edac-util/test.yaml
new file mode 100644
index 0000000..0395d92
--- /dev/null
+++ b/tests/Functional.edac-util/test.yaml
@@ -0,0 +1,19 @@
+fuego_package_version: 1
+name: Functional.edac-util
+description: |
+        Edac-util a tool for reporting EDAC (Error Detection and Correction) error.
+        This is a simple test to check the option help/report/status of command edac-util.
+license: BSD-3-Clause
+author: Yuan Chao <yuanc.fnst at cn.fujitsu.com>
+maintainer: Wang Mingyu <wangmy at cn.fujitsu.com>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['report']
+data_files:
+ - edac-util_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
diff --git a/tests/Functional.edac-util/tests/edac-util_help.sh b/tests/Functional.edac-util/tests/edac-util_help.sh
new file mode 100644
index 0000000..5c88602
--- /dev/null
+++ b/tests/Functional.edac-util/tests/edac-util_help.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command edac-util, and check if help option can execute.
+#  1) Option: -h
+
+test="edac-util"
+
+edac-util -h > help.txt 2>&1
+
+if cat help.txt | grep "[uU]sage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f help.txt
diff --git a/tests/Functional.edac-util/tests/edac-util_report.sh b/tests/Functional.edac-util/tests/edac-util_report.sh
new file mode 100644
index 0000000..e3b2180
--- /dev/null
+++ b/tests/Functional.edac-util/tests/edac-util_report.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command edac-util, and check if report option can execute.
+#  1) Option: -r
+
+test="edac-util"
+
+edac-util -r > report.txt 2>&1
+
+if cat report.txt | grep "edac-util"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f report.txt
diff --git a/tests/Functional.edac-util/tests/edac-util_status.sh b/tests/Functional.edac-util/tests/edac-util_status.sh
new file mode 100644
index 0000000..a91aece
--- /dev/null
+++ b/tests/Functional.edac-util/tests/edac-util_status.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+#  In target, run command edac-util, and check if status option can execute.
+#  1) Option: -s
+
+test="edac-util"
+
+edac-util -s > status.txt 2>&1
+
+if cat status.txt | grep "EDAC drivers loaded"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f status.txt
-- 
1.8.3.1





More information about the Fuego mailing list