fixed tests not working with the normal 'make testall'

This commit is contained in:
Markus Makela
2014-09-16 20:02:28 +03:00
parent 81b83f1978
commit 8b1afbfe26
6 changed files with 219 additions and 159 deletions

View File

@ -2,4 +2,4 @@ add_executable(testlog testlog.c)
add_executable(testorder testorder.c)
target_link_libraries(testlog utils pthread log_manager)
target_link_libraries(testorder utils pthread log_manager)
add_test(NAME TestLogOrder COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/logorder.sh 500 0 500)
add_test(NAME TestLogOrder COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/logorder.sh ${CMAKE_CURRENT_BINARY_DIR}/test.log 500 0 500 ${CMAKE_CURRENT_BINARY_DIR})

View File

@ -1,25 +1,35 @@
#! /bin/bash
if [[ $# -lt 3 ]]
if [[ $# -lt 4 ]]
then
echo "Usage: logorder.sh <iterations> <frequency of flushes> <message size>"
echo "Usage: logorder.sh <iterations> <frequency of flushes> <message size> <log file>"
echo "To disable log flushing, use 0 for flush frequency"
exit
fi
rm *.log
#Create large messages
$PWD/testorder $1 $2 $3
if [ $# -eq 5 ]
then
TDIR=$5
else
TDIR=$PWD
fi
#Create large messages
$TDIR/testorder $1 $2 $3
TESTLOG=$4
MCOUNT=$1
BLOCKS=`cat skygw_err1.log |tr -s ' '|grep -o 'block:[[:digit:]]\+'|cut -d ':' -f 2`
MESSAGES=`cat skygw_err1.log |tr -s ' '|grep -o 'message|[[:digit:]]\+'|cut -d '|' -f 2`
BLOCKS=`cat $TDIR/skygw_err1.log |tr -s ' '|grep -o 'block:[[:digit:]]\+'|cut -d ':' -f 2`
MESSAGES=`cat $TDIR/skygw_err1.log |tr -s ' '|grep -o 'message|[[:digit:]]\+'|cut -d '|' -f 2`
prev=0
error=0
all_errors=0
for i in $BLOCKS
do
@ -27,16 +37,16 @@ do
then
error=1
all_errors=1
echo "block mismatch: $i was after $prev."
echo "block mismatch: $i was after $prev." >> $TESTLOG
fi
prev=$i
done
if [[ error -eq 0 ]]
then
echo "Block buffers were in order"
echo "Block buffers were in order" >> $TESTLOG
else
echo "Error: block buffers were written in the wrong order"
echo "Error: block buffers were written in the wrong order" >> $TESTLOG
fi
prev=0
@ -49,15 +59,20 @@ do
then
error=1
all_errors=1
echo "message mismatch: $i was after $prev."
echo "message mismatch: $i was after $prev." >> $TESTLOG
fi
prev=$i
done
if [[ error -eq 0 ]]
then
echo "Block buffer messages were in order"
echo "Block buffer messages were in order" >> $TESTLOG
else
echo "Error: block buffer messages were written in the wrong order"
echo "Error: block buffer messages were written in the wrong order" >> $TESTLOG
fi
if [ $# -eq 5 ]
then
cat $TESTLOG
exit $all_errors
fi
exit $all_errors