more configuration options, README update and tests

This commit is contained in:
Markus Makela
2014-09-12 16:48:21 +03:00
parent ba9a31497e
commit 32b72ce474
11 changed files with 199 additions and 148 deletions

View File

@ -1,4 +1,8 @@
file(COPY ${ERRMSG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
add_executable(canonizer canonizer.c)
target_link_libraries(canonizer pthread query_classifier z dl ssl aio crypt crypto rt m ${EMBEDDED_LIB} fullcore)
add_test(NAME TestCanonicalQuery COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/canontest.sh testcanon.log input.sql output.sql expected.sql)
add_test(NAME TestCanonicalQuery COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/canontest.sh
$<TARGET_FILE:canonizer>
${CMAKE_CURRENT_SOURCE_DIR}/input.sql
${CMAKE_CURRENT_BINARY_DIR}/output.sql
${CMAKE_CURRENT_SOURCE_DIR}/expected.sql)

View File

@ -1,21 +1,23 @@
#! /bin/sh
if [[ $# -ne 4 ]]
if [[ $# -lt 4 ]]
then
echo "Usage: canontest.sh <logfile name> <input file> <output file> <expected output>"
echo "Usage: canontest.sh <path to executable> <input file> <output file> <expected output>"
exit 0
fi
TESTLOG=$1
EXECUTABLE=$1
INPUT=$2
OUTPUT=$3
EXPECTED=$4
DIFFLOG=diff.out
$PWD/canonizer $INPUT $OUTPUT
$EXECUTABLE $INPUT $OUTPUT
diff $OUTPUT $EXPECTED > $DIFFLOG
if [ $? -eq 0 ]
then
echo "PASSED" >> $TESTLOG
echo "PASSED"
else
echo "FAILED" >> $TESTLOG
echo "Diff output: " >> $TESTLOG
cat $DIFFLOG >> $TESTLOG
echo "FAILED"
echo "Diff output: "
cat $DIFFLOG
exit 1;
fi
exit 0;