Commit b2e17ab7 authored by Jan Möbius's avatar Jan Möbius

Added scripts for md5 testing of files after tests


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12889 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 3c695048
......@@ -45,6 +45,8 @@ elseif( WIN32 )
else()
SET( OPENFLIPPER_EXECUTABLE "${CMAKE_BINARY_DIR}/Build/bin/OpenFlipper" )
endif()
SET(OPENFLIPPER_TEST_FILES ${CMAKE_BINARY_DIR}/tests/globalTestFiles )
SET(OPENFLIPPER_TEST_RESULTS ${CMAKE_BINARY_DIR}/tests/testResults )
# ========================================================================
# Core Library Components (Except the Core application)
......
......@@ -13,6 +13,11 @@ SET (CTEST_DROP_SITE_CDASH FALSE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run_tests.sh
${CMAKE_BINARY_DIR}/tests/run_tests.sh COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/globalTestFiles/cube1.obj
${OPENFLIPPER_TEST_FILES}/cube1.obj COPYONLY)
make_directory(${OPENFLIPPER_TEST_RESULTS})
# ========================================================================
# ========================================================================
# Internal global tests start here
......
This diff is collapsed.
# some argument checking:
# test_cmd is the command to run with all its arguments
if( NOT test_cmd )
message( FATAL_ERROR "Variable test_cmd not defined" )
endif( NOT test_cmd )
# output_blessed contains the name of the "blessed" output file
if( NOT output_blessed )
message( FATAL_ERROR "Variable output_blessed not defined" )
endif( NOT output_blessed )
# output_test contains the name of the output file the test_cmd will produce
if( NOT output_test )
message( FATAL_ERROR "Variable output_test not defined" )
endif( NOT output_test )
# convert the space-separated string to a list
separate_arguments( test_args )
message( ${test_args} )
execute_process(
COMMAND ${test_cmd} ${test_args}
COMMAND ${CMAKE_COMMAND} -E compare_files ${output_blessed} ${output_test}
RESULT_VARIABLE test_not_successful
)
if( test_not_successful )
message( SEND_ERROR "${output_test} does not match ${output_blessed}!" )
endif( test_not_successful )
# some argument checking:
# test_cmd is the command to run with all its arguments
if( NOT test_cmd )
message( FATAL_ERROR "Variable test_cmd not defined" )
endif( NOT test_cmd )
# output_blessed contains the name of the "blessed" output file
if( NOT md5 )
message( FATAL_ERROR "Variable md5 not defined" )
endif( NOT md5 )
# output_test contains the name of the output file the test_cmd will produce
if( NOT output_test )
message( FATAL_ERROR "Variable output_test not defined" )
endif( NOT output_test )
# convert the space-separated string to a list
separate_arguments( test_args )
message( ${test_args} )
execute_process(
COMMAND ${test_cmd} ${test_args}
)
execute_process(
COMMAND ${CMAKE_COMMAND} -E md5sum ${output_test}
RESULT_VARIABLE test_not_successful
OUTPUT_VARIABLE result_md5
)
#split into its two parts
string(REPLACE " " ";" result_md5 ${result_md5})
#Get the sum
list(GET result_md5 0 result_md5)
if ( NOT result_md5 STREQUAL md5 )
message(STATUS "MD5 missmatch")
message(STATUS "${result_md5}")
message(STATUS "${md5}")
set( test_not_successful "TRUE" )
endif()
if( test_not_successful )
message( SEND_ERROR "${output_test} md5 is ${result_md5} but should be ${md5}!" )
endif( test_not_successful )
Markdown is supported
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