[apparmor] [PATCH 1/2] tests: Add an optional final check to checktestfg and checktestbg
Tyler Hicks
tyhicks at canonical.com
Thu Aug 1 09:01:38 UTC 2013
Allows for the test script to specify a final check to be performed
after checking the output of the test binary. This may be useful, for
example, if the test script wants to compare logging output of the test
binary to known-good logging output.
Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
---
I'm not real happy about this patch. It is definitely a shortcut to what I need
for the dbus tests, which is a way to compare two log files after the test
program status is checked and before the test is declared a failure or not. The
log comparison function itself may also decide if the test was a failure or
not.
That said, this isn't all that bad so I'm not sure if it is worth it to spend
more time on coming up with a cleaner solution.
tests/regression/apparmor/prologue.inc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/regression/apparmor/prologue.inc b/tests/regression/apparmor/prologue.inc
index 150ac1e..7068298 100755
--- a/tests/regression/apparmor/prologue.inc
+++ b/tests/regression/apparmor/prologue.inc
@@ -129,7 +129,7 @@ checktestbg()
then
echo "SIGNAL$(($rc - 128))" > $outfile
fi
- checktestfg
+ checktestfg "$@"
}
runtestfg()
@@ -207,6 +207,15 @@ checktestfg()
;;
esac
+ if [ $# -gt 0 ]
+ then
+ $1
+ if [ "$teststatus" != "pass" ]
+ then
+ return
+ fi
+ fi
+
if [ -n "$VERBOSE" ]; then
echo "ok: ${_testdesc}"
fi
--
1.8.3.2
More information about the AppArmor
mailing list