From 3bd20bde1e49ab664cc53262ec5ebb3e6323d3f6 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Tue, 21 Jul 2009 22:11:47 +0200 Subject: make tests separate reusable files + make the testing thing a bit better --- tests/lib/framework-runtime | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/lib/framework-runtime (limited to 'tests/lib/framework-runtime') diff --git a/tests/lib/framework-runtime b/tests/lib/framework-runtime new file mode 100644 index 0000000..c1b16fd --- /dev/null +++ b/tests/lib/framework-runtime @@ -0,0 +1,35 @@ +#!/bin/bash +lib="/usr/share/aif/tests/lib" +STATUS=0 + +# $1 name of test +# $2... other args +function aiftest () { + name=$1 + shift + if [ ! -f $lib/test-$name ] + then + echo "NO SUCH TEST: $lib/test-$1" >&2 + return 2 + else + $lib/test-$name "$@" + ret=$? + if [ $ret -eq 0 ] + then + "$NAME : OK" + else + "$NAME [ $ret ] : NOT OK" + fi + [ $ret -gt $STATUS ] && STATUS=$ret +} + +aiftest-done () { + if [ $STATUS -eq 0 ] + then + echo 'ALL TESTS ENDED SUCCESSFULLY' + exit 0 + else + echo 'ONE OR MORE TESTS FAILED!' >&2 + exit $STATUS + fi +} -- cgit v1.2.3-54-g00ecf