summaryrefslogtreecommitdiff
path: root/test/buildtool/build_engine/base_maps/test_repo.hpp
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/build_engine/base_maps/test_repo.hpp
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/build_engine/base_maps/test_repo.hpp')
-rw-r--r--test/buildtool/build_engine/base_maps/test_repo.hpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/buildtool/build_engine/base_maps/test_repo.hpp b/test/buildtool/build_engine/base_maps/test_repo.hpp
index 1269d2da..82dd1fc5 100644
--- a/test/buildtool/build_engine/base_maps/test_repo.hpp
+++ b/test/buildtool/build_engine/base_maps/test_repo.hpp
@@ -28,8 +28,10 @@ static auto const kJsonTreeId =
[[nodiscard]] static inline auto CreateTestRepo()
-> 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 --bare {} {}", kBundlePath.string(), repo_path.string());
if (std::system(cmd.c_str()) == 0) {