From 4f86bab857d94dfecad7d12e61608aee1b9cb00c Mon Sep 17 00:00:00 2001 From: kayan Date: Tue, 5 Mar 2024 16:09:02 +0800 Subject: [PATCH 1/2] use leap 5 for release/0.6 --- .github/workflows/contract.yml | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/contract.yml b/.github/workflows/contract.yml index 1e2faa4f..58f52459 100644 --- a/.github/workflows/contract.yml +++ b/.github/workflows/contract.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 submodules: 'false' @@ -23,40 +23,29 @@ jobs: run: cat .github/workflows/contract.md >> $GITHUB_STEP_SUMMARY build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: DWITH_TEST_ACTIONS: ['on', 'off'] name: EOS EVM Contract Build - Tests ${{ matrix.DWITH_TEST_ACTIONS }} env: - CC: gcc-10 - CXX: g++-10 DCMAKE_BUILD_TYPE: 'Release' steps: - - name: Authenticate - id: auth - uses: AntelopeIO/github-app-token-action@v1 - with: - app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }} - private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }} - - name: Checkout Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 submodules: 'recursive' - token: ${{ steps.auth.outputs.token }} - name: Download CDT - uses: AntelopeIO/asset-artifact-download-action@v2 + uses: AntelopeIO/asset-artifact-download-action@v3 with: owner: AntelopeIO repo: cdt target: 'v3.1.0' prereleases: false file: 'cdt_.*amd64.deb' - token: ${{ secrets.GITHUB_TOKEN }} - name: Install CDT run: sudo apt-get install -y ./cdt*.deb @@ -74,15 +63,15 @@ jobs: if-no-files-found: error - name: Download Leap - dev binary - uses: AntelopeIO/asset-artifact-download-action@v2 + uses: AntelopeIO/asset-artifact-download-action@v3 with: owner: AntelopeIO repo: leap - target: 'v3.1.3' + target: '^5.0.1' prereleases: false - file: 'leap-dev.*(x86_64|amd64).deb' + file: 'leap-dev.*ubuntu22\.04_amd64.deb' container-package: experimental-binaries - token: ${{ secrets.GITHUB_TOKEN }} + artifact-name: leap-dev-ubuntu22-amd64 - name: Install Leap run: sudo apt-get install -y ./leap*.deb @@ -108,3 +97,4 @@ jobs: name: test-results.xml path: test-results.xml if-no-files-found: error + From bf9b8de48088c44f987e81aac7190aeea2d94afd Mon Sep 17 00:00:00 2001 From: kayan Date: Tue, 5 Mar 2024 17:47:01 +0800 Subject: [PATCH 2/2] another try --- tests/CMakeLists.txt | 4 +-- tests/eosio.system_tester.hpp | 24 ++++---------- tests/evm_runtime_tests.cpp | 61 +++++++++++++++++++---------------- 3 files changed, 42 insertions(+), 47 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 707b21f9..ede1170d 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -52,6 +52,6 @@ add_eosio_test_executable( unit_test ) # TODO: add back eos-vm-oc once change to disable EOS VM OC subjective limits during unit test are added -add_test(NAME consensus_tests COMMAND unit_test --report_level=detailed --color_output --run_test=evm_runtime_tests) +add_test(NAME consensus_tests COMMAND unit_test --report_level=detailed --color_output --run_test=evm_runtime_tests -- --eos-vm-oc) -add_test(NAME unit_tests COMMAND unit_test --report_level=detailed --color_output --run_test=!evm_runtime_tests) +add_test(NAME unit_tests COMMAND unit_test --report_level=detailed --color_output --run_test=!evm_runtime_tests -- --eos-vm-oc) diff --git a/tests/eosio.system_tester.hpp b/tests/eosio.system_tester.hpp index 58bd850c..5d824aab 100644 --- a/tests/eosio.system_tester.hpp +++ b/tests/eosio.system_tester.hpp @@ -13,25 +13,15 @@ using namespace fc; using mvo = fc::mutable_variant_object; -#ifndef TESTER -#ifdef NON_VALIDATING_TEST -#define TESTER tester -#else -#define TESTER validating_tester -#endif -#endif - namespace eosio_system { -class eosio_system_tester : public TESTER { +class eosio_system_tester : public validating_tester { public: - - eosio_system_tester() - : eosio_system_tester([](TESTER& ) {}){} - - template - eosio_system_tester(Lambda setup) { - setup(*this); + eosio_system_tester(const fc::temp_directory& tmpdir) + : validating_tester(tmpdir, [](controller::config& cfg) { + cfg.eosvmoc_config.cache_size = 1024u*1024*256; + }, true) { + execute_setup_policy(setup_policy::full); produce_blocks( 2 ); @@ -451,7 +441,7 @@ class eosio_system_tester : public TESTER { } produce_blocks( 250); - auto trace_auth = TESTER::push_action(config::system_account_name, updateauth::get_name(), config::system_account_name, mvo() + auto trace_auth = validating_tester::push_action(config::system_account_name, updateauth::get_name(), config::system_account_name, mvo() ("account", name(config::system_account_name).to_string()) ("permission", name(config::active_name).to_string()) ("parent", name(config::owner_name).to_string()) diff --git a/tests/evm_runtime_tests.cpp b/tests/evm_runtime_tests.cpp index 517c7aff..63f91b33 100644 --- a/tests/evm_runtime_tests.cpp +++ b/tests/evm_runtime_tests.cpp @@ -408,7 +408,7 @@ struct evm_runtime_tester : eosio_system_tester, silkworm::State { size_t total_failed{0}; size_t total_skipped{0}; - evm_runtime_tester() { + evm_runtime_tester(const fc::temp_directory& tmpdir) : eosio_system_tester(tmpdir) { std::string verbose_arg = "--verbose"; std::string slowtests_arg = "--slow-tests"; auto argc = boost::unit_test::framework::master_test_suite().argc; @@ -1101,12 +1101,14 @@ struct evm_runtime_tester : eosio_system_tester, silkworm::State { }; BOOST_AUTO_TEST_SUITE(evm_runtime_tests) -BOOST_FIXTURE_TEST_CASE( GeneralStateTests, evm_runtime_tester ) try { +BOOST_AUTO_TEST_CASE( GeneralStateTests ) try { + fc::temp_directory tmpdir; + evm_runtime_tester t(tmpdir); StopWatch sw; sw.start(); - load_excluded(); + t.load_excluded(); const fs::path root_dir{contracts::eth_test_folder()}; @@ -1120,44 +1122,47 @@ BOOST_FIXTURE_TEST_CASE( GeneralStateTests, evm_runtime_tester ) try { const RunnerFunc runner{entry.second}; for (auto i = fs::recursive_directory_iterator(root_dir / dir); i != fs::recursive_directory_iterator{}; ++i) { - if (exclude_test(*i, root_dir, slow_tests)) { - ++total_skipped; + if (t.exclude_test(*i, root_dir, t.slow_tests)) { + ++t.total_skipped; i.disable_recursion_pending(); } else if (fs::is_regular_file(i->path())) { const fs::path path{*i}; - run_test_file(path, runner); + t.run_test_file(path, runner); } } } const auto [_, duration] = sw.lap(); - std::cout << total_passed << " tests passed" << ", " - << total_failed << " failed" << ", " - << total_skipped << " skipped" + std::cout << t.total_passed << " tests passed" << ", " + << t.total_failed << " failed" << ", " + << t.total_skipped << " skipped" << " in " << StopWatch::format(duration) << std::endl; - BOOST_REQUIRE_EQUAL(total_failed, 0); + BOOST_REQUIRE_EQUAL(t.total_failed, 0u); } FC_LOG_AND_RETHROW() -BOOST_FIXTURE_TEST_CASE( balance_and_dust_tests, evm_runtime_tester ) try { - BOOST_REQUIRE_EQUAL(testbaldust("basic"_n), success()); - - BOOST_REQUIRE_EQUAL(testbaldust("underflow1"_n), error("assertion failure with message: decrementing more than available")); - BOOST_REQUIRE_EQUAL(testbaldust("underflow2"_n), error("assertion failure with message: decrementing more than available")); - BOOST_REQUIRE_EQUAL(testbaldust("underflow3"_n), error("assertion failure with message: decrementing more than available")); - BOOST_REQUIRE_EQUAL(testbaldust("underflow4"_n), error("assertion failure with message: decrementing more than available")); - BOOST_REQUIRE_EQUAL(testbaldust("underflow5"_n), error("assertion failure with message: decrementing more than available")); - - BOOST_REQUIRE_EQUAL(testbaldust("overflow1"_n), error("assertion failure with message: accumulation overflow")); - BOOST_REQUIRE_EQUAL(testbaldust("overflow2"_n), error("assertion failure with message: accumulation overflow")); - BOOST_REQUIRE_EQUAL(testbaldust("overflow3"_n), success()); - BOOST_REQUIRE_EQUAL(testbaldust("overflow4"_n), error("assertion failure with message: accumulation overflow")); - BOOST_REQUIRE_EQUAL(testbaldust("overflow5"_n), error("assertion failure with message: accumulation overflow")); - BOOST_REQUIRE_EQUAL(testbaldust("overflowa"_n), error("assertion failure with message: accumulation overflow")); - BOOST_REQUIRE_EQUAL(testbaldust("overflowb"_n), error("assertion failure with message: accumulation overflow")); - BOOST_REQUIRE_EQUAL(testbaldust("overflowc"_n), error("assertion failure with message: accumulation overflow")); - BOOST_REQUIRE_EQUAL(testbaldust("overflowd"_n), error("assertion failure with message: accumulation overflow")); +BOOST_AUTO_TEST_CASE( balance_and_dust_tests ) try { + fc::temp_directory tmpdir; + evm_runtime_tester t(tmpdir); + + BOOST_REQUIRE_EQUAL(t.testbaldust("basic"_n), t.success()); + + BOOST_REQUIRE_EQUAL(t.testbaldust("underflow1"_n), t.error("assertion failure with message: decrementing more than available")); + BOOST_REQUIRE_EQUAL(t.testbaldust("underflow2"_n), t.error("assertion failure with message: decrementing more than available")); + BOOST_REQUIRE_EQUAL(t.testbaldust("underflow3"_n), t.error("assertion failure with message: decrementing more than available")); + BOOST_REQUIRE_EQUAL(t.testbaldust("underflow4"_n), t.error("assertion failure with message: decrementing more than available")); + BOOST_REQUIRE_EQUAL(t.testbaldust("underflow5"_n), t.error("assertion failure with message: decrementing more than available")); + + BOOST_REQUIRE_EQUAL(t.testbaldust("overflow1"_n), t.error("assertion failure with message: accumulation overflow")); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflow2"_n), t.error("assertion failure with message: accumulation overflow")); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflow3"_n), t.success()); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflow4"_n), t.error("assertion failure with message: accumulation overflow")); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflow5"_n), t.error("assertion failure with message: accumulation overflow")); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflowa"_n), t.error("assertion failure with message: accumulation overflow")); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflowb"_n), t.error("assertion failure with message: accumulation overflow")); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflowc"_n), t.error("assertion failure with message: accumulation overflow")); + BOOST_REQUIRE_EQUAL(t.testbaldust("overflowd"_n), t.error("assertion failure with message: accumulation overflow")); } FC_LOG_AND_RETHROW() BOOST_AUTO_TEST_SUITE_END()