diff --git a/test/visual/run.cpp b/test/visual/run.cpp index f74d7db23..93e03b27c 100644 --- a/test/visual/run.cpp +++ b/test/visual/run.cpp @@ -36,6 +36,9 @@ #include #endif +#include +#include + #ifdef MAPNIK_LOG using log_levels_map = std::map; @@ -48,6 +51,23 @@ log_levels_map log_levels{{"debug", mapnik::logger::severity_type::debug}, using namespace visual_tests; namespace po = boost::program_options; +namespace { + +static std::random_device entropy; + +std::string unique_name() +{ + std::mt19937 gen(entropy()); + std::uniform_int_distribution<> distrib(0, 65535); + auto fmt = boost::format("%1$04x-%2$04x-%3$04x-%4$04x") + % distrib(gen) + % distrib(gen) + % distrib(gen) + %distrib(gen); + return fmt.str(); +} +} + runner::renderer_container create_renderers(po::variables_map const& args, fs::path const& output_dir, bool force_append = false) { @@ -189,7 +209,7 @@ int main(int argc, char** argv) if (vm.count("unique-subdir")) { - output_dir /= std::tmpnam(nullptr); + output_dir /= unique_name(); } config defaults;