[Lldb-commits] [lldb] r334702 - Fix PathMappingListTest on windows

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 14 03:31:07 PDT 2018


Author: labath
Date: Thu Jun 14 03:31:06 2018
New Revision: 334702

URL: http://llvm.org/viewvc/llvm-project?rev=334702&view=rev
Log:
Fix PathMappingListTest on windows

r334615 changed the the value of FileSpec.IsRelative("/") for windows
path syntax. We previously considered it absolute but now it is
considered relative (I guess because it's interpretation depends on the
current drive).

This cause a failure in PathMappingList test, which assumed that "/"
will not get remapped as it is an absolute path. As this is no longer
true on windows, I replace "/" with a really absolute path.

Modified:
    lldb/trunk/unittests/Target/PathMappingListTest.cpp

Modified: lldb/trunk/unittests/Target/PathMappingListTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Target/PathMappingListTest.cpp?rev=334702&r1=334701&r2=334702&view=diff
==============================================================================
--- lldb/trunk/unittests/Target/PathMappingListTest.cpp (original)
+++ lldb/trunk/unittests/Target/PathMappingListTest.cpp Thu Jun 14 03:31:06 2018
@@ -29,9 +29,12 @@ static void TestPathMappings(const PathM
                              llvm::ArrayRef<ConstString> fails) {
   ConstString actual_remapped;
   for (const auto &fail : fails) {
-    EXPECT_FALSE(map.RemapPath(fail, actual_remapped));
+    SCOPED_TRACE(fail.GetCString());
+    EXPECT_FALSE(map.RemapPath(fail, actual_remapped))
+        << "actual_remapped: " << actual_remapped.GetCString();
   }
   for (const auto &match : matches) {
+    SCOPED_TRACE(match.original.GetPath() + " -> " + match.remapped.GetPath());
     std::string orig_normalized = match.original.GetPath();
     EXPECT_TRUE(
         map.RemapPath(ConstString(match.original.GetPath()), actual_remapped));
@@ -54,8 +57,13 @@ TEST(PathMappingListTest, RelativeTests)
     {"bar/foo.c", "/tmp/bar/foo.c"},
   };
   ConstString fails[] = {
-    ConstString("/a"),
-    ConstString("/"),
+#ifdef _WIN32
+      ConstString("C:\\"),
+      ConstString("C:\\a"),
+#else
+      ConstString("/a"),
+      ConstString("/"),
+#endif
   };
   PathMappingList map;
   map.Append(ConstString("."), ConstString("/tmp"), false);




More information about the lldb-commits mailing list