forked from ethereum/aleth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
78 lines (67 loc) · 2.85 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
file(GLOB_RECURSE sources "*.cpp" "*.h" "*.sol")
# search for test names and create ctest tests
set(excludeSuites jsonrpc \"customTestSuite\" BlockQueueSuite)
set(allSuites jsonrpc)
foreach(file ${sources})
file(STRINGS ${file} test_list_raw REGEX "BOOST_.*TEST_(SUITE|CASE|SUITE_END)")
set(TestSuite "DEFAULT")
set(TestSuitePath "")
foreach(test_raw ${test_list_raw})
string(REGEX REPLACE ".*TEST_(SUITE|CASE)\\(([^ ,\\)]*).*" "\\1 \\2" test ${test_raw})
#skip disabled
if (";${excludeSuites};" MATCHES ";${TestSuite};")
continue()
endif()
if(test MATCHES "^SUITE .*")
string(SUBSTRING ${test} 6 -1 TestSuite)
set(TestSuitePath "${TestSuitePath}/${TestSuite}")
if(FASTCTEST)
if (";${excludeSuites};" MATCHES ";${TestSuite};")
continue()
endif()
if (NOT ";${allSuites};" MATCHES ";${TestSuite};")
string(SUBSTRING ${TestSuitePath} 1 -1 TestSuitePathFixed)
list(APPEND allSuites ${TestSuite})
separate_arguments(TESTETH_ARGS)
set(TestEthArgs -t ${TestSuitePathFixed} -- ${TESTETH_ARGS})
add_test(NAME ${TestSuitePathFixed} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testeth ${TestEthArgs})
endif()
endif()
elseif(test MATCHES "^CASE .*")
if(NOT FASTCTEST)
if(NOT test MATCHES "^CASE &createRandom.*")
string(SUBSTRING ${test} 5 -1 TestCase)
string(SUBSTRING ${TestSuitePath} 1 -1 TestSuitePathFixed)
separate_arguments(TESTETH_ARGS)
set(TestEthArgs -t ${TestSuitePathFixed}/${TestCase} -- ${TESTETH_ARGS})
add_test(NAME ${TestSuitePathFixed}/${TestCase} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testeth ${TestEthArgs})
endif()
endif()
elseif (";${test_raw};" MATCHES "BOOST_AUTO_TEST_SUITE_END()")
#encountered SUITE_END block. remove one test suite from the suite path.
string(FIND ${TestSuitePath} "/" Position REVERSE)
string(SUBSTRING ${TestSuitePath} 0 ${Position} TestSuitePath)
endif()
endforeach(test_raw)
endforeach(file)
hunter_add_package(yaml-cpp)
find_package(yaml-cpp CONFIG REQUIRED)
add_executable(testeth ${sources})
target_include_directories(testeth PRIVATE ${UTILS_INCLUDE_DIR})
target_link_libraries(testeth PRIVATE ethereum ethashseal web3jsonrpc devcrypto devcore cryptopp-static yaml-cpp::yaml-cpp binaryen::binaryen)
enable_testing()
set(CTEST_OUTPUT_ON_FAILURE TRUE)
include(EthUtils)
eth_add_test(ClientBase
ARGS --eth_testfile=BlockTests/bcJS_API_Test --eth_threads=1
ARGS --eth_testfile=BlockTests/bcJS_API_Test --eth_threads=3
ARGS --eth_testfile=BlockTests/bcJS_API_Test --eth_threads=10
ARGS --eth_testfile=BlockTests/bcValidBlockTest --eth_threads=1
ARGS --eth_testfile=BlockTests/bcValidBlockTest --eth_threads=3
ARGS --eth_testfile=BlockTests/bcValidBlockTest --eth_threads=10
)
#Does not work
#eth_add_test(JsonRpc
# ARGS --eth_testfile=BlockTests/bcJS_API_Test
# ARGS --eth_testfile=BlockTests/bcValidBlockTest
#)