From 1d8321976c7634f80b7f878b4219899fe0748d70 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 27 Mar 2023 18:28:14 +0200 Subject: test: Make GitCAS thread-safety tests more strict Move the creation of a fake repository on top of an existing odb into the individual threads, to ensure the thread-safety of the operations on fake repositories is properly tested. --- test/buildtool/file_system/git_tree.test.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'test/buildtool/file_system/git_tree.test.cpp') diff --git a/test/buildtool/file_system/git_tree.test.cpp b/test/buildtool/file_system/git_tree.test.cpp index 7c5b53e3..1526e9c9 100644 --- a/test/buildtool/file_system/git_tree.test.cpp +++ b/test/buildtool/file_system/git_tree.test.cpp @@ -555,13 +555,14 @@ TEST_CASE("Thread-safety", "[git_tree]") { SECTION("Parsing same tree with same CAS") { auto cas = GitCAS::Open(*repo_path); REQUIRE(cas); - auto repo = GitRepo::Open(cas); - REQUIRE(repo); for (int id{}; id < kNumThreads; ++id) { - threads.emplace_back([&repo, &starting_signal]() { + threads.emplace_back([&cas, &starting_signal]() { starting_signal.wait(false); + auto repo = GitRepo::Open(cas); + REQUIRE(repo); + auto entries = repo->ReadTree(kTreeId, true); REQUIRE(entries); }); -- cgit v1.2.3