Commit a30fc96d authored by Jan Möbius's avatar Jan Möbius
Browse files

Switched to new qt based compare tool for all platforms

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13645 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0b9397c9
......@@ -11,9 +11,14 @@ endif( NOT output_test )
# output_test contains the info about the loaded file
if( NOT test_file_info )
message( FATAL_ERROR "Variable test_file_info= not defined" )
message( FATAL_ERROR "Variable test_file_info not defined" )
endif( NOT test_file_info )
if( NOT result_checker )
message( FATAL_ERROR "Variable result_checker not defined" )
endif( NOT result_checker )
# convert the space-separated string to a list
separate_arguments( test_args )
message( ${test_args} )
......@@ -35,62 +40,29 @@ if ( NOT ${PROCESSRESULT} EQUAL 0 )
endif()
# ===================================================
# Collect list of what should be tested
# Compare
# ===================================================
# Read the info file
file (STRINGS ${test_file_info} FILEINFO)
#Create a list of properties we want to test
foreach(loop ${FILEINFO})
string ( REGEX REPLACE "=.*$" "" TMP ${loop} )
list( APPEND CHECKS ${TMP})
endforeach()
# ===================================================
# Read the files
# ===================================================
if ( WIN32 )
set(result_checker "${result_checker}.exe")
# read the test output
file (READ ${output_test} TESTOUTPUT)
endif()
# read the test output
file (READ ${test_file_info} INFOFILE)
message( "Executing: ${result_checker} ${output_test} ${test_file_info} " )
# ===================================================
# Compare
# ===================================================
# Timeout after 2 minutes
execute_process(
COMMAND ${result_checker} ${output_test} ${test_file_info}
TIMEOUT 60
RESULT_VARIABLE PROCESSRESULT
)
# Now go through all checks:
foreach(loop ${CHECKS})
#Get value from results:
string (
REGEX REPLACE
"^.*${loop}=([^\n]*).*$" "\\1"
RESULT ${TESTOUTPUT}
)
# remove whitespace
string(STRIP ${RESULT} RESULT)
#Get value from Info:
string (
REGEX REPLACE
"^.*${loop}=([^\n]*).*$" "\\1"
EXPECTED ${INFOFILE}
)
# remove whitespace
string(STRIP ${EXPECTED} EXPECTED)
# Use Stringcompare here
if ( NOT ${EXPECTED} STREQUAL ${RESULT} )
message(WARNING "Mismatching values for ${loop}: EXPECTED ${EXPECTED} but got ${RESULT}!")
set(test_not_successful true)
endif()
endforeach()
if ( NOT ${PROCESSRESULT} EQUAL 0 )
message(SEND_ERROR "Compare Tool execution failed!")
set(test_not_successful TRUE)
endif()
if( test_not_successful )
message( SEND_ERROR "Test Failed! See messages above to see what went wrong!" )
......
......@@ -52,6 +52,7 @@ function( run_single_object_file_mesh_test FILEPLUGIN TEST_FILE TEST_SCRIPT )
-D test_args:string=${args}
-D output_test=${OUTPUT_TEST_DATA_FILE}
-D test_file_info=${TEST_FILE_INFO}
-D result_checker=${CMAKE_BINARY_DIR}/tests/compareTool
-P ${CMAKE_SOURCE_DIR}/tests/run_file_test.cmake
)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment