diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-24 12:48:33 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-24 16:16:38 +0200 |
commit | 33c576f9730da83752b2211efa4752c7f7d3d9af (patch) | |
tree | 92dab9f0f8164b768315ba4d24dd674cf48d53ee /test/buildtool/execution_api/local/local_execution.test.cpp | |
parent | 6090ba03c031f7126f0acd5bd89fb895b73eb50f (diff) | |
download | justbuild-33c576f9730da83752b2211efa4752c7f7d3d9af.tar.gz |
Clarify use of a clang-tidy check
The google-default-arguments check normally imposes that virtual
methods have no default arguments. For our use-cases, all
implementations of such methods are expected to use the same
default arguments, and thus this check is manually disabled via
NOLINT comments. However, this is not done consistently.
This commit cleans this up and clarifies our intent by:
- removing the default values (and the NOLINT statement) for all
implementations of virtual methods with default argument values,
matching the desired intended behaviour, but
- keeping the clang-tidy check for future cases where derived
classes would want to provide each different defaults.
Diffstat (limited to 'test/buildtool/execution_api/local/local_execution.test.cpp')
-rw-r--r-- | test/buildtool/execution_api/local/local_execution.test.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/test/buildtool/execution_api/local/local_execution.test.cpp b/test/buildtool/execution_api/local/local_execution.test.cpp index e1fbec99..d4e4e354 100644 --- a/test/buildtool/execution_api/local/local_execution.test.cpp +++ b/test/buildtool/execution_api/local/local_execution.test.cpp @@ -50,6 +50,8 @@ namespace { +constexpr bool kLegacyApi = false; // do not force legacy api logic + [[nodiscard]] auto GetTestDir() -> std::filesystem::path { auto* tmp_dir = std::getenv("TEST_TMPDIR"); if (tmp_dir != nullptr) { @@ -95,8 +97,8 @@ TEST_CASE("LocalExecution: No input, no output", "[execution_api]") { std::string test_content("test"); std::vector<std::string> const cmdline = {"echo", "-n", test_content}; - auto action = - api.CreateAction(*api.UploadTree({}), cmdline, "", {}, {}, {}, {}); + auto action = api.CreateAction( + *api.UploadTree({}), cmdline, "", {}, {}, {}, {}, kLegacyApi); REQUIRE(action); SECTION("Cache execution result in action cache") { @@ -155,7 +157,8 @@ TEST_CASE("LocalExecution: No input, no output, env variables used", {}, {}, {{"MYCONTENT", test_content}}, - {}); + {}, + kLegacyApi); REQUIRE(action); SECTION("Cache execution result in action cache") { @@ -215,8 +218,14 @@ TEST_CASE("LocalExecution: No input, create output", "[execution_api]") { "-c", "set -e\necho -n " + test_content + " > " + output_path}; - auto action = api.CreateAction( - *api.UploadTree({}), cmdline, "", {output_path}, {}, {}, {}); + auto action = api.CreateAction(*api.UploadTree({}), + cmdline, + "", + {output_path}, + {}, + {}, + {}, + kLegacyApi); REQUIRE(action); SECTION("Cache execution result in action cache") { @@ -296,7 +305,8 @@ TEST_CASE("LocalExecution: One input copied to output", "[execution_api]") { {output_path}, {}, {}, - {}); + {}, + kLegacyApi); REQUIRE(action); SECTION("Cache execution result in action cache") { @@ -358,8 +368,8 @@ TEST_CASE("LocalExecution: Cache failed action's result", "[execution_api]") { std::vector<std::string> const cmdline = { "sh", "-c", fmt::format("[ -f '{}' ]", flag.string())}; - auto action = - api.CreateAction(*api.UploadTree({}), cmdline, "", {}, {}, {}, {}); + auto action = api.CreateAction( + *api.UploadTree({}), cmdline, "", {}, {}, {}, {}, kLegacyApi); REQUIRE(action); action->SetCacheFlag(IExecutionAction::CacheFlag::CacheOutput); |