Skip to content

Conversation

mstorsjo
Copy link
Member

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.

…onment 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.
@llvmbot
Copy link
Member

llvmbot commented Sep 23, 2025

@llvm/pr-subscribers-llvm-support

Author: Martin Storsjö (mstorsjo)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/160277.diff

1 Files Affected:

  • (modified) llvm/unittests/Support/ProgramTest.cpp (+7)
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

@mstorsjo mstorsjo merged commit ebe182d into llvm:main Sep 23, 2025
11 checks passed
@mstorsjo mstorsjo deleted the win-test-empty-env-mingw branch September 23, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants