From 7e503da6c18c50e03d3cb1f5d7490f3c805f3b63 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Tue, 6 May 2025 16:31:00 +0200 Subject: Tests: Assume only parents of out_dirs exist ... instead of the full out_dir path, which is not guaranteed by the RBE protocol. --- test/buildtool/execution_api/common/api_test.hpp | 22 ++++++++++++---------- test/end-to-end/built-in-rules/generic_out_dirs.sh | 7 +++++-- .../end-to-end/remote-execution/native-protocol.sh | 2 +- test/end-to-end/remote-execution/split-splice.sh | 3 ++- test/end-to-end/target-cache/target-cache-hit.sh | 2 +- 5 files changed, 21 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp index 441c27b0..10f4e5a8 100644 --- a/test/buildtool/execution_api/common/api_test.hpp +++ b/test/buildtool/execution_api/common/api_test.hpp @@ -654,16 +654,18 @@ TestRetrieveFileAndSymlinkWithSameContentToPath(ApiFactory const& api_factory, auto output_path = std::filesystem::path{"foo/bar/baz"}; - auto action = api->CreateAction( - *api->UploadTree({}), - {"/bin/sh", - "-c", - fmt::format("set -e\n [ -d {} ]", output_path.string())}, - "", - {}, - {output_path}, - {}, - props); + auto action = + api->CreateAction(*api->UploadTree({}), + {"/bin/sh", + "-c", + fmt::format("set -e\n [ -d {} ]\n mkdir -p {}", + output_path.parent_path().string(), + output_path.string())}, + "", + {}, + {output_path}, + {}, + props); SECTION("Cache execution result in action cache") { action->SetCacheFlag(IExecutionAction::CacheFlag::CacheOutput); diff --git a/test/end-to-end/built-in-rules/generic_out_dirs.sh b/test/end-to-end/built-in-rules/generic_out_dirs.sh index c4dd81da..a2ad058d 100755 --- a/test/end-to-end/built-in-rules/generic_out_dirs.sh +++ b/test/end-to-end/built-in-rules/generic_out_dirs.sh @@ -21,7 +21,10 @@ mkdir -p lcl-build cat < TARGETS { "gen_out_dirs": - {"type": "generic", "cmds": ["echo foo > out/foo.txt"], "out_dirs": ["out"]} + { "type": "generic" + , "cmds": ["mkdir -p out", "echo foo > out/foo.txt"] + , "out_dirs": ["out"] + } , "read_out_dirs": { "type": "generic" , "cmds": ["cat out/foo.txt > bar.txt"] @@ -29,7 +32,7 @@ cat < TARGETS , "deps": ["gen_out_dirs"] } , "missing_outs_and_out_dirs": - {"type": "generic", "cmds": ["echo foo > out/foo.txt"]} + {"type": "generic", "cmds": ["mkdir -p out", "echo foo > out/foo.txt"]} , "out_dirs_contains_a_file": {"type": "generic", "cmds": ["echo foo > foo.txt"], "out_dirs": ["foo.txt"]} , "outs_contains_a_dir": diff --git a/test/end-to-end/remote-execution/native-protocol.sh b/test/end-to-end/remote-execution/native-protocol.sh index 00e1dd91..99ed1475 100644 --- a/test/end-to-end/remote-execution/native-protocol.sh +++ b/test/end-to-end/remote-execution/native-protocol.sh @@ -59,7 +59,7 @@ EOF cat > TARGETS < TARGETS <<'EOF' { "type": "generic" , "out_dirs": ["tree"] , "cmds": - [ "for i in $(seq 21846); do echo foo > tree/$(printf '%0192d' $i).txt; done" + [ "mkdir -p tree" + , "for i in $(seq 21846); do echo foo > tree/$(printf '%0192d' $i).txt; done" , "echo foo > tree/magic_word.txt" ] } diff --git a/test/end-to-end/target-cache/target-cache-hit.sh b/test/end-to-end/target-cache/target-cache-hit.sh index 929c9b20..ba52fec3 100644 --- a/test/end-to-end/target-cache/target-cache-hit.sh +++ b/test/end-to-end/target-cache/target-cache-hit.sh @@ -42,7 +42,7 @@ cat > TARGETS <