From b9620f32973b523e6c7cef39ea4eac22654e428f Mon Sep 17 00:00:00 2001 From: SparkPlug0025 Date: Thu, 4 Nov 2021 10:17:09 -0400 Subject: [PATCH 1/2] Implement runner checkpoint option --- .../eden/tests/include/nodeos-runner.hpp | 26 +++++++++++++++++++ contracts/eden/tests/run-full-election.cpp | 4 +-- contracts/eden/tests/run-genesis.cpp | 2 -- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/contracts/eden/tests/include/nodeos-runner.hpp b/contracts/eden/tests/include/nodeos-runner.hpp index f75ccedeb..559692da6 100644 --- a/contracts/eden/tests/include/nodeos-runner.hpp +++ b/contracts/eden/tests/include/nodeos-runner.hpp @@ -2,6 +2,23 @@ #include +#define CATCH_CONFIG_RUNNER + +std::string runner_checkpoint; + +int main(int argc, char* argv[]) +{ + Catch::Session session; + auto cli = + session.cli() | Catch::clara::Opt(runner_checkpoint, "checkpoint")["-c"]["--checkpoint"]( + "Stops execution at the given checkpoint label."); + session.cli(cli); + auto ret = session.applyCommandLine(argc, argv); + if (ret) + return ret; + return session.run(); +} + struct nodeos_runner { eden_tester tester; @@ -9,6 +26,15 @@ struct nodeos_runner nodeos_runner(std::string runner_name) : runner_name(runner_name) {} + void checkpoint(const std::string& checkpoint) + { + if (runner_checkpoint == checkpoint) + { + start_nodeos(); + exit(0); + } + } + void start_nodeos() { // tolerance blocks diff --git a/contracts/eden/tests/run-full-election.cpp b/contracts/eden/tests/run-full-election.cpp index 7296ad2f4..d2ad76af5 100644 --- a/contracts/eden/tests/run-full-election.cpp +++ b/contracts/eden/tests/run-full-election.cpp @@ -1,5 +1,3 @@ -#define CATCH_CONFIG_MAIN - #include TEST_CASE("Setup Eden chain with full election") @@ -8,7 +6,9 @@ TEST_CASE("Setup Eden chain with full election") r.tester.genesis(); r.tester.run_election(true, 10000, true); + r.checkpoint("small_election"); r.tester.induct_n(100); + r.checkpoint("inductions"); r.tester.run_election(true, 10000, true); r.start_nodeos(); diff --git a/contracts/eden/tests/run-genesis.cpp b/contracts/eden/tests/run-genesis.cpp index 8a244d769..260d54349 100644 --- a/contracts/eden/tests/run-genesis.cpp +++ b/contracts/eden/tests/run-genesis.cpp @@ -1,5 +1,3 @@ -#define CATCH_CONFIG_MAIN - #include TEST_CASE("Setup Eden chain with basic completed genesis") From 0ac0cbf7d54fd91e3b3a9cdade9cc78fe3fe4052 Mon Sep 17 00:00:00 2001 From: SparkPlug0025 Date: Tue, 9 Nov 2021 07:02:29 -0500 Subject: [PATCH 2/2] Add proper address ips on nodeos runner --- contracts/eden/tests/include/nodeos-runner.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/eden/tests/include/nodeos-runner.hpp b/contracts/eden/tests/include/nodeos-runner.hpp index 559692da6..3b07ccf72 100644 --- a/contracts/eden/tests/include/nodeos-runner.hpp +++ b/contracts/eden/tests/include/nodeos-runner.hpp @@ -58,6 +58,8 @@ struct nodeos_runner "--access-control-allow-origin \"*\" " // "--access-control-allow-header \"*\" " // "--http-validate-host 0 " // + "--http-server-address 0.0.0.0:8888 " // + "--state-history-endpoint 0.0.0.0:8080 " // "-e -p eosio"); } -}; +}; \ No newline at end of file