aboutsummaryrefslogtreecommitdiff
path: root/tests/runsingletest.sh
diff options
context:
space:
mode:
authorTomas Junnonen <tomas.junnonen@nokia.com>2010-02-15 14:54:48 +0200
committerTomas Junnonen <tomas.junnonen@nokia.com>2010-02-15 14:54:48 +0200
commit0299123821c6c6367c23f59e135737f32b26c898 (patch)
tree48dcda1537576e0c646b4cfe823e83c2186a6a1e /tests/runsingletest.sh
Changes: First public release
RevBy: TrustMe
Diffstat (limited to 'tests/runsingletest.sh')
-rwxr-xr-xtests/runsingletest.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/runsingletest.sh b/tests/runsingletest.sh
new file mode 100755
index 00000000..6ecf7c88
--- /dev/null
+++ b/tests/runsingletest.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+# this is just small wrapper to automate the unit testcases
+
+
+
+function emptylog() {
+ FILENAME=$1
+ TESTCASE=$2
+
+ cat<<EOF > $FILENAME
+<?xml version="1.0"?>
+<testsuite name="${TESTCASE}" tests="3" failures="0" errors="1" time="0.0">
+ <properties>
+ <property name="QtVersion" value="4.4.0"/>
+ <property name="QTestVersion" value="4.4.0"/>
+ </properties>
+ <testcase classname="${TESTCASE}" name="initTestCase" time="0.0"/>
+ <testcase classname="${TESTCASE}" name="notAvailable" time="0.0">
+ <failure type="Standard" message="unittest crashed or exited with fatal error or is using QTEST_MAIN() "/>
+ </testcase>
+ <testcase classname="${TESTCASE}" name="cleanupTestCase" time="0.0"/>
+ <system-out>Current testsuite crashes or wasnt in shape to be executed in development environment and this error message is placeholder. Fix your tests!</system-out>
+ <system-err/>
+</testsuite>
+EOF
+
+}
+
+TEST=$1
+CURDIR=`pwd`
+DIRNAME=`dirname $TEST`
+BASENAME=`basename $TEST`
+QTESTLOG=./$BASENAME.log
+JUNITLOG=./$BASENAME.log.xml
+
+cd $DIRNAME
+LD_LIBRARY_PATH=../../lib ./$BASENAME -xml -o ./$BASENAME.log
+
+xsltproc --nonet ../qtestlib2junitxml.xsl $QTESTLOG > $JUNITLOG
+EXIT_CODE=$?
+case "$EXIT_CODE" in
+ "0")
+ echo success
+ ;;
+ *)
+ echo error: unittest $BASENAME failed with $EXIT_CODE errors
+ emptylog $JUNITLOG $BASENAME
+ ;;
+esac
+cd $CURDIR
+exit $EXIT_CODE