mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 06:53:58 +01:00
construct: Synchronize smoketest quit action with console command completion.
This commit is contained in:
parent
bae534d56b
commit
0492090b56
3 changed files with 24 additions and 6 deletions
|
@ -71,6 +71,9 @@ construct::console::seen_message;
|
||||||
decltype(construct::console::queue)
|
decltype(construct::console::queue)
|
||||||
construct::console::queue;
|
construct::console::queue;
|
||||||
|
|
||||||
|
decltype(construct::console::quit_when_done)
|
||||||
|
construct::console::quit_when_done;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
construct::console::spawn()
|
construct::console::spawn()
|
||||||
{
|
{
|
||||||
|
@ -155,6 +158,9 @@ try
|
||||||
if(!next_command())
|
if(!next_command())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if(quit_when_done)
|
||||||
|
ircd::post{ircd::quit};
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ struct construct::console
|
||||||
static const ircd::string_view console_message;
|
static const ircd::string_view console_message;
|
||||||
static std::once_flag seen_message;
|
static std::once_flag seen_message;
|
||||||
static std::deque<std::string> queue;
|
static std::deque<std::string> queue;
|
||||||
|
static bool quit_when_done;
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
std::string record_path;
|
std::string record_path;
|
||||||
|
|
|
@ -178,17 +178,28 @@ noexcept try
|
||||||
|
|
||||||
// The smoketest uses this ircd::run::level callback to set a flag when
|
// The smoketest uses this ircd::run::level callback to set a flag when
|
||||||
// each ircd::run::level is reached. All flags must be set to pass. The
|
// each ircd::run::level is reached. All flags must be set to pass. The
|
||||||
// smoketest is inert unless the -smoketest program option is used. Note
|
// smoketest is inert unless the -smoketest program option is used.
|
||||||
// the special case for run::level::RUN, which initiates the transition
|
|
||||||
// to QUIT; the ircd::post allows any operations queued in the io_context
|
|
||||||
// to run in case the smoketest isn't the only callback being invoked.
|
|
||||||
const ircd::run::changed smoketester
|
const ircd::run::changed smoketester
|
||||||
{
|
{
|
||||||
[](const auto &level)
|
[](const auto &level)
|
||||||
{
|
{
|
||||||
smoketest.at(size_t(level) + 1) = true;
|
smoketest.at(size_t(level) + 1) = true;
|
||||||
if(smoketest[0] && level == ircd::run::level::RUN)
|
if(!smoketest[0])
|
||||||
ircd::post {[] { ircd::quit(); }};
|
return;
|
||||||
|
|
||||||
|
if(level != ircd::run::level::RUN)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(construct::console::active())
|
||||||
|
{
|
||||||
|
construct::console::quit_when_done = true;
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
ircd::post
|
||||||
|
{
|
||||||
|
ircd::quit
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue