MCPcopy Create free account
hub / github.com/colmap/colmap / CreateTestDir

Function CreateTestDir

src/colmap/util/testing.cc:41–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39namespace colmap {
40
41std::filesystem::path CreateTestDir() {
42 const testing::TestInfo* test_info = THROW_CHECK_NOTNULL(
43 testing::UnitTest::GetInstance()->current_test_info());
44 std::ostringstream test_name_stream;
45 test_name_stream << test_info->test_suite_name() << "." << test_info->name();
46 const std::string test_name = test_name_stream.str();
47
48 const std::filesystem::path test_dir =
49 std::filesystem::temp_directory_path() / "colmap_test_data" / test_name;
50 LOG(INFO) << "Creating test directory: " << test_dir;
51
52 // Create directory once. Cleanup artifacts from previous test runs.
53 static std::mutex mutex;
54 std::lock_guard<std::mutex> lock(mutex);
55 static std::set<std::string> existing_test_names;
56 if (existing_test_names.count(test_name) == 0) {
57 if (std::filesystem::is_directory(test_dir)) {
58 std::filesystem::remove_all(test_dir);
59 }
60 std::filesystem::create_directories(test_dir);
61 }
62 existing_test_names.insert(test_name);
63
64 return test_dir;
65}
66
67} // namespace colmap

Callers 15

TESTFunction · 0.85
TEST_PFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
WriteTestConfigFunction · 0.85
TESTFunction · 0.85
TEST_PFunction · 0.85
TEST_PFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected