[lldb] Fix unit test parsing to handle CR+LF as well as LF
authorAdrian McCarthy <amccarth@google.com>
Wed, 12 Aug 2020 20:50:28 +0000 (13:50 -0700)
committerAdrian McCarthy <amccarth@google.com>
Wed, 12 Aug 2020 20:56:16 +0000 (13:56 -0700)
Apparently when the strings are created, the `'\n'` is converted to the
platform's natural new line indicator, which is CR+LF on Windows.  But
upon reading back with `sscanf`, the CRs caused a matching failure.

lldb/unittests/Utility/TimerTest.cpp

index 2d323c0..c6d1fac 100644 (file)
@@ -97,7 +97,7 @@ TEST(TimerTest, CategoryTimesStats) {
   int count1, count2;
   ASSERT_EQ(
       6, sscanf(ss.GetData(),
-                "%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n ]"
+                "%lf sec (total: %lfs; child: %lfs; count: %d) for CAT1%*[\n\r ]"
                 "%lf sec (total: %*fs; child: %*fs; count: %d) for CAT2",
                 &seconds1, &total1, &child1, &count1, &seconds2, &count2))
       << "String: " << ss.GetData();