[llvm] [SupportTests] Waive failures in ProgramEnvTest.TestExecuteEmptyEnvironment on MinGW (PR #160277)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 04:17:42 PDT 2025


https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/160277

In MinGW build configurations, built executables often can end up depending on a DLL for libstdc++ or libc++. This DLL typicall isn't installed system wide, but is either installed in the same directory as the executables, or found through PATH.

If this dependency DLL has to be found through PATH, this test fails when attempting to execute the SupportTests executable with an empty environment.

Waive the failure to execute the executable in this case.

>From 59bf81bf7703b1dc08b8e9954e790fe850dc6c3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Tue, 23 Sep 2025 14:16:56 +0300
Subject: [PATCH] [SupportTests] Waive failures in
 ProgramEnvTest.TestExecuteEmptyEnvironment on MinGW

In MinGW build configurations, built executables often can end up
depending on a DLL for libstdc++ or libc++. This DLL typicall isn't
installed system wide, but is either installed in the same directory
as the executables, or found through PATH.

If this dependency DLL has to be found through PATH, this test fails
when attempting to execute the SupportTests executable with an empty
environment.

Waive the failure to execute the executable in this case.
---
 llvm/unittests/Support/ProgramTest.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/llvm/unittests/Support/ProgramTest.cpp b/llvm/unittests/Support/ProgramTest.cpp
index eac0246d8c59e..13a142fcb0624 100644
--- a/llvm/unittests/Support/ProgramTest.cpp
+++ b/llvm/unittests/Support/ProgramTest.cpp
@@ -695,7 +695,14 @@ TEST_F(ProgramEnvTest, TestExecuteEmptyEnvironment) {
   int RetCode = ExecuteAndWait(Executable, argv, ArrayRef<StringRef>{}, {}, 0,
                                0, &Error, &ExecutionFailed);
   EXPECT_FALSE(ExecutionFailed) << Error;
+#ifndef __MINGW32__
+  // When running with an empty environment, the child process doesn't in herit
+  // the PATH variable. On MinGW, it is common for executables to require a
+  // shared libstdc++ or libc++ DLL, which may be in PATH but not in the
+  // directory of SupportTests.exe - leading to STATUS_DLL_NOT_FOUND errors.
+  // Therefore, waive this failure in MinGW environments.
   ASSERT_EQ(0, RetCode);
+#endif
 }
 
 } // end anonymous namespace



More information about the llvm-commits mailing list