[llvm] d0ea8a8 - [unittests] Fix a recent test on Windows with LLVM_WINDOWS_PREFER_FORWARD_SLASH (#224963)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 13:38:27 PDT 2026
Author: Martin Storsjö
Date: 2026-09-27T23:38:21+03:00
New Revision: d0ea8a8e46091f71684091f48412ce500165d76f
URL: https://github.com/llvm/llvm-project/commit/d0ea8a8e46091f71684091f48412ce500165d76f
DIFF: https://github.com/llvm/llvm-project/commit/d0ea8a8e46091f71684091f48412ce500165d76f.diff
LOG: [unittests] Fix a recent test on Windows with LLVM_WINDOWS_PREFER_FORWARD_SLASH (#224963)
This fixes errors like these:
```
Expected equality of these values:
Context.Path
Which is: "D:/a/llvm-mingw/llvm-mingw/llvm-project/build/unittests/Support/LLVMToolSession/./LLVMToolSessionTests.exe"
ExecutablePath.c_str()
Which is: "D:\\a\\llvm-mingw\\llvm-mingw\\llvm-project\\build\\unittests\\Support\\LLVMToolSession\\.\\LLVMToolSessionTests.exe"
```
Added:
Modified:
llvm/unittests/Support/LLVMToolSession/LLVMToolSessionTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Support/LLVMToolSession/LLVMToolSessionTest.cpp b/llvm/unittests/Support/LLVMToolSession/LLVMToolSessionTest.cpp
index d1ef91444c2f7..e0252324ed403 100644
--- a/llvm/unittests/Support/LLVMToolSession/LLVMToolSessionTest.cpp
+++ b/llvm/unittests/Support/LLVMToolSession/LLVMToolSessionTest.cpp
@@ -58,7 +58,9 @@ int resetOptionsMain(int, char **, const ToolContext &) {
int directMain(int Argc, char **Argv, const ToolContext &Context) {
EXPECT_EQ(Argc, 1);
EXPECT_STREQ(Argv[0], ExecutablePath.c_str());
- EXPECT_STREQ(Context.Path, ExecutablePath.c_str());
+ SmallString<32> ExecutablePathBuf(ExecutablePath);
+ sys::path::make_preferred(ExecutablePathBuf);
+ EXPECT_STREQ(Context.Path, ExecutablePathBuf.c_str());
EXPECT_FALSE(Context.NeedsPrependArg);
return 0;
}
More information about the llvm-commits
mailing list