From 85938804a4a043c75cc4ca51a64ee789e55ba7cb Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 6 Jul 2023 14:29:27 +0200 Subject: filesystem: Avoid unwanted indirections... ...that std::filesystem::* calls produce. This is because existence and type checks use almost exclusively std::filesystem::status, which follows symbolic links, when being called with path arguments. Instead, one should instead use these methods with the value returned by a call of std::filesystem::symlink_status. This commit also streamlines the FileSystemManager tests, as well as replace bare calls to std::filesystem with their FileSystemManager counterparts (where suitable). --- test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/buildtool/execution_api') diff --git a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp index 2d7aa602..fde64e10 100644 --- a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp @@ -97,7 +97,8 @@ TEST_CASE("Bazel internals: MessageFactory", "[execution_api]") { for (auto const& digest : digests) { REQUIRE(fake_cas.contains(digest)); auto fpath = fake_cas[digest]; - if (std::filesystem::is_symlink(fpath)) { + if (FileSystemManager::IsNonUpwardsSymlink( + fpath, /*non_strict=*/true)) { auto content = FileSystemManager::ReadSymlink(fpath); REQUIRE(content); targets->emplace_back(*content); -- cgit v1.2.3