[Fuego] [PATCH 3/4] scifab: re-write this sci test
Qiu Tingting
qiutt at cn.fujitsu.com
Mon Sep 17 08:23:32 UTC 2018
Use a similar mechanism to re-write this sci test, like Functional.arch_timer.
And there are some modify of generalizing this sci test.
Signed-off-by: Qiu Tingting <qiutt at cn.fujitsu.com>
---
engine/tests/Functional.scifab/check_scifab.sh | 71 ++++++++++++++++++++++++++
engine/tests/Functional.scifab/fuego_test.sh | 28 +++++-----
2 files changed, 87 insertions(+), 12 deletions(-)
create mode 100755 engine/tests/Functional.scifab/check_scifab.sh
diff --git a/engine/tests/Functional.scifab/check_scifab.sh b/engine/tests/Functional.scifab/check_scifab.sh
new file mode 100755
index 0000000..2631e9c
--- /dev/null
+++ b/engine/tests/Functional.scifab/check_scifab.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+# PDX-License-Identifier: MIT
+#
+# check_scifab.sh - checks for the presence of sci information
+# in dmesg and /proc/interrupts
+#
+# Usage: check_scifab.sh <dev_name> [<pattern> <count>]
+#
+# Output is in TAP13 format
+#
+# Author: Qiu Tingting <Qiutt (at) cn.fujitsu.com>
+#
+
+usage() {
+ cat <<HERE
+Usage: check_scifab.sh [-h] <dev_name> [<pattern> <count>]
+
+Arguments:
+ -h = show this usage help
+
+dev_name is the partial name of the interrupt in /proc/interrupts(eg:""sci\|serial")
+pattern is the search pattern used for matching the initialization information of sci in dmesg output(eg:".*ttySC.*")
+count is the matching count of pattern
+HERE
+ exit 0
+}
+
+# parse arguments
+IRQ_NAME="$1"
+
+if [ -z "$IRQ_NAME" -o "$IRQ_NAME" = "-h" ] ; then
+ usage
+fi
+
+echo "TAP version 13"
+
+echo "Test for sci attributes"
+echo "IRQ_NAME=\"$IRQ_NAME\""
+
+tap_id=1
+desc="${tap_id} Check interrupt name in proc filesystem"
+#search partial name of sci in /proc/interrupts
+if grep "$IRQ_NAME" /proc/interrupts ; then
+ echo "ok ${desc}"
+else
+ echo "not ok ${desc}"
+ echo " Did not find $IRQ_NAME in /proc/interrupts"
+fi
+
+SEARCH_PATTERN="$2"
+SEARCH_COUNT="$3"
+
+echo "SEARCH_PATTERN=\"$SEARCH_PATTERN\""
+echo "SEARCH_COUNT=\"$SEARCH_COUNT\""
+
+if [ -n "$SEARCH_PATTERN" -a -n "$SEARCH_COUNT" ] ; then
+ tap_id=$(( $tap_id + 1 ))
+ desc="${tap_id} Check sci initialization string in dmesg"
+ #calculate the sci initialization string count in dmesg output
+ matching_count=`dmesg | grep "$SEARCH_PATTERN" | wc -l`
+ if [ $matching_count -eq $SEARCH_COUNT ] ; then
+ echo "ok ${desc}"
+ else
+ echo "not ok ${desc}"
+ echo " the matching count for '$SEARCH_PATTERN' is not as expected,expected count is '$SEARCH_COUNT',reality is '$matching_count'"
+ fi
+else
+ echo "Pattern or count is not defined. This case is skipped."
+fi
+
+echo "1..$tap_id"
diff --git a/engine/tests/Functional.scifab/fuego_test.sh b/engine/tests/Functional.scifab/fuego_test.sh
index 418e947..bc8e28f 100755
--- a/engine/tests/Functional.scifab/fuego_test.sh
+++ b/engine/tests/Functional.scifab/fuego_test.sh
@@ -1,21 +1,25 @@
-tarball=dung-3.4.25-m2.tar.gz
+#
+# user must define in the board file:
+# SCIFAB_NAME = the partial name in /proc/interrupts for the sci(serial communication interface) interrupt
+# Optionally, the user MAY define in the board file:
+# SCIFAB_PATTERN = a search pattern used for matching initialization information of the sci in dmesg output
+# SCIFAB_COUNT = the matching count of SCIFAB_PATTERN in dmesg
+#
+
+function test_pre_check {
+ assert_define SCIFAB_NAME "Please define in board file as partial name of sci interrupt"
+
+}
function test_deploy {
- put ./* $OSV_HOME/osv.$TESTDIR/
+ put $TEST_HOME/check_scifab.sh $BOARD_TESTDIR/fuego.$TESTDIR/
}
function test_run {
- report "cd $OSV_HOME/osv.$TESTDIR/scifab; ./dmesg-sh-sci.0.sh; ./proc-interrupts.sh"
+ report "$BOARD_TESTDIR/fuego.$TESTDIR/check_scifab.sh \
+ \"$SCIFAB_NAME\" \"$SCIFAB_PATTERN\" \"$SCIFAB_COUNT\""
}
function test_processing {
- assert_define FUNCTIONAL_SCIFAB_RES_LINES_COUNT
- assert_define FUNCTIONAL_SCIFAB_RES_PASS_COUNT
- assert_define FUNCTIONAL_SCIFAB_RES_FAIL_COUNT
-
- check_capability "RENESAS"
-
- log_compare "$TESTDIR" $FUNCTIONAL_SCIFAB_RES_LINES_COUNT "Passed:$FUNCTIONAL_SCIFAB_RES_PASS_COUNT Failed:$FUNCTIONAL_SCIFAB_RES_FAIL_COUNT" "p"
+ log_compare "$TESTDIR" 0 "^not ok" "n"
}
-
-
--
2.7.4
More information about the Fuego
mailing list