From 0713d6676df7e21ee68e58cb758a67df54294eab Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Tue, 27 Apr 2021 13:38:33 -0400 Subject: [PATCH 1/6] migrate contracts.hpp.in to separate target --- libraries/testing/CMakeLists.txt | 6 +++++- .../testing}/contracts.hpp.in | 17 ++++++++++++++--- unittests/CMakeLists.txt | 1 - unittests/delay_tests.cpp | 1 + 4 files changed, 20 insertions(+), 5 deletions(-) rename {unittests => libraries/testing}/contracts.hpp.in (84%) diff --git a/libraries/testing/CMakeLists.txt b/libraries/testing/CMakeLists.txt index 0c71359ec44..6b4b23ec57b 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 Boost::unit_test_framework ) 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 84% rename from unittests/contracts.hpp.in rename to libraries/testing/contracts.hpp.in index 2b675f43b43..6145120dd78 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 @@ -19,8 +22,16 @@ 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"); } + 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/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 From 6aa2432f32e56702621496c4dc3b1cde043670d7 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Tue, 27 Apr 2021 13:39:09 -0400 Subject: [PATCH 2/6] txn_test_gen_plugin depend on eosio_testing_contracts not eosio_testing --- plugins/txn_test_gen_plugin/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ) From 770aa070a42c53bcd684504ee57ed0440256e61a Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Tue, 27 Apr 2021 14:00:45 -0400 Subject: [PATCH 3/6] stop linking eosio_testing to boost unit test framework --- libraries/testing/CMakeLists.txt | 2 +- plugins/chain_plugin/test/test_account_query_db.cpp | 2 +- plugins/chain_plugin/test/test_blockvault_sync_strategy.cpp | 2 +- plugins/chain_plugin/test/test_chain_plugin.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/testing/CMakeLists.txt b/libraries/testing/CMakeLists.txt index 6b4b23ec57b..b2bb8bb9158 100644 --- a/libraries/testing/CMakeLists.txt +++ b/libraries/testing/CMakeLists.txt @@ -11,7 +11,7 @@ add_library( eosio_testing ${HEADERS} ) -target_link_libraries( eosio_testing eosio_testing_contracts 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/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 From e499bce4399a63c89aed74deb98178d5b720fd28 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Tue, 27 Apr 2021 14:01:04 -0400 Subject: [PATCH 4/6] bump fc for fix to test_webauthn --- libraries/fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fc b/libraries/fc index 50d57cbc6b2..29ebe66248f 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 50d57cbc6b2d1af6fd4a0930a5c98f7add900078 +Subproject commit 29ebe66248fb23b07f3fef265ac770d50d39a576 From 43828b133ae3d93904c7de0d59547ea72c8e1c95 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Wed, 5 May 2021 22:13:03 -0400 Subject: [PATCH 5/6] whitespace cleanups --- libraries/testing/contracts.hpp.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/testing/contracts.hpp.in b/libraries/testing/contracts.hpp.in index 6145120dd78..4ea56ec5e1a 100644 --- a/libraries/testing/contracts.hpp.in +++ b/libraries/testing/contracts.hpp.in @@ -21,16 +21,16 @@ 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() { \ - std::string s; \ +#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());\ + } \ + 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 { From a673a7c19191b15cda6bd214a72c97e1fa4e2044 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Thu, 6 May 2021 11:21:51 -0400 Subject: [PATCH 6/6] bump fc to latest eosio head --- libraries/fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fc b/libraries/fc index 29ebe66248f..f3875ecbabb 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 29ebe66248fb23b07f3fef265ac770d50d39a576 +Subproject commit f3875ecbabb89c8c426ab5562eb42650710a49e8