diff options
author | Gav Wood <g@ethdev.com> | 2015-03-28 02:36:42 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-03-28 02:36:42 +0800 |
commit | c188e94273f9f9be27b4bfd67e44800f0504eb6a (patch) | |
tree | 7fdb8a5372a9c9078ffa5938fe67ceaa30e454ec /CMakeLists.txt | |
parent | 8ec03f1291b880c8b36c5b22dca39177a4d0da21 (diff) | |
parent | e82b8019ea7c44859a587caa640a76fed87acacb (diff) | |
download | dexon-solidity-c188e94273f9f9be27b4bfd67e44800f0504eb6a.tar.gz dexon-solidity-c188e94273f9f9be27b4bfd67e44800f0504eb6a.tar.zst dexon-solidity-c188e94273f9f9be27b4bfd67e44800f0504eb6a.zip |
Merge pull request #1441 from chriseth/ctest
Parse test files to automatically create ctest tests
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 66b95ada..01681dbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,21 @@ include_directories(${Boost_INCLUDE_DIRS}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) +# search for test names and create ctest tests +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) + add_test(NAME ${TestSuite}/${TestCase} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testeth -t ${TestSuite}/${TestCase}) + endif(test MATCHES "^SUITE .*") + endforeach(test_raw) +endforeach(file) file(GLOB HEADERS "*.h") add_executable(testeth ${SRC_LIST} ${HEADERS}) |