[Lldb-commits] [lldb] 7ddfb95 - [lldb] Fix unit test parsing to handle CR+LF as well as LF

Adrian McCarthy via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 12 13:56:28 PDT 2020


Author: Adrian McCarthy
Date: 2020-08-12T13:56:16-07:00
New Revision: 7ddfb956e1a5ee91d0d30f33ca0c84faeb471db4

URL: https://github.com/llvm/llvm-project/commit/7ddfb956e1a5ee91d0d30f33ca0c84faeb471db4
DIFF: https://github.com/llvm/llvm-project/commit/7ddfb956e1a5ee91d0d30f33ca0c84faeb471db4.diff

LOG: [lldb] Fix unit test parsing to handle CR+LF as well as LF

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.

Added: 
    

Modified: 
    lldb/unittests/Utility/TimerTest.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/unittests/Utility/TimerTest.cpp b/lldb/unittests/Utility/TimerTest.cpp
index 2d323c0dc2a3..c6d1facdebbb 100644
--- a/lldb/unittests/Utility/TimerTest.cpp
+++ b/lldb/unittests/Utility/TimerTest.cpp
@@ -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();


        


More information about the lldb-commits mailing list