Make NRWT consider all lines of output from parse-malloc-history, not just the first
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Nov 2011 15:15:44 +0000 (15:15 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Nov 2011 15:15:44 +0000 (15:15 +0000)
Fixes <http://webkit.org/b/72652> REGRESSION (NRWT): NRWT always reports "1 unique leaks
found" even when there are more than 1 unique leaks

Reviewed by Darin Adler.

* Scripts/webkitpy/layout_tests/port/leakdetector.py:
(LeakDetector.count_total_bytes_and_unique_leaks): Pass re.MULTILINE to re.findall so that
"^" will be considered to match the beginning of any line, not only the beginning of the
string.

* Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py:
(LeakDetectorTest.test_count_total_bytes_and_unique_leaks): Added a second callstack to the
fake output and updated expectations to match.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100912 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/port/leakdetector.py
Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py

index db6ac80..6030b9b 100644 (file)
@@ -1,3 +1,21 @@
+2011-11-18  Adam Roben  <aroben@apple.com>
+
+        Make NRWT consider all lines of output from parse-malloc-history, not just the first
+
+        Fixes <http://webkit.org/b/72652> REGRESSION (NRWT): NRWT always reports "1 unique leaks
+        found" even when there are more than 1 unique leaks
+
+        Reviewed by Darin Adler.
+
+        * Scripts/webkitpy/layout_tests/port/leakdetector.py:
+        (LeakDetector.count_total_bytes_and_unique_leaks): Pass re.MULTILINE to re.findall so that
+        "^" will be considered to match the beginning of any line, not only the beginning of the
+        string.
+
+        * Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py:
+        (LeakDetectorTest.test_count_total_bytes_and_unique_leaks): Added a second callstack to the
+        fake output and updated expectations to match.
+
 2011-11-21  Andras Becsi  <andras.becsi@nokia.com>
 
         [Qt] Clean up MiniBrowser project file after recent changes
index 855a59d..25dd44f 100644 (file)
@@ -121,7 +121,7 @@ class LeakDetector(object):
             return
 
         # total: 5,888 bytes (0 bytes excluded).
-        unique_leak_count = len(re.findall(r'^(\d*)\scalls', parse_malloc_history_output))
+        unique_leak_count = len(re.findall(r'^(\d*)\scalls', parse_malloc_history_output, re.MULTILINE))
         total_bytes_string = re.search(r'^total\:\s(.+)\s\(', parse_malloc_history_output, re.MULTILINE).group(1)
         return (total_bytes_string, unique_leak_count)
 
index 75dbb6f..7628bb7 100644 (file)
@@ -130,13 +130,15 @@ Binary Images:
             print "MOCK _run_script: %s %s" % (name, args)
             return """1 calls for 16 bytes: -[NSURLRequest mutableCopyWithZone:] | +[NSObject(NSObject) allocWithZone:] | _internal_class_createInstanceFromZone | calloc | malloc_zone_calloc
 
+147 calls for 9,408 bytes: _CFRuntimeCreateInstance | _ZN3WTF24StringWrapperCFAllocatorL8allocateElmPv StringImplCF.cpp:67 | WTF::fastMalloc(unsigned long) FastMalloc.cpp:268 | malloc | malloc_zone_malloc 
+
 total: 5,888 bytes (0 bytes excluded)."""
         detector._port._run_script = mock_run_script
 
         leak_files = ['/mock-results/DumpRenderTree-1234-leaks.txt', '/mock-results/DumpRenderTree-1235-leaks.txt']
         expected_stdout = "MOCK _run_script: parse-malloc-history ['--merge-depth', 5, '/mock-results/DumpRenderTree-1234-leaks.txt', '/mock-results/DumpRenderTree-1235-leaks.txt']\n"
         results_tuple = OutputCapture().assert_outputs(self, detector.count_total_bytes_and_unique_leaks, [leak_files], expected_stdout=expected_stdout)
-        self.assertEquals(results_tuple, ("5,888 bytes", 1))
+        self.assertEquals(results_tuple, ("5,888 bytes", 2))
 
     def test_count_total_leaks(self):
         detector = self._make_detector()