[libc-commits] [libc] [libc][realpath][test] Create test files/directories (PR #209369)
Jackson Stogel via libc-commits
libc-commits at lists.llvm.org
Fri Jul 17 10:54:29 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.";
----------------
jtstogel wrote:
Unfortunately `clock_gettime` is a full-build-only function, which would mean that realpath tests would not be eligible for overlay testing. Instead, I updated the PR to call `getrandom` and fill in some random bytes.
https://github.com/llvm/llvm-project/pull/209369
More information about the libc-commits
mailing list