# 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 \
# (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..."
# 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
# 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