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

fix fc::temp_directory usage in tester #7634

Merged
merged 1 commit into from
Jul 10, 2019
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
5 changes: 2 additions & 3 deletions libraries/testing/include/eosio/testing/tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,7 @@ namespace eosio { namespace testing {
}
controller::config vcfg;

static controller::config default_config() {
fc::temp_directory tempdir;
static controller::config default_config(fc::temp_directory& tempdir) {
controller::config vcfg;
vcfg.blocks_dir = tempdir.path() / std::string("v_").append(config::default_blocks_dir_name);
vcfg.state_dir = tempdir.path() / std::string("v_").append(config::default_state_dir_name);
Expand All @@ -394,7 +393,7 @@ namespace eosio { namespace testing {
}

validating_tester(const flat_set<account_name>& trusted_producers = flat_set<account_name>()) {
vcfg = default_config();
vcfg = default_config(tempdir);

vcfg.trusted_producers = trusted_producers;

Expand Down
6 changes: 4 additions & 2 deletions unittests/api_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ BOOST_FIXTURE_TEST_CASE(require_notice_tests, TESTER) { try {
} FC_LOG_AND_RETHROW() }

BOOST_AUTO_TEST_CASE(ram_billing_in_notify_tests) { try {
validating_tester chain( validating_tester::default_config() );
fc::temp_directory tempdir;
validating_tester chain( validating_tester::default_config(tempdir) );
chain.execute_setup_policy( setup_policy::preactivate_feature_and_new_bios );

chain.produce_blocks(2);
Expand Down Expand Up @@ -1319,7 +1320,8 @@ BOOST_FIXTURE_TEST_CASE(deferred_transaction_tests, TESTER) { try {
} FC_LOG_AND_RETHROW() }

BOOST_AUTO_TEST_CASE(more_deferred_transaction_tests) { try {
auto cfg = validating_tester::default_config();
fc::temp_directory tempdir;
auto cfg = validating_tester::default_config(tempdir);
cfg.contracts_console = true;
validating_tester chain( cfg );
chain.execute_setup_policy( setup_policy::preactivate_feature_and_new_bios );
Expand Down
3 changes: 2 additions & 1 deletion unittests/auth_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,8 @@ BOOST_AUTO_TEST_CASE( any_auth ) { try {

BOOST_AUTO_TEST_CASE(no_double_billing) {
try {
validating_tester chain( validating_tester::default_config() );
fc::temp_directory tempdir;
validating_tester chain( validating_tester::default_config(tempdir) );
chain.execute_setup_policy( setup_policy::preactivate_feature_and_new_bios );

chain.produce_block();
Expand Down
3 changes: 2 additions & 1 deletion unittests/producer_schedule_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ BOOST_FIXTURE_TEST_CASE( producer_schedule_reduction, tester ) try {
} FC_LOG_AND_RETHROW()

BOOST_AUTO_TEST_CASE( empty_producer_schedule_has_no_effect ) try {
validating_tester c( validating_tester::default_config() );
fc::temp_directory tempdir;
validating_tester c( validating_tester::default_config(tempdir) );
c.execute_setup_policy( setup_policy::preactivate_feature_and_new_bios );

c.create_accounts( {N(alice),N(bob),N(carol)} );
Expand Down