Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

fix boost unit test linkage; fixes build on Fedora 34 #10305

Merged
merged 7 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libraries/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
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
tester_network.cpp
${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"
Expand Down
19 changes: 15 additions & 4 deletions unittests/contracts.hpp.in → libraries/testing/contracts.hpp.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#pragma once

#include <eosio/testing/tester.hpp>
#include <vector>

#include <eosio/chain/asset.hpp>
#include <fc/io/fstream.hpp>

#define CORE_SYM_NAME "${CORE_SYMBOL_NAME}"
#define CORE_SYM_PRECISION 4
Expand All @@ -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<uint8_t> CN ## _wasm() { return read_wasm("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".wasm"); } \
static std::vector<char> CN ## _abi() { return read_abi("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".abi"); }
#define MAKE_READ_WASM_ABI(CN,C, D) \
static std::vector<uint8_t> CN ## _wasm() { \
std::string s; \
fc::read_file_contents("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".wasm", s); \
return std::vector<uint8_t>(s.begin(), s.end()); \
} \
static std::vector<char> CN ## _abi() { \
std::string s; \
fc::read_file_contents("${CMAKE_BINARY_DIR}/unittests/" #D "/" #C "/" #C ".abi", s); \
return std::vector<char>(s.begin(), s.end()); \
}

namespace eosio {
namespace testing {
Expand Down
2 changes: 1 addition & 1 deletion plugins/chain_plugin/test/test_account_query_db.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE account_query_db
#include <eosio/chain/permission_object.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/types.hpp>
#include <eosio/chain/block_state.hpp>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define BOOST_TEST_MODULE blockvault_sync_strategy
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>
#include <eosio/chain/permission_object.hpp>
#include <eosio/chain/types.hpp>
#include <eosio/chain_plugin/blockvault_sync_strategy.hpp>
Expand Down
2 changes: 1 addition & 1 deletion plugins/chain_plugin/test/test_chain_plugin.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define BOOST_TEST_MODULE chain_plugin
#include <eosio/chain/permission_object.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/included/unit_test.hpp>
#include <eosio/testing/tester.hpp>
#include <eosio/chain/types.hpp>
#include <eosio/chain_plugin/chain_plugin.hpp>
Expand Down
2 changes: 1 addition & 1 deletion plugins/txn_test_gen_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
1 change: 0 additions & 1 deletion unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions unittests/delay_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <eosio/chain/generated_transaction_object.hpp>
#include <eosio/chain/global_property_object.hpp>
#include <eosio/testing/tester.hpp>

#include <boost/test/unit_test.hpp>

Expand Down