diff --git a/log_manager/test/CMakeLists.txt b/log_manager/test/CMakeLists.txt index d3a22939e..253f56f74 100644 --- a/log_manager/test/CMakeLists.txt +++ b/log_manager/test/CMakeLists.txt @@ -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}) \ No newline at end of file +add_test(NAME TestLogOrder COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/logorder.sh 200 0 1000 ${CMAKE_CURRENT_BINARY_DIR}/logorder.log) diff --git a/log_manager/test/logorder.sh b/log_manager/test/logorder.sh index 49ca43c83..ac7f273d4 100755 --- a/log_manager/test/logorder.sh +++ b/log_manager/test/logorder.sh @@ -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 diff --git a/query_classifier/test/CMakeLists.txt b/query_classifier/test/CMakeLists.txt index 3ed80e8a6..ab0154657 100644 --- a/query_classifier/test/CMakeLists.txt +++ b/query_classifier/test/CMakeLists.txt @@ -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=") 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) \ No newline at end of file +add_test(TestQueryClassifier classify ${CMAKE_CURRENT_SOURCE_DIR}/input.sql ${CMAKE_CURRENT_SOURCE_DIR}/expected.sql) diff --git a/query_classifier/test/classify.c b/query_classifier/test/classify.c index 5ceadea9c..83f55d899 100644 --- a/query_classifier/test/classify.c +++ b/query_classifier/test/classify.c @@ -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*/