diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-27 18:28:14 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-30 13:45:00 +0200 |
commit | 1d8321976c7634f80b7f878b4219899fe0748d70 (patch) | |
tree | b1f740fcd88f22f51baf7e3dce799e54d4a600c0 /test/buildtool/file_system/git_tree.test.cpp | |
parent | b1eeb28905d38231f5eda70148de0ebf8eb1cd8a (diff) | |
download | justbuild-1d8321976c7634f80b7f878b4219899fe0748d70.tar.gz |
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.
Diffstat (limited to 'test/buildtool/file_system/git_tree.test.cpp')
-rw-r--r-- | test/buildtool/file_system/git_tree.test.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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); }); |