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{}, {}, 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