Added tests to cmake

This commit is contained in:
Markus Makela
2014-09-25 10:14:42 +03:00
parent 1cf3fa367c
commit 25850c056f
8 changed files with 233 additions and 67 deletions

View File

@ -1,3 +1,20 @@
if(${ERRMSG} MATCHES "NOTFOUND")
message(FATAL_ERROR "The errmsg.sys file was not found, please define the path with -DERRMSG=<path>")
else()
file(COPY ${ERRMSG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
add_subdirectory(canonical_tests)
add_executable(classify classify.c)
target_link_libraries(classify fullcore)
target_link_libraries(classify query_classifier fullcore)
add_test(NAME TestQueryClassifier
COMMAND /bin/sh -c "${CMAKE_CURRENT_BINARY_DIR}/classify < ${CMAKE_CURRENT_SOURCE_DIR}/input.sql > ${CMAKE_CURRENT_BINARY_DIR}/output.sql &&
diff ${CMAKE_CURRENT_BINARY_DIR}/output.sql ${CMAKE_CURRENT_SOURCE_DIR}/expected.sql;
if [[ $? -eq 1 ]];
then
echo \"TEST FAILED\";
exit 1;
else
echo\"TEST PASSED\";
exit 0;
fi")