aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-03-27 20:11:24 +0800
committerchriseth <c@ethdev.com>2015-03-27 20:13:08 +0800
commite82b8019ea7c44859a587caa640a76fed87acacb (patch)
tree4d4bec2d109ce9c407fa365f262f8fc23e15f4f5 /CMakeLists.txt
parent708c55478c0df93995955bde989d26a25845b215 (diff)
downloaddexon-solidity-e82b8019ea7c44859a587caa640a76fed87acacb.tar.gz
dexon-solidity-e82b8019ea7c44859a587caa640a76fed87acacb.tar.zst
dexon-solidity-e82b8019ea7c44859a587caa640a76fed87acacb.zip
Parse test files and create ctest tests.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ef292c2b..47dc611a 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})