summaryrefslogtreecommitdiffhomepage
path: root/test/util/temp_path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/util/temp_path.cc')
-rw-r--r--test/util/temp_path.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/test/util/temp_path.cc b/test/util/temp_path.cc
index e1bdee7fd..11399f372 100644
--- a/test/util/temp_path.cc
+++ b/test/util/temp_path.cc
@@ -34,20 +34,6 @@ namespace {
std::atomic<uint64_t> global_temp_file_number = ATOMIC_VAR_INIT(1);
-// Return a new temp filename, intended to be unique system-wide.
-//
-// The global file number helps maintain file naming consistency across
-// different runs of a test.
-//
-// The timestamp is necessary because the test infrastructure invokes each
-// test case in a separate process (resetting global_temp_file_number) and
-// potentially in parallel, which allows for races between selecting and using a
-// name.
-std::string NextTempBasename() {
- return absl::StrCat("gvisor_test_temp_", global_temp_file_number++, "_",
- absl::ToUnixNanos(absl::Now()));
-}
-
void TryDeleteRecursively(std::string const& path) {
if (!path.empty()) {
int undeleted_dirs = 0;
@@ -85,6 +71,18 @@ std::string GetAbsoluteTestTmpdir() {
return MakeAbsolute(tmp_dir, "").ValueOrDie();
}
+// The global file number helps maintain file naming consistency across
+// different runs of a test.
+//
+// The timestamp is necessary because the test infrastructure invokes each
+// test case in a separate process (resetting global_temp_file_number) and
+// potentially in parallel, which allows for races between selecting and using a
+// name.
+std::string NextTempBasename() {
+ return absl::StrCat("gvisor_test_temp_", global_temp_file_number++, "_",
+ absl::ToUnixNanos(absl::Now()));
+}
+
PosixErrorOr<TempPath> TempPath::CreateFileWith(absl::string_view const parent,
absl::string_view const content,
mode_t const mode) {