Index: llvm/unittests/Support/Path.cpp =================================================================== --- llvm/unittests/Support/Path.cpp +++ llvm/unittests/Support/Path.cpp @@ -701,10 +701,14 @@ } }; - // We should be able to create exactly 16 temporary files. - for (int i = 0; i < 16; ++i) - EXPECT_TRUE(TryCreateTempFile()); - EXPECT_FALSE(TryCreateTempFile()); + // Our single-character template allows for 16 unique names. Check that + // attempting to generate 17 results in TryCreateTempFile returning false + // (rather than something less desirable, such as infinite looping). + // This may happen before the 17th attempt due to the way names are generated. + bool Succeeded = true; + for (int i = 0; i < 17; ++i) + if (TryCreateTempFile()) Succeeded = false; + EXPECT_FALSE(Succeeded); for (fs::TempFile &T : TempFiles) cantFail(T.discard());