[libc-commits] [libc] [libc][realpath][test] Create test files/directories (PR #209369)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Thu Jul 16 12:53:52 PDT 2026


================
@@ -39,6 +164,32 @@ class LlvmLibcRealpathTest : public LIBC_NAMESPACE::testing::ErrnoCheckingTest {
     return realpath_buffered(path.c_str());
   }
 
+  // Creates a test directory in dst. Returns true if successful.
+  //
+  // While we would prefer to return cpp::optional<TestDir> here,
+  // LLVM-libc's optional expects types to be trivially destructible.
+  [[nodiscard]] bool create_test_dir(const char *name, TestDir &dst) {
+    // Use /tmp instead of the typical libc_make_test_file_path to ensure
+    // the path is absolute and does not contain symlinks.
+    cpp::string test_dir_path = "/tmp/LlvmLibcRealpathTest.";
----------------
kaladron wrote:

Can you please add a timestamp to the PID for this so that PID reuse on a buildbot doesn't cause flake?

https://github.com/llvm/llvm-project/pull/209369


More information about the libc-commits mailing list