Пример #1
0
#include "util/Timer.h"
#include "xdrpp/autocheck.h"
#include <chrono>
#include <future>
#include <thread>

using namespace stellar;

TEST_CASE("subprocess", "[process]")
{
    VirtualClock clock;
    Config const& cfg = getTestConfig();
    Application::pointer app = createTestApplication(clock, cfg);
    bool exited = false;
    bool failed = false;
    auto evt = app->getProcessManager().runProcess("hostname");
    evt.async_wait([&](asio::error_code ec) {
        CLOG(DEBUG, "Process") << "process exited: " << ec;
        if (ec)
        {
            CLOG(DEBUG, "Process") << "error code: " << ec.message();
        }
        failed = !!ec;
        exited = true;
    });

    while (!exited && !clock.getIOContext().stopped())
    {
        clock.crank(true);
    }
    REQUIRE(!failed);
Пример #2
0
#include "util/Timer.h"
#include "xdrpp/autocheck.h"
#include <chrono>
#include <future>
#include <thread>

using namespace stellar;

TEST_CASE("subprocess", "[process]")
{
    VirtualClock clock;
    Config const& cfg = getTestConfig();
    Application::pointer app = createTestApplication(clock, cfg);
    bool exited = false;
    bool failed = false;
    auto evt = app->getProcessManager().runProcess("hostname", "").lock();
    REQUIRE(evt);
    evt->async_wait([&](asio::error_code ec) {
        CLOG(DEBUG, "Process") << "process exited: " << ec;
        if (ec)
        {
            CLOG(DEBUG, "Process") << "error code: " << ec.message();
        }
        failed = !!ec;
        exited = true;
    });

    while (!exited && !clock.getIOContext().stopped())
    {
        clock.crank(true);
    }