summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2017-12-30 17:49:14 +0100
committerFrancis Dupont <fdupont@isc.org>2017-12-30 17:49:14 +0100
commit6b87c7f213bea62a545169286acdd5d2b66ae082 (patch)
tree900e62085171c851f220f6e9d1928497b94d6f3d /tests
parente3318080eea68223bcbdb0beef6157a51cd7b180 (diff)
downloadisc-dhcp-6b87c7f213bea62a545169286acdd5d2b66ae082.tar.gz
checkpoint for regen
Diffstat (limited to 'tests')
-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