[Fuego] [PATCH v2] libtool: Add test cases for command libtool.

Wang Mingyu wangmy at cn.fujitsu.com
Fri Mar 15 13:55:33 UTC 2019


This test set uses libtool to show all configuration variables and output the help and version of libtool.

Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
 tests/Functional.libtool/fuego_test.sh            | 17 +++++++++++++++++
 tests/Functional.libtool/libtool_test.sh          |  4 ++++
 tests/Functional.libtool/parser.py                | 20 ++++++++++++++++++++
 tests/Functional.libtool/spec.json                |  6 ++++++
 tests/Functional.libtool/tests/libtool_config.sh  | 13 +++++++++++++
 tests/Functional.libtool/tests/libtool_help.sh    | 13 +++++++++++++
 tests/Functional.libtool/tests/libtool_version.sh | 13 +++++++++++++
 7 files changed, 86 insertions(+)
 create mode 100644 tests/Functional.libtool/fuego_test.sh
 create mode 100755 tests/Functional.libtool/libtool_test.sh
 create mode 100644 tests/Functional.libtool/parser.py
 create mode 100644 tests/Functional.libtool/spec.json
 create mode 100644 tests/Functional.libtool/tests/libtool_config.sh
 create mode 100644 tests/Functional.libtool/tests/libtool_help.sh
 create mode 100644 tests/Functional.libtool/tests/libtool_version.sh

diff --git a/tests/Functional.libtool/fuego_test.sh b/tests/Functional.libtool/fuego_test.sh
new file mode 100644
index 0000000..912ec65
--- /dev/null
+++ b/tests/Functional.libtool/fuego_test.sh
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program libtool
+}
+
+function test_deploy {
+    put $TEST_HOME/libtool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./libtool_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.libtool/libtool_test.sh b/tests/Functional.libtool/libtool_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.libtool/libtool_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
diff --git a/tests/Functional.libtool/parser.py b/tests/Functional.libtool/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.libtool/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.libtool/spec.json b/tests/Functional.libtool/spec.json
new file mode 100644
index 0000000..0a1557e
--- /dev/null
+++ b/tests/Functional.libtool/spec.json
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.libtool",
+    "specs": {
+        "default": {}
+    }
+}
diff --git a/tests/Functional.libtool/tests/libtool_config.sh b/tests/Functional.libtool/tests/libtool_config.sh
new file mode 100644
index 0000000..8011d38
--- /dev/null
+++ b/tests/Functional.libtool/tests/libtool_config.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command libtool.
+#  option: --config.
+
+test="config"
+
+if libtool --config | grep "version_type=linux"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/tests/Functional.libtool/tests/libtool_help.sh b/tests/Functional.libtool/tests/libtool_help.sh
new file mode 100644
index 0000000..8d2a034
--- /dev/null
+++ b/tests/Functional.libtool/tests/libtool_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command libtool.
+#  option: --help.
+
+test="help"
+
+if libtool --help | grep Usage
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
diff --git a/tests/Functional.libtool/tests/libtool_version.sh b/tests/Functional.libtool/tests/libtool_version.sh
new file mode 100644
index 0000000..1832aaf
--- /dev/null
+++ b/tests/Functional.libtool/tests/libtool_version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command libtool.
+#  option: --version.
+
+test="version"
+
+if libtool --version | grep libtool
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi;
-- 
1.8.3.1





More information about the Fuego mailing list