3 echo "Starting log unit tests (must be run as root and on a system with OSSEC installed)."
4 echo "(it will make sure the current rules aree working as they should)."
9 rm -f ./tmpres || exit "Unable to remove tmpres.";
10 cat $i | /var/ossec/bin/ossec-logtest 2>&1|grep -v ossec-testrule |grep -A 500 "Phase 1:" > ./tmpres
12 if [ ! -f $idir/res ]; then
13 echo "** Creating entry for $i - Not set yet."
14 cat ./tmpres > $idir/res
18 MD1=`md5sum ./tmpres | cut -d " " -f 1`
19 MD2=`md5sum $idir/res | cut -d " " -f 1`
21 if [ ! $MD1 = $MD2 ]; then
22 echo "**ERROR: Unit testing failed. Output for the test $i failed."
23 echo "== OLD OUTPUT: =="
25 echo "== NEW OUTPUT: =="
27 echo "** ERROR: Exiting."
35 echo "Log unit tests completed. Everything seems ok (nothing changed since last test regarding the outputs)."