Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,9 @@ install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/"
DESTINATION "lib"
)

# copy make tests to build
file(COPY test DESTINATION ${CMAKE_BINARY_DIR})


include(InstallRequiredSystemLibraries)
add_subdirectory(InstallRules)
3 changes: 3 additions & 0 deletions resources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ add_subdirectory(cmake_tests)
file(COPY fonts/helvet.fnt
DESTINATION "${CMAKE_BINARY_DIR}/lib"
)
file(COPY test_lib.rb
DESTINATION "${CMAKE_BINARY_DIR}/resources"
)
9 changes: 6 additions & 3 deletions resources/cmake_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
include(FindPerl)

set(resources_dir "${CMAKE_SOURCE_DIR}/resources")
set(rad_test_dir "${CMAKE_SOURCE_DIR}/test")

### CONFIGURE TESTS

configure_file(setup_paths.cmake.in setup_paths.cmake @ONLY)
# configure these files so that they will be in the binary
Expand All @@ -10,12 +13,13 @@ configure_file(setup_paths.cmake.in setup_paths.cmake @ONLY)
configure_file(test_setup.cmake test_setup.cmake COPYONLY)
configure_file(test_rtrace.cmake test_rtrace.cmake COPYONLY)
configure_file(test_rpict.cmake test_rpict.cmake COPYONLY)
configure_file(test_getinfo.cmake test_getinfo.cmake COPYONLY)
configure_file(test_pcond.cmake test_pcond.cmake COPYONLY)
configure_file(test_falsecolor.cmake test_falsecolor.cmake COPYONLY)
configure_file(test_DC.cmake test_DC.cmake COPYONLY)
configure_file(test_evalglare.cmake test_evalglare.cmake COPYONLY)

### ADD TESTS

add_test(test_setup ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/test_setup.cmake)

add_test(test_rtrace ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/test_rtrace.cmake)
Expand All @@ -30,8 +34,6 @@ set_tests_properties(test_rpict PROPERTIES
FAIL_REGULAR_EXPRESSION "failed"
)

add_test(test_getinfo ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/test_getinfo.cmake)

add_test(test_pcond ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/test_pcond.cmake)
set_tests_properties(test_pcond PROPERTIES
PASS_REGULAR_EXPRESSION "passed"
Expand All @@ -44,6 +46,7 @@ set_tests_properties(test_evalglare PROPERTIES
FAIL_REGULAR_EXPRESSION "failed"
)


if(PERL_FOUND)
add_test(test_falsecolor ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/test_falsecolor.cmake)
set_tests_properties(test_falsecolor PROPERTIES
Expand Down
2 changes: 2 additions & 0 deletions resources/cmake_tests/setup_paths.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ set(ENV{RAYPATH} "${rlibpath}")
set(test_output_dir "@CMAKE_BINARY_DIR@/testfiles")
set(CMAKE_EXECUTABLE_SUFFIX @CMAKE_EXECUTABLE_SUFFIX@)

set(ltn_test "@CMAKE_BINARY_DIR@/test")

message(STATUS "path: $ENV{PATH}")
message(STATUS "raypath: $ENV{RAYPATH}")
6 changes: 6 additions & 0 deletions resources/cmake_tests/test_dctimestep.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include(setup_paths.cmake)
execute_process(
WORKING_DIRECTORY ${test_output_dir}
COMMAND ./resources/cmake_tests/test_lib.rb test_dctimestep
RESULT_VARIABLE res
)
14 changes: 2 additions & 12 deletions resources/cmake_tests/test_getinfo.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
include(setup_paths.cmake)

execute_process(
COMMAND getinfo${CMAKE_EXECUTABLE_SUFFIX} ${resources_dir}/evalglare/testimage.hdr
OUTPUT_FILE test_output
WORKING_DIRECTORY ${test_output_dir}
COMMAND ./resources/cmake_tests/test_lib.rb test_getinfo
RESULT_VARIABLE res
)
if(NOT ${res} EQUAL 0)
message(FATAL_ERROR "Bad return value from getinfo, res = ${res}")
endif()

file(READ ${resources_dir}/evalglare/testimage.hdr test_output)
if(test_output MATCHES "RADIANCE")
message(STATUS "passed")
else()
message(STATUS "failed")
endif()
Loading