diff --git a/libraries/testing/CMakeLists.txt b/libraries/testing/CMakeLists.txt index 0c71359ec44..b2bb8bb9158 100644 --- a/libraries/testing/CMakeLists.txt +++ b/libraries/testing/CMakeLists.txt @@ -1,5 +1,9 @@ file(GLOB HEADERS "include/eosio/testing/*.hpp") +configure_file(contracts.hpp.in include/testing_contracts/contracts.hpp ESCAPE_QUOTES) +add_library(eosio_testing_contracts INTERFACE) +target_include_directories(eosio_testing_contracts INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/include/testing_contracts) + ## SORT .cpp by most likely to change / break compile add_library( eosio_testing tester.cpp @@ -7,7 +11,7 @@ add_library( eosio_testing ${HEADERS} ) -target_link_libraries( eosio_testing eosio_chain fc chainbase Logging IR WAST WASM Runtime Boost::unit_test_framework ) +target_link_libraries( eosio_testing eosio_testing_contracts eosio_chain fc chainbase Logging IR WAST WASM Runtime ) target_include_directories( eosio_testing PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/../wasm-jit/Include" diff --git a/unittests/contracts.hpp.in b/libraries/testing/contracts.hpp.in similarity index 77% rename from unittests/contracts.hpp.in rename to libraries/testing/contracts.hpp.in index 274ce0a8d86..5856c91a8d3 100644 --- a/unittests/contracts.hpp.in +++ b/libraries/testing/contracts.hpp.in @@ -1,6 +1,9 @@ #pragma once -#include +#include + +#include +#include #define CORE_SYM_NAME "${CORE_SYMBOL_NAME}" #define CORE_SYM_PRECISION 4 @@ -18,9 +21,17 @@ struct core_sym { }; // CN -> contract C++ name, C -> contract name, D -> top level directory -#define MAKE_READ_WASM_ABI(CN,C, D) \ - static std::vector CN ## _wasm() { return read_wasm("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".wasm"); } \ - static std::vector CN ## _abi() { return read_abi("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".abi"); } +#define MAKE_READ_WASM_ABI(CN,C, D) \ + static std::vector CN ## _wasm() { \ + std::string s; \ + fc::read_file_contents("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".wasm", s); \ + return std::vector(s.begin(), s.end()); \ + } \ + static std::vector CN ## _abi() { \ + std::string s; \ + fc::read_file_contents("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".abi", s); \ + return std::vector(s.begin(), s.end()); \ + } namespace eosio { namespace testing { diff --git a/plugins/chain_plugin/test/test_account_query_db.cpp b/plugins/chain_plugin/test/test_account_query_db.cpp index 3ec746d840c..c8882d91a53 100644 --- a/plugins/chain_plugin/test/test_account_query_db.cpp +++ b/plugins/chain_plugin/test/test_account_query_db.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE account_query_db #include -#include +#include #include #include #include diff --git a/plugins/chain_plugin/test/test_blockvault_sync_strategy.cpp b/plugins/chain_plugin/test/test_blockvault_sync_strategy.cpp index a82fa14eddd..684b343b665 100644 --- a/plugins/chain_plugin/test/test_blockvault_sync_strategy.cpp +++ b/plugins/chain_plugin/test/test_blockvault_sync_strategy.cpp @@ -1,5 +1,5 @@ #define BOOST_TEST_MODULE blockvault_sync_strategy -#include +#include #include #include #include diff --git a/plugins/chain_plugin/test/test_chain_plugin.cpp b/plugins/chain_plugin/test/test_chain_plugin.cpp index 161baa63a06..fbcb8570170 100644 --- a/plugins/chain_plugin/test/test_chain_plugin.cpp +++ b/plugins/chain_plugin/test/test_chain_plugin.cpp @@ -1,6 +1,6 @@ #define BOOST_TEST_MODULE chain_plugin #include -#include +#include #include #include #include diff --git a/plugins/txn_test_gen_plugin/CMakeLists.txt b/plugins/txn_test_gen_plugin/CMakeLists.txt index 5d7ca913ba8..817eaa979df 100644 --- a/plugins/txn_test_gen_plugin/CMakeLists.txt +++ b/plugins/txn_test_gen_plugin/CMakeLists.txt @@ -3,7 +3,7 @@ add_library( txn_test_gen_plugin txn_test_gen_plugin.cpp ${HEADERS} ) -target_link_libraries( txn_test_gen_plugin appbase fc http_plugin chain_plugin eosio_testing ) +target_link_libraries( txn_test_gen_plugin appbase fc http_plugin chain_plugin eosio_testing_contracts ) target_include_directories( txn_test_gen_plugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include txn_test_gen_plugin PUBLIC ${CMAKE_SOURCE_DIR}/libraries/testing/include txn_test_gen_plugin PUBLIC ${CMAKE_BINARY_DIR}/unittests/include ) diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index a5e0d1fa6aa..923cfcc1422 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -27,7 +27,6 @@ else() endif() add_subdirectory(contracts) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/contracts.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/contracts.hpp ESCAPE_QUOTES) add_subdirectory(snapshots) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/snapshots.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/include/snapshots.hpp ESCAPE_QUOTES) diff --git a/unittests/delay_tests.cpp b/unittests/delay_tests.cpp index 3349c2a069d..f4b8b994362 100644 --- a/unittests/delay_tests.cpp +++ b/unittests/delay_tests.cpp @@ -1,5 +1,6 @@ #include #include +#include #include