]> rtime.felk.cvut.cz Git - can-benchmark.git/commitdiff
Add "Testing" headers
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 5 Feb 2014 16:57:27 +0000 (17:57 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 5 Feb 2014 16:57:27 +0000 (17:57 +0100)
continuous/steps/40-run-tests
continuous/tests/kernelgw
continuous/tests/lib.sh [new file with mode: 0644]
continuous/tests/ugw-mmap-mmap
continuous/tests/ugw-mmsg-mmsg
continuous/tests/ugw-read-write
continuous/tests/ugw-readnb-write
continuous/tests/wvtest.sh [new file with mode: 0644]

index 413e89a5716f27cbfdc400e8ac69376b2a71025f..16a6826a1e8fedfa87317e582cc4a89bb83f9f33 100755 (executable)
@@ -4,4 +4,5 @@ set -e
 
 export LINUX_IMAGE=$PWD/linux/arch/powerpc/boot/uImage
 
-run-parts -v ../tests
+cd ../tests
+run-parts -v .
index 2bd5594990ae0446d8978eecf1060672cd8b1375..6a023e42b7286d2d5aaed6d49b2a4fd7bde618f3 100755 (executable)
@@ -1,4 +1,8 @@
-#!/bin/sh
+#!/bin/bash
+
+. lib.sh
+
+WVSTART Kernel gateway
 
 ../gw-setup/run.pl <<EOF
 cangw -A -s can0 -d can1
diff --git a/continuous/tests/lib.sh b/continuous/tests/lib.sh
new file mode 100644 (file)
index 0000000..95c027c
--- /dev/null
@@ -0,0 +1,6 @@
+if [ -z "$BASH_VERSION" ]; then
+    echo >&2 "Please use bash"
+    exit 1
+fi
+
+. wvtest.sh
index 015d134511eaeaa420055804b1a54268651f6e0c..a8d10304cf36234b03ae7adee23a401b1062b768 100755 (executable)
@@ -1,4 +1,8 @@
-#!/bin/sh
+#!/bin/bash
+
+. lib.sh
+
+WVSTART User space gateway (mmap-mmap)
 
 ../gw-setup/run.pl <<EOF
 ugw -r mmap -t mmap
index 79369b67a5b492071796ca4ac9fbf84c877399df..6b21499c2685e0c776a0e8418439a1b0b28ae469 100755 (executable)
@@ -1,4 +1,8 @@
-#!/bin/sh
+#!/bin/bash
+
+. lib.sh
+
+WVSTART User space gateway (recvmmsg-sendmmsg)
 
 ../gw-setup/run.pl <<EOF
 ugw -r mmsg -t mmsg
index 0ee11ca8d03215df8d8a7ef34f36626fe98335da..9529d54b51aef61706203c563e6d8d3ff6d52400 100755 (executable)
@@ -1,4 +1,8 @@
-#!/bin/sh
+#!/bin/bash
+
+. lib.sh
+
+WVSTART User space gateway (read-write)
 
 ../gw-setup/run.pl <<EOF
 ugw -r read -t write
index e3ec081d6ca8ee187bb77433e4e427f8df765418..ce8c22275f6bbd3d068b2c20fe36f4efd19ba15a 100755 (executable)
@@ -1,4 +1,8 @@
-#!/bin/sh
+#!/bin/bash
+
+. lib.sh
+
+WVSTART User space gateway (non-blocking read-write)
 
 ../gw-setup/run.pl <<EOF
 ugw -r read -t write -n
diff --git a/continuous/tests/wvtest.sh b/continuous/tests/wvtest.sh
new file mode 100644 (file)
index 0000000..47b4366
--- /dev/null
@@ -0,0 +1,140 @@
+#
+# WvTest:
+#   Copyright (C)2007-2012 Versabanq Innovations Inc. and contributors.
+#       Licensed under the GNU Library General Public License, version 2.
+#       See the included file named LICENSE for license information.
+#       You can get wvtest from: http://github.com/apenwarr/wvtest
+#
+# Include this file in your shell script by using:
+#         #!/bin/sh
+#         . ./wvtest.sh
+#
+
+# we don't quote $TEXT in case it contains newlines; newlines
+# aren't allowed in test output.  However, we set -f so that
+# at least shell glob characters aren't processed.
+_wvtextclean()
+{
+       ( set -f; echo $* )
+}
+
+
+if [ -n "$BASH_VERSION" ]; then
+       _wvfind_caller()
+       {
+               LVL=$1
+               WVCALLER_FILE=${BASH_SOURCE[2]}
+               WVCALLER_LINE=${BASH_LINENO[1]}
+       }
+else
+       _wvfind_caller()
+       {
+               LVL=$1
+               WVCALLER_FILE="unknown"
+               WVCALLER_LINE=0
+       }
+fi
+
+
+_wvcheck()
+{
+       CODE="$1"
+       TEXT=$(_wvtextclean "$2")
+       OK=ok
+       if [ "$CODE" -ne 0 ]; then
+               OK=FAILED
+       fi
+       echo "! $WVCALLER_FILE:$WVCALLER_LINE  $TEXT  $OK" >&2
+       if [ "$CODE" -ne 0 ]; then
+               exit $CODE
+       else
+               return 0
+       fi
+}
+
+
+WVPASS()
+{
+       TEXT="$*"
+
+       _wvfind_caller
+       if "$@"; then
+               _wvcheck 0 "$TEXT"
+               return 0
+       else
+               _wvcheck 1 "$TEXT"
+               # NOTREACHED
+               return 1
+       fi
+}
+
+
+WVFAIL()
+{
+       TEXT="$*"
+
+       _wvfind_caller
+       if "$@"; then
+               _wvcheck 1 "NOT($TEXT)"
+               # NOTREACHED
+               return 1
+       else
+               _wvcheck 0 "NOT($TEXT)"
+               return 0
+       fi
+}
+
+
+_wvgetrv()
+{
+       ( "$@" >&2 )
+       echo -n $?
+}
+
+
+WVPASSEQ()
+{
+       _wvfind_caller
+       _wvcheck $(_wvgetrv [ "$#" -eq 2 ]) "exactly 2 arguments"
+       echo "Comparing:" >&2
+       echo "$1" >&2
+       echo "--" >&2
+       echo "$2" >&2
+       _wvcheck $(_wvgetrv [ "$1" = "$2" ]) "'$1' = '$2'"
+}
+
+
+WVPASSNE()
+{
+       _wvfind_caller
+       _wvcheck $(_wvgetrv [ "$#" -eq 2 ]) "exactly 2 arguments"
+       echo "Comparing:" >&2
+       echo "$1" >&2
+       echo "--" >&2
+       echo "$2" >&2
+       _wvcheck $(_wvgetrv [ "$1" != "$2" ]) "'$1' != '$2'"
+}
+
+
+WVPASSRC()
+{
+       RC=$?
+       _wvfind_caller
+       _wvcheck $(_wvgetrv [ $RC -eq 0 ]) "return code($RC) == 0"
+}
+
+
+WVFAILRC()
+{
+       RC=$?
+       _wvfind_caller
+       _wvcheck $(_wvgetrv [ $RC -ne 0 ]) "return code($RC) != 0"
+}
+
+
+WVSTART()
+{
+       echo >&2
+       _wvfind_caller
+       echo "Testing \"$*\" in $WVCALLER_FILE:" >&2
+}