CMakeLists.txt 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. aux_source_directory(. SRC_LIST)
  2. macro (add_sources)
  3. foreach (_src ${ARGN})
  4. file (RELATIVE_PATH _relPath "${CMAKE_CURRENT_SOURCE_DIR}/.." "${CMAKE_CURRENT_LIST_DIR}")
  5. list (APPEND SRC "./${_relPath}/${_src}")
  6. set(SRC ${SRC} PARENT_SCOPE)
  7. endforeach()
  8. endmacro()
  9. add_subdirectory(fuzzTesting)
  10. add_subdirectory(libethcore)
  11. add_subdirectory(libethereum)
  12. if (NOT EMSCRIPTEN)
  13. add_subdirectory(libtestutils)
  14. endif()
  15. add_subdirectory(libweb3core)
  16. add_subdirectory(libdevcrypto)
  17. add_subdirectory(libp2p)
  18. add_subdirectory(libdevcore)
  19. add_subdirectory(libweb3jsonrpc)
  20. add_subdirectory(libwhisper)
  21. add_subdirectory(libevm)
  22. add_subdirectory(external-dependencies)
  23. set(SRC_LIST ${SRC_LIST} ${SRC})
  24. # search for test names and create ctest tests
  25. enable_testing()
  26. foreach(file ${SRC_LIST})
  27. file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/${file} test_list_raw REGEX "BOOST_.*TEST_(SUITE|CASE)")
  28. set(TestSuite "DEFAULT")
  29. foreach(test_raw ${test_list_raw})
  30. string(REGEX REPLACE ".*TEST_(SUITE|CASE)\\(([^ ,\\)]*).*" "\\1 \\2" test ${test_raw})
  31. if(test MATCHES "^SUITE .*")
  32. string(SUBSTRING ${test} 6 -1 TestSuite)
  33. elseif(test MATCHES "^CASE .*")
  34. string(SUBSTRING ${test} 5 -1 TestCase)
  35. add_test(NAME ${TestSuite}/${TestCase} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/test COMMAND testeth -t ${TestSuite}/${TestCase})
  36. endif(test MATCHES "^SUITE .*")
  37. endforeach(test_raw)
  38. endforeach(file)
  39. file(GLOB HEADERS "*.h")
  40. add_executable(testeth ${SRC_LIST} ${HEADERS})
  41. find_package(Boost QUIET REQUIRED COMPONENTS unit_test_framework)
  42. find_package(Eth)
  43. find_package(Web3)
  44. target_include_directories(testeth PRIVATE ..)
  45. target_include_directories(testeth PRIVATE ../..)
  46. target_include_directories(testeth PRIVATE ../utils)
  47. target_link_libraries(testeth ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
  48. target_link_libraries(testeth ${Eth_TESTUTILS_LIBRARIES})
  49. if (MSVC)
  50. find_package(Boost QUIET REQUIRED COMPONENTS chrono date_time)
  51. target_link_libraries(testeth ${Boost_CHRONO_LIBRARIES})
  52. target_link_libraries(testeth ${Boost_DATE_TIME_LIBRARIES})
  53. endif()
  54. if (UNIX AND NOT APPLE)
  55. target_link_libraries(testeth pthread)
  56. endif()
  57. target_link_libraries(testeth ${Web3_WEB3JSONRPC_LIBRARIES})
  58. target_link_libraries(testeth ${Web3_WEBTHREE_LIBRARIES})
  59. enable_testing()
  60. set(CTEST_OUTPUT_ON_FAILURE TRUE)
  61. include(EthUtils)
  62. eth_add_test(ClientBase
  63. ARGS --eth_testfile=BlockTests/bcJS_API_Test --eth_threads=1
  64. ARGS --eth_testfile=BlockTests/bcJS_API_Test --eth_threads=3
  65. ARGS --eth_testfile=BlockTests/bcJS_API_Test --eth_threads=10
  66. ARGS --eth_testfile=BlockTests/bcValidBlockTest --eth_threads=1
  67. ARGS --eth_testfile=BlockTests/bcValidBlockTest --eth_threads=3
  68. ARGS --eth_testfile=BlockTests/bcValidBlockTest --eth_threads=10
  69. )
  70. eth_add_test(JsonRpc
  71. ARGS --eth_testfile=BlockTests/bcJS_API_Test
  72. ARGS --eth_testfile=BlockTests/bcValidBlockTest
  73. )