summaryrefslogtreecommitdiff
path: root/libopeniscsiusr/tests/runtest.sh
diff options
context:
space:
mode:
Diffstat (limited to 'libopeniscsiusr/tests/runtest.sh')
-rwxr-xr-xlibopeniscsiusr/tests/runtest.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/libopeniscsiusr/tests/runtest.sh b/libopeniscsiusr/tests/runtest.sh
new file mode 100755
index 0000000..a4cedf2
--- /dev/null
+++ b/libopeniscsiusr/tests/runtest.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+if [ "CHK$TESTS" == "CHK" ];then
+ echo "# No test cases defined"
+ exit 1
+fi
+
+VALGRIND_ERR_RC=2
+VALGRIND_OPTS="--quiet --leak-check=full \
+ --show-reachable=no --show-possibly-lost=no \
+ --trace-children=yes --error-exitcode=$VALGRIND_ERR_RC"
+
+TEST_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+for TEST in $TESTS; do
+ echo
+ TEST=$(basename $TEST)
+ echo "## RUN '$TEST'"
+ valgrind $VALGRIND_OPTS $TEST_DIR/$TEST
+ rc=$?
+ if [ $rc -ne 0 ]; then
+ if [ $rc -eq $VALGRIND_ERR_RC ];then
+ echo
+ echo "### Found memory leak"
+ exit $rc
+ fi
+ exit $rc
+ fi
+ echo "## PASS '$TEST'"
+done
+
+echo
+echo "# All PASS"