From 2ebf355989eb92ac9967eceee0af14d39477afe0 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Fri, 23 Feb 2024 18:51:51 +0100 Subject: just-mr: Fix shell out execution ... by avoiding reusing temp dirs for execute. While we are at it, also refactor LocalFetchViaTmpRepo() to create its own empty temp dirs, that cannot be reused by the caller. --- test/buildtool/file_system/git_repo.test.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'test/buildtool/file_system/git_repo.test.cpp') diff --git a/test/buildtool/file_system/git_repo.test.cpp b/test/buildtool/file_system/git_repo.test.cpp index e9992a97..26ebd8ce 100644 --- a/test/buildtool/file_system/git_repo.test.cpp +++ b/test/buildtool/file_system/git_repo.test.cpp @@ -405,12 +405,9 @@ TEST_CASE("Single-threaded fake repository operations", "[git_repo]") { CHECK_FALSE( *repo_fetch_all->CheckCommitExists(kRootCommit, logger)); - // create tmp dir to use for fetch - auto tmp_path_fetch_all = TestUtils::GetRepoPath(); - REQUIRE(FileSystemManager::CreateDirectory(tmp_path_fetch_all)); // fetch all with base refspecs REQUIRE(repo_fetch_all->LocalFetchViaTmpRepo( - tmp_path_fetch_all, *repo_path, std::nullopt, logger)); + *repo_path, std::nullopt, logger)); // check commit is there after fetch CHECK(*repo_fetch_all->CheckCommitExists(kRootCommit, logger)); @@ -427,12 +424,9 @@ TEST_CASE("Single-threaded fake repository operations", "[git_repo]") { CHECK_FALSE( *repo_fetch_branch->CheckCommitExists(kRootCommit, logger)); - // create tmp dir to use for fetch - auto tmp_path_fetch_branch = TestUtils::GetRepoPath(); - REQUIRE(FileSystemManager::CreateDirectory(tmp_path_fetch_branch)); // fetch branch REQUIRE(repo_fetch_branch->LocalFetchViaTmpRepo( - tmp_path_fetch_branch, *repo_path, "master", logger)); + *repo_path, "master", logger)); // check commit is there after fetch CHECK(*repo_fetch_branch->CheckCommitExists(kRootCommit, logger)); @@ -532,18 +526,9 @@ TEST_CASE("Multi-threaded fake repository operations", "[git_repo]") { auto remote_repo = GitRepo::Open(remote_cas); REQUIRE(remote_repo); REQUIRE(remote_repo->IsRepoFake()); - // set up tmp dir - // create tmp dir to use for fetch - auto tmp_path_fetch_branch = - TestUtils::GetRepoPath(); - REQUIRE(FileSystemManager::CreateDirectory( - tmp_path_fetch_branch)); // fetch all REQUIRE(remote_repo->LocalFetchViaTmpRepo( - tmp_path_fetch_branch, - *remote_repo_path, - std::nullopt, - logger)); + *remote_repo_path, std::nullopt, logger)); } break; } }, -- cgit v1.2.3