]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4851. [port] Support using kyua as well as atf-run to run the unit
authorMark Andrews <marka@isc.org>
Mon, 1 Jan 2018 23:20:58 +0000 (10:20 +1100)
committerMark Andrews <marka@isc.org>
Mon, 1 Jan 2018 23:21:39 +0000 (10:21 +1100)
                        tests. [RT #46853]

(cherry picked from commit ccb5678066ea0055012352df5011ce2aa44e0eb0)

CHANGES
unit/unittest.sh.in

diff --git a/CHANGES b/CHANGES
index 2c7a43f29c9c60cb7129c3dd3cb9c2461e23979c..bedf243ac6933fa3e274020c685434a3739400aa 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4851.  [port]          Support using kyua as well as atf-run to run the unit
+                       tests. [RT #46853]
+
 4850.  [bug]           Named failed to restart with multiple added zones in
                        lmdb database. [RT #46889]
 
index 899e00ebf883a2a001a278886a3ce76005698f31..de304c641d976f17aea372a86d3e0b37d8e33cc2 100644 (file)
@@ -2,17 +2,19 @@
 
 PATH="@ATFBIN@:${PATH}"
 export PATH
+ATFRUN=`type atf-run 2>/dev/null | awk '{print $3}'`
+KYUA=`type kyua 2>/dev/null | awk '{print $3}'`
 
 status=0
-if [ -n "@ATFBIN@" -a -f Atffile ]
+if [ -n "@UNITTESTS@" -a -x "$ATFRUN" -a -f Atffile ]
 then
        echo "S:unit:`date`"
-        echo "T:unit:1:A"
+       echo "T:unit:1:A"
        echo "I: unit tests"
        atf-run > atf.out
        status=$?
 
-        # | cat is there to force non-fancy output
+       # | cat is there to force non-fancy output
        atf-report < atf.out | cat
 
        if [ $status -eq 0 ]
@@ -23,5 +25,23 @@ then
                echo R:FAIL
        fi
        echo "E:unit:`date`"
+elif [ -n "@UNITTESTS@" -a -x "$KYUA" -a -f Kyuafile ]
+then
+       echo "S:unit:`date`"
+       echo "T:unit:1:A"
+       echo "I: unit tests"
+       kyua --logfile kyua.log test
+       status=$?
+
+       kyua report
+
+       if [ $status -eq 0 ]
+       then
+               rm -f kyua.log
+               echo R:PASS
+       else
+               echo R:FAIL
+       fi
+       echo "E:unit:`date`"
 fi
 exit $status