< prev index next >

test/native/logging/logTestUtils.inline.hpp

Print this page
rev 12435 : 8170936: Logging: LogFileOutput.invalid_file_test crashes when executed twice.
Reviewed-by: duke

@@ -57,10 +57,24 @@
   failed = mkdir(name, 0777);
 #endif
   assert(!failed, "failed to create directory %s", name);
 }
 
+static inline void delete_empty_directory(const char* name) {
+#ifdef _WINDOWS
+  if (!file_exists(name)) {
+    return;
+  }
+  bool failed;
+  failed = !RemoveDirectory(name);
+  EXPECT_FALSE(failed) << "failed to remove directory '" << name
+          << "': LastError = " << GetLastError();
+#else
+  delete_file(name);
+#endif
+}
+
 static inline void init_log_file(const char* filename, const char* options = "") {
   LogStreamHandle(Error, logging) stream;
   bool success = LogConfiguration::parse_log_arguments(filename, "logging=trace", "", options, &stream);
   guarantee(success, "Failed to initialize log file '%s' with options '%s'", filename, options);
   log_debug(logging)("%s", LOG_TEST_STRING_LITERAL);
< prev index next >