2014-01-03 01:27:19 +00:00
|
|
|
cmake_policy(SET CMP0015 NEW)
|
|
|
|
|
|
|
|
aux_source_directory(. SRC_LIST)
|
2015-04-20 20:48:53 +00:00
|
|
|
|
2015-08-25 13:38:41 +00:00
|
|
|
get_filename_component(TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
|
|
|
|
|
2015-04-20 20:48:53 +00:00
|
|
|
macro (add_sources)
|
2015-08-25 13:38:41 +00:00
|
|
|
file (RELATIVE_PATH _relPath ${TESTS_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
2015-04-20 20:48:53 +00:00
|
|
|
foreach (_src ${ARGN})
|
|
|
|
if (_relPath)
|
|
|
|
list (APPEND SRC "${_relPath}/${_src}")
|
|
|
|
else()
|
|
|
|
list (APPEND SRC "${_src}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if (_relPath)
|
|
|
|
# propagate SRCS to parent directory
|
|
|
|
set (SRC ${SRC} PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
2015-08-19 22:55:41 +00:00
|
|
|
add_subdirectory(contracts)
|
|
|
|
add_subdirectory(libsolidity)
|
2015-04-20 20:48:53 +00:00
|
|
|
|
|
|
|
set(SRC_LIST ${SRC_LIST} ${SRC})
|
2014-01-07 21:51:19 +00:00
|
|
|
|
2015-03-27 12:11:24 +00:00
|
|
|
# search for test names and create ctest tests
|
2015-04-20 21:17:19 +00:00
|
|
|
enable_testing()
|
|
|
|
foreach(file ${SRC_LIST})
|
|
|
|
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/${file} test_list_raw REGEX "BOOST_.*TEST_(SUITE|CASE)")
|
|
|
|
set(TestSuite "DEFAULT")
|
|
|
|
foreach(test_raw ${test_list_raw})
|
|
|
|
string(REGEX REPLACE ".*TEST_(SUITE|CASE)\\(([^ ,\\)]*).*" "\\1 \\2" test ${test_raw})
|
|
|
|
if(test MATCHES "^SUITE .*")
|
|
|
|
string(SUBSTRING ${test} 6 -1 TestSuite)
|
|
|
|
elseif(test MATCHES "^CASE .*")
|
|
|
|
string(SUBSTRING ${test} 5 -1 TestCase)
|
2015-08-19 22:55:41 +00:00
|
|
|
add_test(NAME ${TestSuite}/${TestCase} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND test -t ${TestSuite}/${TestCase})
|
2015-04-20 21:17:19 +00:00
|
|
|
endif(test MATCHES "^SUITE .*")
|
|
|
|
endforeach(test_raw)
|
|
|
|
endforeach(file)
|
2014-01-03 01:27:19 +00:00
|
|
|
|
2016-06-02 14:39:17 +00:00
|
|
|
file(GLOB HEADERS "*.h" "*/*.h")
|
2015-08-24 13:51:52 +00:00
|
|
|
set(EXECUTABLE soltest)
|
2016-04-30 23:42:49 +00:00
|
|
|
eth_simple_add_executable(${EXECUTABLE} ${SRC_LIST} ${HEADERS})
|
2015-04-30 11:27:55 +00:00
|
|
|
|
2016-04-06 18:55:46 +00:00
|
|
|
eth_use(${EXECUTABLE} REQUIRED Solidity::solidity Eth::ethereum Eth::ethcore)
|
2015-08-24 13:51:52 +00:00
|
|
|
|
|
|
|
include_directories(BEFORE ..)
|
|
|
|
target_link_libraries(${EXECUTABLE} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
2014-01-03 01:27:19 +00:00
|
|
|
|
2015-03-25 09:59:46 +00:00
|
|
|
enable_testing()
|
|
|
|
set(CTEST_OUTPUT_ON_FAILURE TRUE)
|