summaryrefslogtreecommitdiff
path: root/test/buildtool/file_system/git_repo.test.cpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2024-02-23 18:51:51 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2024-03-08 14:16:45 +0100
commit2ebf355989eb92ac9967eceee0af14d39477afe0 (patch)
treedb993f8df39eb05b625b2c4590f1e5696b2e7b04 /test/buildtool/file_system/git_repo.test.cpp
parentc512ae174920ada425e2b33d0fea24891d6305bd (diff)
downloadjustbuild-2ebf355989eb92ac9967eceee0af14d39477afe0.tar.gz
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.
Diffstat (limited to 'test/buildtool/file_system/git_repo.test.cpp')
-rw-r--r--test/buildtool/file_system/git_repo.test.cpp21
1 files changed, 3 insertions, 18 deletions
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;
}
},