summaryrefslogtreecommitdiff
path: root/test/buildtool/file_system/git_tree.test.cpp
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2022-02-28 13:29:17 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2022-02-28 14:11:54 +0100
commit5581e163c36003a78f283e585f5338ecd3327a35 (patch)
treeb7a51167489dc6b64156fdbcbf56dfe342f1ffeb /test/buildtool/file_system/git_tree.test.cpp
parent01a6119ffd561cdec42ffeff827e72e1af1ae1ce (diff)
downloadjustbuild-5581e163c36003a78f283e585f5338ecd3327a35.tar.gz
Tests: Avoid std::tmpnam as it is considered unsafe
... and therefore produces linker warnings.
Diffstat (limited to 'test/buildtool/file_system/git_tree.test.cpp')
-rw-r--r--test/buildtool/file_system/git_tree.test.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/buildtool/file_system/git_tree.test.cpp b/test/buildtool/file_system/git_tree.test.cpp
index caaba96a..a3baf4ac 100644
--- a/test/buildtool/file_system/git_tree.test.cpp
+++ b/test/buildtool/file_system/git_tree.test.cpp
@@ -30,8 +30,10 @@ auto const kFailId = std::string{"0123456789abcdef0123456789abcdef01234567"};
[[nodiscard]] auto CreateTestRepo(bool is_bare = false)
-> std::optional<std::filesystem::path> {
- auto repo_path = GetTestDir() / "test_repo" /
- std::filesystem::path{std::tmpnam(nullptr)}.filename();
+ static std::atomic<int> counter{};
+ auto repo_path =
+ GetTestDir() / "test_repo" /
+ std::filesystem::path{std::to_string(counter++)}.filename();
auto cmd = fmt::format("git clone {}{} {}",
is_bare ? "--bare " : "",
kBundlePath,