fix: CLI11 integration

* Run 'sparkd tests' outside of the CLI::App framework
  (delegate to 'catch', which has a solid cli).  This
  fixes a bug which prevented callers from specifying
  test tags (in the form of '[<tag>]'), as the CLI::App's
  parse method removes square brackets from cli options.

* Bind cli options to instance members of their subcommand's
  CLI::App derived class.  This seems to fix a bug which caused
  the [static instance] binding source to be destructed twice.

 * Add help text for several subcommands
This commit is contained in:
John Colvin committed 2021-01-16 00:01:15 -06:00
1 parent 45de55a552
commit ca4e477f56
61 files changed
+841 -742

No files matched your search

+34 -36
View File
@@ -565,49 +565,47 @@ struct TestRunner {
}
};
static void execute() {
// Typically a timestamp
SessionSaver ss;
ss.load();
Config config{"NGG", "004", false, [](auto, auto, auto) {}};
IL3Reactor reactor;
IL3MessageFramer framer;
auto &connection = reactor.register_connection(
{// local dev tunnel
TCPEndpoint{"127.0.0.1", 64530}, TCPEndpoint{"127.0.0.1", 64531},
// Direct connection
TCPEndpoint{"69.50.112.199", 64530},
TCPEndpoint{"69.50.12.205", 64530}});
CMECert::CMECert() : CLI::App("Tool to drive CME Cert", "cme-cert") {
callback([] {
// Typically a timestamp
SessionSaver ss;
ss.load();
Config config{"NGG", "004", false, [](auto, auto, auto) {}};
IL3Reactor reactor;
IL3MessageFramer framer;
auto &connection = reactor.register_connection(
{// local dev tunnel
TCPEndpoint{"127.0.0.1", 64530}, TCPEndpoint{"127.0.0.1", 64531},
// Direct connection
TCPEndpoint{"69.50.112.199", 64530},
TCPEndpoint{"69.50.12.205", 64530}});
// NGG primary - 69.50.112.199 64530
// NGG backup - 69.50.112.205 64530
// NGG primary - 69.50.112.199 64530
// NGG backup - 69.50.112.205 64530
IL3GW gw(connection, framer, nullptr, ss.current, config, {});
gw.subscribe_session([&](auto &s) { ss.session_changed(s); });
gw.connect();
IL3GW gw(connection, framer, nullptr, ss.current, config, {});
gw.subscribe_session([&](auto &s) { ss.session_changed(s); });
gw.connect();
TestRunner run(reactor, gw);
TestRunner run(reactor, gw);
///////////////////////////
//
// The current test
//
///////////////////////////
///////////////////////////
//
// The current test
//
///////////////////////////
run.scratch_space();
run.scratch_space();
///////////////////////////
///////////////////////////
for (auto x = 0; x < 5; ++x) {
reactor.do_work();
sleep(1);
}
gw.send_terminate();
gw.flush();
}
void CMECert::register_cmd(CLI::App &app) {
app.add_subcommand("cme-cert", "Tool to drive CME Cert")->callback(execute);
for (auto x = 0; x < 5; ++x) {
reactor.do_work();
sleep(1);
}
gw.send_terminate();
gw.flush();
});
}
} // namespace bts::cmds