From 25b0147e4b24bc57dad40ce1cb07bf7a3a0e9473 Mon Sep 17 00:00:00 2001 From: Russel Date: Thu, 25 Jun 2020 23:37:51 -0400 Subject: [PATCH 01/11] rocksdb test runs --- .../{release_test.yml => release_tests.yml} | 0 .github/workflows/rocksdb_release_tests.yml | 60 +++++++++++++++++++ .github/workflows/rocksdb_tests.yml | 60 +++++++++++++++++++ ci/test.sh | 6 +- 4 files changed, 125 insertions(+), 1 deletion(-) rename .github/workflows/{release_test.yml => release_tests.yml} (100%) create mode 100644 .github/workflows/rocksdb_release_tests.yml create mode 100644 .github/workflows/rocksdb_tests.yml diff --git a/.github/workflows/release_test.yml b/.github/workflows/release_tests.yml similarity index 100% rename from .github/workflows/release_test.yml rename to .github/workflows/release_tests.yml diff --git a/.github/workflows/rocksdb_release_tests.yml b/.github/workflows/rocksdb_release_tests.yml new file mode 100644 index 0000000000..e71e862276 --- /dev/null +++ b/.github/workflows/rocksdb_release_tests.yml @@ -0,0 +1,60 @@ +name: RocksDB Release Tests + +on: + push: + tags: '*' + +env: + RELEASE: 1 + artifact: 0 + TEST_USE_ROCKSDB: 1 + +jobs: + osx_test: + runs-on: macOS-latest + env: + BOOST_ROOT: /tmp/boost + steps: + - uses: actions/checkout@722adc6 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: TEST=1 ci/actions/osx/install_deps.sh + - name: Run Tests + run: ci/build-travis.sh "/tmp/qt/lib/cmake/Qt5"; + + gcc_test: + runs-on: ubuntu-18.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@722adc6 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: ci/actions/linux/install_deps.sh + - name: Run Tests + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + + clang_test: + runs-on: ubuntu-18.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@722adc6 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: ci/actions/linux/install_deps.sh + - name: Run Tests + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + + windows_test: + runs-on: windows-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@722adc6 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: ci/actions/windows/install_deps.ps1 + - name: Run Tests + run: ci/actions/windows/build.ps1 diff --git a/.github/workflows/rocksdb_tests.yml b/.github/workflows/rocksdb_tests.yml new file mode 100644 index 0000000000..30095139cc --- /dev/null +++ b/.github/workflows/rocksdb_tests.yml @@ -0,0 +1,60 @@ +name: RocksDB Tests + +on: [push, pull_request] + +env: + RELEASE: 0 + artifact: 0 + TEST_USE_ROCKSDB: 1 + +jobs: + osx_test: + runs-on: macOS-latest + env: + BOOST_ROOT: /tmp/boost + steps: + - uses: actions/checkout@722adc6 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: TEST=1 ci/actions/osx/install_deps.sh + - name: Run Tests + run: ci/build-travis.sh "/tmp/qt/lib/cmake/Qt5"; + + gcc_test: + runs-on: ubuntu-18.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@722adc6 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: ci/actions/linux/install_deps.sh + - name: Run Tests + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + + clang_test: + runs-on: ubuntu-18.04 + timeout-minutes: 60 + steps: + - uses: actions/checkout@722adc6 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: ci/actions/linux/install_deps.sh + - name: Run Tests + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + + windows_test: + runs-on: windows-latest + timeout-minutes: 60 + steps: + - uses: actions/checkout@722adc6 + - name: Windows Defender + run: ci/actions/windows/disable_windows_defender.ps1 + - name: Checkout Submodules + run: git submodule update --init --recursive + - name: Fetch Deps + run: ci/actions/windows/install_deps.ps1 + - name: Run Tests + run: ci/actions/windows/build.ps1 diff --git a/ci/test.sh b/ci/test.sh index 46ad59de80..d5916096ee 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -1,7 +1,11 @@ #!/usr/bin/env bash build_dir=${1-${PWD}} -TIMEOUT_DEFAULT=360 +if [[ ${TEST_USE_ROCKSDB-0} == 1 ]]; then + TIMEOUT_DEFAULT=720 +else + TIMEOUT_DEFAULT=360 +fi BUSYBOX_BASH=${BUSYBOX_BASH-0} From 115bb929fe229e40e6ce15d8dd9d55f1912a6997 Mon Sep 17 00:00:00 2001 From: Russel Date: Sun, 5 Jul 2020 22:37:35 -0400 Subject: [PATCH 02/11] Rocksdb in debug is too slow to complete on actions with windows Use relwithdebinfo instead --- .github/workflows/rocksdb_tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rocksdb_tests.yml b/.github/workflows/rocksdb_tests.yml index 30095139cc..0fa2c07f63 100644 --- a/.github/workflows/rocksdb_tests.yml +++ b/.github/workflows/rocksdb_tests.yml @@ -48,6 +48,8 @@ jobs: windows_test: runs-on: windows-latest timeout-minutes: 60 + env: + RELEASE: 1 steps: - uses: actions/checkout@722adc6 - name: Windows Defender From feaa2ddd58f4a3f59dda8389450d67f9fbcc8177 Mon Sep 17 00:00:00 2001 From: Russel Date: Mon, 6 Jul 2020 09:10:31 -0400 Subject: [PATCH 03/11] double deadline factor for windows tests that are slow dont duplicate win relwithdebinfo run due to debug timings on win --- .github/workflows/rocksdb_release_tests.yml | 12 ------------ .github/workflows/rocksdb_tests.yml | 1 + 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/rocksdb_release_tests.yml b/.github/workflows/rocksdb_release_tests.yml index e71e862276..a6edfb6f29 100644 --- a/.github/workflows/rocksdb_release_tests.yml +++ b/.github/workflows/rocksdb_release_tests.yml @@ -46,15 +46,3 @@ jobs: run: ci/actions/linux/install_deps.sh - name: Run Tests run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" - - windows_test: - runs-on: windows-latest - timeout-minutes: 60 - steps: - - uses: actions/checkout@722adc6 - - name: Checkout Submodules - run: git submodule update --init --recursive - - name: Fetch Deps - run: ci/actions/windows/install_deps.ps1 - - name: Run Tests - run: ci/actions/windows/build.ps1 diff --git a/.github/workflows/rocksdb_tests.yml b/.github/workflows/rocksdb_tests.yml index 0fa2c07f63..1e7abbde0a 100644 --- a/.github/workflows/rocksdb_tests.yml +++ b/.github/workflows/rocksdb_tests.yml @@ -50,6 +50,7 @@ jobs: timeout-minutes: 60 env: RELEASE: 1 + DEADLINE_SCALE_FACTOR: 2 steps: - uses: actions/checkout@722adc6 - name: Windows Defender From 9eb1d481d02118326c72297b5efc3705d8766071 Mon Sep 17 00:00:00 2001 From: Russel Date: Tue, 7 Jul 2020 09:05:21 -0400 Subject: [PATCH 04/11] refactor check for TEST_USE_ROCKSDB windows actions has issues with node.bidirectional_tcp and rocksdb return early if windows and using rocksdb --- nano/core_test/node.cpp | 7 +++++++ nano/node/testing.cpp | 12 ++++++++++++ nano/node/testing.hpp | 1 + nano/rpc_test/rpc.cpp | 5 ++--- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index 709adfd2fa..5eb1a9f579 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -3666,6 +3666,13 @@ TEST (node, dont_write_lock_node) TEST (node, bidirectional_tcp) { + #ifdef _WIN32 + if (nano::is_rocksdb_test()) + { + // Don't test this in rocksdb mode + return; + } + #endif nano::system system; nano::node_flags node_flags; // Disable bootstrap to start elections for new blocks diff --git a/nano/node/testing.cpp b/nano/node/testing.cpp index ec35731aa0..b82c83783f 100644 --- a/nano/node/testing.cpp +++ b/nano/node/testing.cpp @@ -535,6 +535,18 @@ uint16_t nano::get_available_port () return available_port; } +bool nano::is_rocksdb_test () +{ + // Don't test this in rocksdb mode + bool ret = false; + auto use_rocksdb_str = std::getenv ("TEST_USE_ROCKSDB"); + if (use_rocksdb_str && boost::lexical_cast (use_rocksdb_str) == 1) + { + ret = true; + } + return ret; +} + void nano::cleanup_test_directories_on_exit () { // Makes sure everything is cleaned up diff --git a/nano/node/testing.hpp b/nano/node/testing.hpp index 4a607b9d2c..0640343096 100644 --- a/nano/node/testing.hpp +++ b/nano/node/testing.hpp @@ -58,6 +58,7 @@ class system final std::unique_ptr upgrade_epoch (nano::work_pool &, nano::ledger &, nano::epoch); void blocks_confirm (nano::node &, std::vector> const &); uint16_t get_available_port (); +bool is_rocksdb_test (); void cleanup_test_directories_on_exit (); } REGISTER_ERROR_CODES (nano, error_system); diff --git a/nano/rpc_test/rpc.cpp b/nano/rpc_test/rpc.cpp index a465f29b89..7bcdf7c12a 100644 --- a/nano/rpc_test/rpc.cpp +++ b/nano/rpc_test/rpc.cpp @@ -6727,10 +6727,9 @@ TEST (rpc, block_confirmed) TEST (rpc, database_txn_tracker) { - // Don't test this with the rocksdb backend - auto use_rocksdb_str = std::getenv ("TEST_USE_ROCKSDB"); - if (use_rocksdb_str && boost::lexical_cast (use_rocksdb_str) == 1) + if (nano::is_rocksdb_test()) { + // Don't test this in rocksdb mode return; } From 6bf48ac039aad81b39002079b96c33ee8a0c06bd Mon Sep 17 00:00:00 2001 From: Russel Date: Tue, 7 Jul 2020 09:13:20 -0400 Subject: [PATCH 05/11] formatting --- nano/core_test/node.cpp | 6 +++--- nano/rpc_test/rpc.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index 5eb1a9f579..907828eb75 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -3666,13 +3666,13 @@ TEST (node, dont_write_lock_node) TEST (node, bidirectional_tcp) { - #ifdef _WIN32 - if (nano::is_rocksdb_test()) +#ifdef _WIN32 + if (nano::is_rocksdb_test ()) { // Don't test this in rocksdb mode return; } - #endif +#endif nano::system system; nano::node_flags node_flags; // Disable bootstrap to start elections for new blocks diff --git a/nano/rpc_test/rpc.cpp b/nano/rpc_test/rpc.cpp index 7bcdf7c12a..37950334eb 100644 --- a/nano/rpc_test/rpc.cpp +++ b/nano/rpc_test/rpc.cpp @@ -6727,7 +6727,7 @@ TEST (rpc, block_confirmed) TEST (rpc, database_txn_tracker) { - if (nano::is_rocksdb_test()) + if (nano::is_rocksdb_test ()) { // Don't test this in rocksdb mode return; From c6438248d57d54d304512a44ed8ff93a3aef536e Mon Sep 17 00:00:00 2001 From: Russel Date: Tue, 7 Jul 2020 12:37:20 -0400 Subject: [PATCH 06/11] double deadline factor for osx tests instead of switching to relwithdebinfo for regular test runs --- .github/workflows/rocksdb_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rocksdb_tests.yml b/.github/workflows/rocksdb_tests.yml index 1e7abbde0a..cf6a13d4d5 100644 --- a/.github/workflows/rocksdb_tests.yml +++ b/.github/workflows/rocksdb_tests.yml @@ -12,6 +12,7 @@ jobs: runs-on: macOS-latest env: BOOST_ROOT: /tmp/boost + DEADLINE_SCALE_FACTOR: 2 steps: - uses: actions/checkout@722adc6 - name: Checkout Submodules From e4b58c79cb73259b44749cf32a0142faf8c342e8 Mon Sep 17 00:00:00 2001 From: Russel Waters Date: Sun, 26 Jul 2020 21:01:03 -0700 Subject: [PATCH 07/11] guard any mdb_store based tests write out when a test is skipped for rocksdb --- nano/core_test/block_store.cpp | 56 ++++++++++++++++++++++++++ nano/core_test/confirmation_height.cpp | 20 +++++++++ nano/core_test/ledger.cpp | 5 +++ nano/node/testing.cpp | 1 + nano/qt_test/qt.cpp | 5 +++ nano/slow_test/node.cpp | 5 +++ 6 files changed, 92 insertions(+) diff --git a/nano/core_test/block_store.cpp b/nano/core_test/block_store.cpp index 4cc134b462..862b95aa06 100644 --- a/nano/core_test/block_store.cpp +++ b/nano/core_test/block_store.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -372,6 +373,11 @@ TEST (bootstrap, simple) TEST (unchecked, multiple) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano::logger_mt logger; nano::mdb_store store (logger, nano::unique_path ()); ASSERT_TRUE (!store.init_error ()); @@ -653,6 +659,11 @@ TEST (block_store, latest_find) TEST (mdb_block_store, supported_version_upgrades) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } // Check that upgrading from an unsupported version is not supported auto path (nano::unique_path ()); nano::genesis genesis; @@ -699,6 +710,11 @@ TEST (mdb_block_store, supported_version_upgrades) TEST (mdb_block_store, bad_path) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano::logger_mt logger; nano::mdb_store store (logger, boost::filesystem::path ("///")); ASSERT_TRUE (store.init_error ()); @@ -1026,6 +1042,11 @@ TEST (block_store, state_block) TEST (mdb_block_store, sideband_height) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano::logger_mt logger; nano::genesis genesis; nano::keypair key1; @@ -1213,6 +1234,11 @@ TEST (block_store, online_weight) TEST (mdb_block_store, upgrade_v14_v15) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } // Extract confirmation height to a separate database auto path (nano::unique_path ()); nano::genesis genesis; @@ -1321,6 +1347,11 @@ TEST (mdb_block_store, upgrade_v14_v15) TEST (mdb_block_store, upgrade_v15_v16) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } auto path (nano::unique_path ()); nano::mdb_val value; { @@ -1362,6 +1393,11 @@ TEST (mdb_block_store, upgrade_v15_v16) TEST (mdb_block_store, upgrade_v16_v17) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano::genesis genesis; nano::work_pool pool (std::numeric_limits::max ()); nano::state_block block1 (nano::test_genesis_key.pub, genesis.hash (), nano::test_genesis_key.pub, nano::genesis_amount - nano::Gxrb_ratio, nano::test_genesis_key.pub, nano::test_genesis_key.prv, nano::test_genesis_key.pub, *pool.generate (genesis.hash ())); @@ -1421,6 +1457,11 @@ TEST (mdb_block_store, upgrade_v16_v17) TEST (mdb_block_store, upgrade_v17_v18) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } auto path (nano::unique_path ()); nano::genesis genesis; nano::keypair key1; @@ -1620,6 +1661,11 @@ TEST (mdb_block_store, upgrade_v17_v18) TEST (mdb_block_store, upgrade_v18_v19) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } auto path (nano::unique_path ()); nano::keypair key1; nano::work_pool pool (std::numeric_limits::max ()); @@ -1708,6 +1754,11 @@ TEST (mdb_block_store, upgrade_v18_v19) TEST (mdb_block_store, upgrade_backup) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } auto dir (nano::unique_path ()); namespace fs = boost::filesystem; fs::create_directory (dir); @@ -1745,6 +1796,11 @@ TEST (mdb_block_store, upgrade_backup) // Test various confirmation height values as well as clearing them TEST (block_store, confirmation_height) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } auto path (nano::unique_path ()); nano::logger_mt logger; nano::mdb_store store (logger, path); diff --git a/nano/core_test/confirmation_height.cpp b/nano/core_test/confirmation_height.cpp index 44597b1491..d77c439260 100644 --- a/nano/core_test/confirmation_height.cpp +++ b/nano/core_test/confirmation_height.cpp @@ -732,6 +732,11 @@ TEST (confirmation_height, conflict_rollback_cemented) TEST (confirmation_heightDeathTest, rollback_added_block) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } // For ASSERT_DEATH_IF_SUPPORTED testing::FLAGS_gtest_death_test_style = "threadsafe"; @@ -804,6 +809,11 @@ TEST (confirmation_height, observers) // This tests when a read has been done, but the block no longer exists by the time a write is done TEST (confirmation_heightDeathTest, modified_chain) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } // For ASSERT_DEATH_IF_SUPPORTED testing::FLAGS_gtest_death_test_style = "threadsafe"; @@ -870,6 +880,11 @@ TEST (confirmation_heightDeathTest, modified_chain) // This tests when a read has been done, but the account no longer exists by the time a write is done TEST (confirmation_heightDeathTest, modified_chain_account_removed) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } // For ASSERT_DEATH_IF_SUPPORTED testing::FLAGS_gtest_death_test_style = "threadsafe"; @@ -1577,6 +1592,11 @@ TEST (confirmation_height, election_winner_details_clearing_node_process_confirm TEST (confirmation_height, unbounded_block_cache_iteration) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano::logger_mt logger; auto path (nano::unique_path ()); nano::mdb_store store (logger, path); diff --git a/nano/core_test/ledger.cpp b/nano/core_test/ledger.cpp index 0df1fe69ae..8830959cf9 100644 --- a/nano/core_test/ledger.cpp +++ b/nano/core_test/ledger.cpp @@ -11,6 +11,11 @@ using namespace std::chrono_literals; // Init returns an error if it can't open files at the path TEST (ledger, store_error) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano::logger_mt logger; nano::mdb_store store (logger, boost::filesystem::path ("///")); ASSERT_TRUE (store.init_error ()); diff --git a/nano/node/testing.cpp b/nano/node/testing.cpp index b82c83783f..997387d3ad 100644 --- a/nano/node/testing.cpp +++ b/nano/node/testing.cpp @@ -542,6 +542,7 @@ bool nano::is_rocksdb_test () auto use_rocksdb_str = std::getenv ("TEST_USE_ROCKSDB"); if (use_rocksdb_str && boost::lexical_cast (use_rocksdb_str) == 1) { + std::cout << "ROCKSDB RUN ignored test" << std::endl; ret = true; } return ret; diff --git a/nano/qt_test/qt.cpp b/nano/qt_test/qt.cpp index 7d005d3712..34d038608f 100644 --- a/nano/qt_test/qt.cpp +++ b/nano/qt_test/qt.cpp @@ -465,6 +465,11 @@ TEST (wallet, create_change) TEST (history, short_text) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano_qt::eventloop_processor processor; nano::keypair key; nano::system system (1); diff --git a/nano/slow_test/node.cpp b/nano/slow_test/node.cpp index fb717b3919..cb3fb1d0b9 100644 --- a/nano/slow_test/node.cpp +++ b/nano/slow_test/node.cpp @@ -912,6 +912,11 @@ TEST (confirmation_height, many_accounts_send_receive_self) // as opposed to active transactions which implicitly calls confirmation height processor. TEST (confirmation_height, many_accounts_send_receive_self_no_elections) { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } nano::logger_mt logger; auto path (nano::unique_path ()); nano::mdb_store store (logger, path); From 647bcf6dd99168ef4c592d2ae861fe7ad23d616b Mon Sep 17 00:00:00 2001 From: Russel Waters Date: Sun, 26 Jul 2020 21:31:31 -0700 Subject: [PATCH 08/11] include ordering --- nano/core_test/block_store.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nano/core_test/block_store.cpp b/nano/core_test/block_store.cpp index 862b95aa06..4715f46223 100644 --- a/nano/core_test/block_store.cpp +++ b/nano/core_test/block_store.cpp @@ -4,11 +4,11 @@ #include #include #include +#include #include #include #include #include -#include #include From 2a005c44627d36c244a16aa69c0ae71291b68b5c Mon Sep 17 00:00:00 2001 From: Russel Date: Wed, 12 Aug 2020 10:36:31 -0700 Subject: [PATCH 09/11] additional test that shouldnt run for rocksdb mode --- nano/core_test/node.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index ca376e1d2a..d834c6eb82 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -72,6 +72,11 @@ TEST (node_DeathTest, DISABLED_readonly_block_store_not_exist) TEST (node_DeathTest, readonly_block_store_not_exist) #endif { + if (nano::is_rocksdb_test ()) + { + // Don't test this in rocksdb mode + return; + } // For ASSERT_DEATH_IF_SUPPORTED testing::FLAGS_gtest_death_test_style = "threadsafe"; From dbadfba0339c35e42b84c130eed5bbb6bb12ae0e Mon Sep 17 00:00:00 2001 From: Russel Date: Sun, 30 Aug 2020 22:22:11 -0700 Subject: [PATCH 10/11] merge changes for Cxx17 --- .github/workflows/rocksdb_release_tests.yml | 4 ++-- .github/workflows/rocksdb_tests.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rocksdb_release_tests.yml b/.github/workflows/rocksdb_release_tests.yml index a6edfb6f29..9653dae576 100644 --- a/.github/workflows/rocksdb_release_tests.yml +++ b/.github/workflows/rocksdb_release_tests.yml @@ -33,7 +33,7 @@ jobs: - name: Fetch Deps run: ci/actions/linux/install_deps.sh - name: Run Tests - run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" clang_test: runs-on: ubuntu-18.04 @@ -45,4 +45,4 @@ jobs: - name: Fetch Deps run: ci/actions/linux/install_deps.sh - name: Run Tests - run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang /bin/bash -c "cd /workspace && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && RELEASE=1 ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" diff --git a/.github/workflows/rocksdb_tests.yml b/.github/workflows/rocksdb_tests.yml index cf6a13d4d5..e9e707496b 100644 --- a/.github/workflows/rocksdb_tests.yml +++ b/.github/workflows/rocksdb_tests.yml @@ -32,7 +32,7 @@ jobs: - name: Fetch Deps run: ci/actions/linux/install_deps.sh - name: Run Tests - run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:gcc /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" clang_test: runs-on: ubuntu-18.04 @@ -44,7 +44,7 @@ jobs: - name: Fetch Deps run: ci/actions/linux/install_deps.sh - name: Run Tests - run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang /bin/bash -c "cd /workspace && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" + run: docker run -e TEST_USE_ROCKSDB -v ${PWD}:/workspace nanocurrency/nano-env:clang-6 /bin/bash -c "cd /workspace && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/boost/lib && ldconfig && ./ci/build-travis.sh /usr/lib/x86_64-linux-gnu/cmake/Qt5 ${PWD}" windows_test: runs-on: windows-latest From da2a34c179464232dc37afd23f488f926f16d791 Mon Sep 17 00:00:00 2001 From: Russel Date: Thu, 10 Sep 2020 08:44:42 -0700 Subject: [PATCH 11/11] remove duplicate function use existing function for test guards --- nano/core_test/block_store.cpp | 22 +++++++++++----------- nano/core_test/confirmation_height.cpp | 8 ++++---- nano/core_test/ledger.cpp | 2 +- nano/core_test/node.cpp | 6 +----- nano/node/testing.cpp | 13 ------------- nano/node/testing.hpp | 1 - nano/qt_test/qt.cpp | 2 +- nano/rpc_test/rpc.cpp | 2 +- nano/slow_test/node.cpp | 2 +- 9 files changed, 20 insertions(+), 38 deletions(-) diff --git a/nano/core_test/block_store.cpp b/nano/core_test/block_store.cpp index 775987109a..07faab0f5c 100644 --- a/nano/core_test/block_store.cpp +++ b/nano/core_test/block_store.cpp @@ -373,7 +373,7 @@ TEST (bootstrap, simple) TEST (unchecked, multiple) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -659,7 +659,7 @@ TEST (block_store, latest_find) TEST (mdb_block_store, supported_version_upgrades) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -710,7 +710,7 @@ TEST (mdb_block_store, supported_version_upgrades) TEST (mdb_block_store, bad_path) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1042,7 +1042,7 @@ TEST (block_store, state_block) TEST (mdb_block_store, sideband_height) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1234,7 +1234,7 @@ TEST (block_store, online_weight) TEST (mdb_block_store, upgrade_v14_v15) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1347,7 +1347,7 @@ TEST (mdb_block_store, upgrade_v14_v15) TEST (mdb_block_store, upgrade_v15_v16) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1393,7 +1393,7 @@ TEST (mdb_block_store, upgrade_v15_v16) TEST (mdb_block_store, upgrade_v16_v17) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1457,7 +1457,7 @@ TEST (mdb_block_store, upgrade_v16_v17) TEST (mdb_block_store, upgrade_v17_v18) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1661,7 +1661,7 @@ TEST (mdb_block_store, upgrade_v17_v18) TEST (mdb_block_store, upgrade_v18_v19) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1754,7 +1754,7 @@ TEST (mdb_block_store, upgrade_v18_v19) TEST (mdb_block_store, upgrade_backup) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1796,7 +1796,7 @@ TEST (mdb_block_store, upgrade_backup) // Test various confirmation height values as well as clearing them TEST (block_store, confirmation_height) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; diff --git a/nano/core_test/confirmation_height.cpp b/nano/core_test/confirmation_height.cpp index 53aada1975..9261c28ca0 100644 --- a/nano/core_test/confirmation_height.cpp +++ b/nano/core_test/confirmation_height.cpp @@ -729,7 +729,7 @@ TEST (confirmation_height, conflict_rollback_cemented) TEST (confirmation_heightDeathTest, rollback_added_block) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -806,7 +806,7 @@ TEST (confirmation_height, observers) // This tests when a read has been done, but the block no longer exists by the time a write is done TEST (confirmation_heightDeathTest, modified_chain) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -877,7 +877,7 @@ TEST (confirmation_heightDeathTest, modified_chain) // This tests when a read has been done, but the account no longer exists by the time a write is done TEST (confirmation_heightDeathTest, modified_chain_account_removed) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; @@ -1398,7 +1398,7 @@ TEST (confirmation_height, election_winner_details_clearing_node_process_confirm TEST (confirmation_height, unbounded_block_cache_iteration) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; diff --git a/nano/core_test/ledger.cpp b/nano/core_test/ledger.cpp index 7031bf84da..63fbe6a6ab 100644 --- a/nano/core_test/ledger.cpp +++ b/nano/core_test/ledger.cpp @@ -11,7 +11,7 @@ using namespace std::chrono_literals; // Init returns an error if it can't open files at the path TEST (ledger, store_error) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index 1f09030422..e2fe851556 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -73,7 +73,6 @@ TEST (node_DeathTest, readonly_block_store_not_exist) #endif { // This is a read-only node with no ledger file -#if NANO_ROCKSDB if (nano::using_rocksdb_in_tests ()) { nano::inactive_node node (nano::unique_path (), nano::inactive_node_flag_defaults ()); @@ -83,9 +82,6 @@ TEST (node_DeathTest, readonly_block_store_not_exist) { ASSERT_EXIT (nano::inactive_node node (nano::unique_path (), nano::inactive_node_flag_defaults ()), ::testing::ExitedWithCode (1), ""); } -#else - ASSERT_EXIT (nano::inactive_node node (nano::unique_path (), nano::inactive_node_flag_defaults ()), ::testing::ExitedWithCode (1), ""); -#endif } TEST (node, password_fanout) @@ -3687,7 +3683,7 @@ TEST (node, dont_write_lock_node) TEST (node, bidirectional_tcp) { #ifdef _WIN32 - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; diff --git a/nano/node/testing.cpp b/nano/node/testing.cpp index fca122ce22..ef0e751866 100644 --- a/nano/node/testing.cpp +++ b/nano/node/testing.cpp @@ -531,19 +531,6 @@ uint16_t nano::get_available_port () return available_port; } -bool nano::is_rocksdb_test () -{ - // Don't test this in rocksdb mode - bool ret = false; - auto use_rocksdb_str = std::getenv ("TEST_USE_ROCKSDB"); - if (use_rocksdb_str && boost::lexical_cast (use_rocksdb_str) == 1) - { - std::cout << "ROCKSDB RUN ignored test" << std::endl; - ret = true; - } - return ret; -} - void nano::cleanup_dev_directories_on_exit () { // Makes sure everything is cleaned up diff --git a/nano/node/testing.hpp b/nano/node/testing.hpp index 42826fbddc..b3f72ebaaf 100644 --- a/nano/node/testing.hpp +++ b/nano/node/testing.hpp @@ -58,7 +58,6 @@ class system final std::unique_ptr upgrade_epoch (nano::work_pool &, nano::ledger &, nano::epoch); void blocks_confirm (nano::node &, std::vector> const &); uint16_t get_available_port (); -bool is_rocksdb_test (); void cleanup_dev_directories_on_exit (); /** To use RocksDB in tests make sure the node is built with the cmake variable -DNANO_ROCKSDB=ON and the environment variable TEST_USE_ROCKSDB=1 is set */ bool using_rocksdb_in_tests (); diff --git a/nano/qt_test/qt.cpp b/nano/qt_test/qt.cpp index 5bd178a05b..6ad095d97f 100644 --- a/nano/qt_test/qt.cpp +++ b/nano/qt_test/qt.cpp @@ -465,7 +465,7 @@ TEST (wallet, create_change) TEST (history, short_text) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; diff --git a/nano/rpc_test/rpc.cpp b/nano/rpc_test/rpc.cpp index 388c8dc92d..51a5e65938 100644 --- a/nano/rpc_test/rpc.cpp +++ b/nano/rpc_test/rpc.cpp @@ -6751,7 +6751,7 @@ TEST (rpc, block_confirmed) TEST (rpc, database_txn_tracker) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return; diff --git a/nano/slow_test/node.cpp b/nano/slow_test/node.cpp index 2d1a0160b7..1d97f8acbe 100644 --- a/nano/slow_test/node.cpp +++ b/nano/slow_test/node.cpp @@ -914,7 +914,7 @@ TEST (confirmation_height, many_accounts_send_receive_self) // as opposed to active transactions which implicitly calls confirmation height processor. TEST (confirmation_height, many_accounts_send_receive_self_no_elections) { - if (nano::is_rocksdb_test ()) + if (nano::using_rocksdb_in_tests ()) { // Don't test this in rocksdb mode return;