summaryrefslogtreecommitdiff
path: root/tests/unittest.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittest.sh.in')
-rwxr-xr-xtests/unittest.sh.in36
1 files changed, 25 insertions, 11 deletions
diff --git a/tests/unittest.sh.in b/tests/unittest.sh.in
index 5b51de03..d97fe409 100755
--- a/tests/unittest.sh.in
+++ b/tests/unittest.sh.in
@@ -22,6 +22,8 @@
# Add configured path to ATF tools, atf-run and atf-report
PATH="@ATF_BIN@:${PATH}"
export PATH
+ATFRUN=`type atf-run 2>/dev/null | awk '{print $3}'`
+KYUA=`type kyua 2>/dev/null | awk '{print $3}'`
# colors if not outputting to a dumb terminal and stdout is a tty
if test "$TERM" != dumb && { test -t 1; } 2>/dev/null; then \
@@ -33,14 +35,14 @@ if test "$TERM" != dumb && { test -t 1; } 2>/dev/null; then \
# (output will be "" if its supported)
if [ -z "`echo -e`" ]
then
- dash_e="-e"
+ dash_e="-e"
fi
fi;
header="===================================================="
status=0
-if [ -n "@ATF_BIN@" -a -f Atffile ]
+if [ -n "@UNITTESTS@" -a -x "$ATFRUN" -a -f Atffile ]
then
# run the tests
echo "Running unit tests..."
@@ -50,9 +52,9 @@ then
# set color based on success/failure
if [ $status -eq 0 ]
then
- color=$green
+ color=$green
else
- color=$red
+ color=$red
fi
# spit out the test report
@@ -61,19 +63,31 @@ then
# result color.
cat atf.out | atf-report | while read line
do
- cnt=`echo $line | grep -c "Summary"`
- if [ $cnt -eq 1 ]
- then
- echo $dash_e $color$header
- fi
- echo $line;
+ cnt=`echo $line | grep -c "Summary"`
+ if [ $cnt -eq 1 ]
+ then
+ echo $dash_e $color$header
+ fi
+ echo $line;
done
echo $dash_e $header$noclr
# clean up unless there were test failures
if [ $status -eq 0 ]
then
- rm -f atf.out
+ rm -f atf.out
+ fi
+elif [ -n "@UNITTESTS@" -a -x "$KYUA" -a -f Kyuafile ]
+then
+ echo "Running unit tests..."
+ kyua --logfile kyua.log test
+ status=$?
+
+ kyua report
+
+ if [ $status -eq 0 ]
+ then
+ rm -f kyua.log
fi
fi
exit $status