Skip to content

Commit

Permalink
Implement runner checkpoint option
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkplug0025 committed Nov 9, 2021
1 parent 0cf518f commit b9620f3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
26 changes: 26 additions & 0 deletions contracts/eden/tests/include/nodeos-runner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,39 @@

#include <tester-base.hpp>

#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;
std::string runner_name;

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
Expand Down
4 changes: 2 additions & 2 deletions contracts/eden/tests/run-full-election.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define CATCH_CONFIG_MAIN

#include <nodeos-runner.hpp>

TEST_CASE("Setup Eden chain with full election")
Expand All @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions contracts/eden/tests/run-genesis.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define CATCH_CONFIG_MAIN

#include <nodeos-runner.hpp>

TEST_CASE("Setup Eden chain with basic completed genesis")
Expand Down

0 comments on commit b9620f3

Please sign in to comment.