From cb616c6d5c2ece1fac37fa6e0bca2b53d4043098 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 2 Jan 2018 10:20:58 +1100 Subject: [PATCH] 4851. [port] Support using kyua as well as atf-run to run the unit tests. [RT #46853] (cherry picked from commit ccb5678066ea0055012352df5011ce2aa44e0eb0) --- unit/unittest.sh.in | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/unit/unittest.sh.in b/unit/unittest.sh.in index 899e00e..de304c6 100644 --- a/unit/unittest.sh.in +++ b/unit/unittest.sh.in @@ -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 -- 2.9.5