summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildtool/common/action.hpp26
-rw-r--r--test/buildtool/execution_engine/dag/dag.test.cpp8
-rw-r--r--test/buildtool/execution_engine/executor/executor_api.test.hpp5
3 files changed, 33 insertions, 6 deletions
diff --git a/src/buildtool/common/action.hpp b/src/buildtool/common/action.hpp
index 4a4be183..92342eb8 100644
--- a/src/buildtool/common/action.hpp
+++ b/src/buildtool/common/action.hpp
@@ -85,6 +85,12 @@ class Action {
[[nodiscard]] auto IsTreeAction() const noexcept -> bool {
return is_tree_;
}
+ [[nodiscard]] auto IsTreeOverlayAction() const noexcept -> bool {
+ return is_tree_overlay_;
+ }
+ [[nodiscard]] auto IsOverlayDisjoint() const noexcept -> bool {
+ return overlay_disjoint_;
+ }
[[nodiscard]] auto MayFail() const noexcept
-> std::optional<std::string> const& {
return may_fail_;
@@ -106,7 +112,14 @@ class Action {
[[nodiscard]] static auto CreateTreeAction(
ActionIdentifier const& id) noexcept -> Action {
- return Action{id};
+ return Action{
+ id, /*is_tree_overlay=*/false, /*overlay_disjoint=*/false};
+ }
+
+ [[nodiscard]] static auto CreateTreeOverlayAction(
+ ActionIdentifier const& id,
+ bool disjoint) noexcept -> Action {
+ return Action{id, /*is_tree_overlay=*/true, disjoint};
}
private:
@@ -115,13 +128,20 @@ class Action {
std::string cwd_;
std::map<std::string, std::string> env_;
bool is_tree_{};
+ bool is_tree_overlay_{};
+ bool overlay_disjoint_{};
std::optional<std::string> may_fail_;
bool no_cache_{};
double timeout_scale_{};
std::map<std::string, std::string> execution_properties_;
- explicit Action(ActionIdentifier id) noexcept
- : id_{std::move(id)}, is_tree_{true} {}
+ explicit Action(ActionIdentifier id,
+ bool is_tree_overlay,
+ bool overlay_disjoint) noexcept
+ : id_{std::move(id)},
+ is_tree_{not is_tree_overlay},
+ is_tree_overlay_{is_tree_overlay},
+ overlay_disjoint_{overlay_disjoint} {}
};
#endif // INCLUDED_SRC_BUILDTOOL_COMMON_ACTION_HPP
diff --git a/test/buildtool/execution_engine/dag/dag.test.cpp b/test/buildtool/execution_engine/dag/dag.test.cpp
index 8bf188ee..fbd79ec2 100644
--- a/test/buildtool/execution_engine/dag/dag.test.cpp
+++ b/test/buildtool/execution_engine/dag/dag.test.cpp
@@ -287,14 +287,18 @@ TEST_CASE("Add executable and library", "[dag]") {
TEST_CASE("AddAction(id, empty action description) fails", "[dag]") {
DependencyGraph g;
- CHECK(not g.AddAction(ActionDescription{{}, {}, Action{"id", {}, {}}, {}}));
+ CHECK(not g.AddAction(ActionDescription{
+ {}, {}, Action{"id", std::vector<std::string>{}, {}}, {}}));
}
TEST_CASE("AddAction(Empty mandatory non-empty field in action description)",
"[dag]") {
DependencyGraph g;
CHECK(not g.AddAction(ActionDescription{
- {"output0", "output1"}, {}, Action{"empty command", {}, {}}, {}}));
+ {"output0", "output1"},
+ {},
+ Action{"empty command", std::vector<std::string>{}, {}},
+ {}}));
CHECK(not g.AddAction(ActionDescription{
{}, {}, Action{"empty output", {"echo", "hello"}, {}}, {}}));
}
diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp
index 8ec43fb0..2043da88 100644
--- a/test/buildtool/execution_engine/executor/executor_api.test.hpp
+++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp
@@ -556,7 +556,10 @@ static inline void TestUploadAndDownloadTrees(
SECTION("Dot-path non-tree as action input") {
auto action_inputs = ActionDescription::inputs_t{{".", foo_desc}};
ActionDescription action_desc{
- {"foo"}, {}, Action{"action_id", {"echo"}, {}}, action_inputs};
+ {"foo"},
+ {},
+ Action{"action_id", std::vector<std::string>{"echo"}, {}},
+ action_inputs};
REQUIRE(g.Add({action_desc}));
auto const* action_node = g.ActionNodeWithId("action_id");