From 5581e163c36003a78f283e585f5338ecd3327a35 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Mon, 28 Feb 2022 13:29:17 +0100 Subject: Tests: Avoid std::tmpnam as it is considered unsafe ... and therefore produces linker warnings. --- test/buildtool/file_system/file_root.test.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/buildtool/file_system/file_root.test.cpp') diff --git a/test/buildtool/file_system/file_root.test.cpp b/test/buildtool/file_system/file_root.test.cpp index a934161b..b0dad5d1 100644 --- a/test/buildtool/file_system/file_root.test.cpp +++ b/test/buildtool/file_system/file_root.test.cpp @@ -1,3 +1,4 @@ +#include #include #include "catch2/catch.hpp" @@ -24,8 +25,10 @@ auto const kBarId = std::string{"ba0e162e1c47469e3fe4b393a8bf8c569f302116"}; [[nodiscard]] auto CreateTestRepo(bool do_checkout = false) -> std::optional { - auto repo_path = GetTestDir() / "test_repo" / - std::filesystem::path{std::tmpnam(nullptr)}.filename(); + static std::atomic counter{}; + auto repo_path = + GetTestDir() / "test_repo" / + std::filesystem::path{std::to_string(counter++)}.filename(); auto cmd = fmt::format("git clone {}{} {}", do_checkout ? "--branch master " : "", kBundlePath, -- cgit v1.2.3