[Fuego] [PATCH] Add test case of command xterm.

Wang Mingyu wangmy at cn.fujitsu.com
Wed Nov 28 15:47:40 UTC 2018


The xterm program is a terminal emulator for the X Window System.
This test set is used to check whether the command can start properly and generate the process.

Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 engine/tests/Functional.xterm/fuego_test.sh     | 17 +++++++++++++++++
 engine/tests/Functional.xterm/parser.py         | 22 ++++++++++++++++++++++
 engine/tests/Functional.xterm/spec.json         |  7 +++++++
 engine/tests/Functional.xterm/tests/xterm_ps.sh | 24 ++++++++++++++++++++++++
 engine/tests/Functional.xterm/xterm_test.sh     |  4 ++++
 5 files changed, 74 insertions(+)
 create mode 100644 engine/tests/Functional.xterm/fuego_test.sh
 create mode 100644 engine/tests/Functional.xterm/parser.py
 create mode 100644 engine/tests/Functional.xterm/spec.json
 create mode 100644 engine/tests/Functional.xterm/tests/xterm_ps.sh
 create mode 100755 engine/tests/Functional.xterm/xterm_test.sh

diff --git a/engine/tests/Functional.xterm/fuego_test.sh b/engine/tests/Functional.xterm/fuego_test.sh
new file mode 100644
index 0000000..f3bfb67
--- /dev/null
+++ b/engine/tests/Functional.xterm/fuego_test.sh
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program xterm
+}
+
+function test_deploy {
+    put $TEST_HOME/xterm_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./xterm_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/engine/tests/Functional.xterm/parser.py b/engine/tests/Functional.xterm/parser.py
new file mode 100644
index 0000000..d85abd7
--- /dev/null
+++ b/engine/tests/Functional.xterm/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.xterm/spec.json b/engine/tests/Functional.xterm/spec.json
new file mode 100644
index 0000000..41c7f0c
--- /dev/null
+++ b/engine/tests/Functional.xterm/spec.json
@@ -0,0 +1,7 @@
+{
+    "testName": "Functional.xterm",
+    "specs": {
+        "default": {}
+    }
+}
+
diff --git a/engine/tests/Functional.xterm/tests/xterm_ps.sh b/engine/tests/Functional.xterm/tests/xterm_ps.sh
new file mode 100644
index 0000000..5e1da46
--- /dev/null
+++ b/engine/tests/Functional.xterm/tests/xterm_ps.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+#  In the target start xterm, and confirm the process condition by command ps.
+#  check the keyword "xterm"
+
+test="ps"
+
+export DISPLAY=:1.0
+Xvfb :1 -screen 0 1024x768x16 &
+
+sleep 5
+
+xterm &
+
+sleep 5
+
+if ps aux | grep "[x]term"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+killall xterm
+killall Xvfb
diff --git a/engine/tests/Functional.xterm/xterm_test.sh b/engine/tests/Functional.xterm/xterm_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/engine/tests/Functional.xterm/xterm_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
-- 
1.8.3.1





More information about the Fuego mailing list