[libc-commits] [libc] [libc][bazel] Append '/' to TEST_UNDECLARED_OUTPUTS_DIR (PR #207710)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Mon Jul 6 04:48:26 PDT 2026


https://github.com/labath created https://github.com/llvm/llvm-project/pull/207710

The environment variable does not end with a slash, so we need to add one. Without this, the tests work, but don't achieve the intended effect of writing to the undeclared outputs dir.

>From 6e02a02e595264b61922212565f3068246297cba Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Mon, 6 Jul 2026 11:43:22 +0000
Subject: [PATCH] [libc][bazel] Append '/' to TEST_UNDECLARED_OUTPUTS_DIR

The environment variable does not end with a slash, so we need to add
one. Without this, the tests work, but don't achieve the intended effect
of writing to the undeclared outputs dir.
---
 libc/test/UnitTest/BazelFilePath.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/test/UnitTest/BazelFilePath.cpp b/libc/test/UnitTest/BazelFilePath.cpp
index 7f9f42b46dca9..03ac56f083b9c 100644
--- a/libc/test/UnitTest/BazelFilePath.cpp
+++ b/libc/test/UnitTest/BazelFilePath.cpp
@@ -23,9 +23,9 @@ CString libc_make_test_file_path_func(const char *file_name) {
   // Do something sensible if not run under bazel, otherwise this may segfault
   // when constructing the string.
   if (UNDECLARED_OUTPUTS_PATH == nullptr)
-    UNDECLARED_OUTPUTS_PATH = "";
+    return cpp::string(file_name);
 
-  return cpp::string(UNDECLARED_OUTPUTS_PATH) + file_name;
+  return cpp::string(UNDECLARED_OUTPUTS_PATH) + "/" + file_name;
 }
 
 } // namespace testing



More information about the libc-commits mailing list