Adding local forking executor and associated tests

This commit is contained in:
Ian Roddis
2021-06-15 13:38:54 -03:00
parent 2cfe3e21d5
commit 81f0935f36
7 changed files with 147 additions and 10 deletions

View File

@@ -0,0 +1,29 @@
#include <iostream>
#include "daggy/executors/ForkingExecutor.hpp"
#include "catch.hpp"
TEST_CASE("Basic Execution", "[forking_executor]") {
daggy::executor::ForkingExecutor ex;
SECTION("Simple Run") {
std::vector<std::string> cmd{"/usr/bin/echo", "abc", "123"};
auto rec = ex.runCommand(cmd);
REQUIRE(rec.rc == 0);
REQUIRE(rec.output == "abc 123\n");
REQUIRE(rec.error.empty());
}
SECTION("Error Run") {
std::vector<std::string> cmd{"/usr/bin/expr", "1", "+", "+"};
auto rec = ex.runCommand(cmd);
REQUIRE(rec.rc == 2);
REQUIRE(rec.error == "/usr/bin/expr: syntax error: missing argument after +\n");
REQUIRE(rec.output.empty());
}
}