Small fixes to log_manager and query_classifier tests.

This commit is contained in:
Markus Makela 2015-01-30 08:22:20 +02:00
parent 618316d7e7
commit a9a9a6eae5
4 changed files with 20 additions and 10 deletions

View File

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

View File

@ -7,14 +7,13 @@ then
exit
fi
rm *.log
if [ $# -eq 5 ]
then
TDIR=$5
else
TDIR=$PWD
fi
rm $TDIR/*.log
#Create large messages
@ -71,8 +70,5 @@ else
echo "Error: block buffer messages were written in the wrong order" >> $TESTLOG
fi
if [ $# -eq 5 ]
then
cat $TESTLOG
exit $all_errors
fi
cat $TESTLOG
exit $all_errors

View File

@ -2,7 +2,7 @@ if(${ERRMSG} MATCHES "ERRMSG-NOTFOUND")
message(FATAL_ERROR "The errmsg.sys file was not found, please define the path with -DERRMSG=<path>")
else()
if(${CMAKE_VERSION} VERSION_LESS 2.8)
execute_process(COMMAND cp ${ERRMSG} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${ERRMSG} ${CMAKE_CURRENT_BINARY_DIR})
else()
file(COPY ${ERRMSG} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
@ -11,4 +11,4 @@ endif()
add_subdirectory(canonical_tests)
add_executable(classify classify.c)
target_link_libraries(classify query_classifier fullcore)
add_test(TestQueryClassifier classify ${CMAKE_CURRENT_SOURCE_DIR}/input.sql ${CMAKE_CURRENT_SOURCE_DIR}/expected.sql)
add_test(TestQueryClassifier classify ${CMAKE_CURRENT_SOURCE_DIR}/input.sql ${CMAKE_CURRENT_SOURCE_DIR}/expected.sql)

View File

@ -44,8 +44,22 @@ int main(int argc, char** argv)
}
input = fopen(argv[1],"rb");
if(input == NULL)
{
printf("Error: Failed to open input file %s", argv[1]);
return 1;
}
expected = fopen(argv[2],"rb");
if(expected == NULL)
{
fclose(input);
printf("Error: Failed to open expected output file %s", argv[2]);
return 1;
}
while((rd = fread(buffer,sizeof(char),1023,input))){
/**Fill the read buffer*/