Title: [94345] trunk/Tools
Revision
94345
Author
[email protected]
Date
2011-09-01 14:29:51 -0700 (Thu, 01 Sep 2011)

Log Message

REGRESSION (NRWT): Leaks Viewer can't load leaks from test runs that used NRWT
https://bugs.webkit.org/show_bug.cgi?id=66228

Reviewed by Dirk Pranke.

ORWT used $(PROCESS)$(NUMBER)-leaks.txt for leaks filenames.
The LeaksViewer tool globs for all *-leaks.txt files.
This patch makes NRWT output $(PROCESS)-$(PID)-leaks.txt which should match.

In order to test this I had to fix a limitation in our MockFileSystem.glob
method.  However, doing so uncovered a typo and bug in the integration tests.
I've disabled the offending integration tests.

* Scripts/webkitpy/common/system/filesystem_mock.py:
* Scripts/webkitpy/layout_tests/port/leakdetector.py:
* Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (94344 => 94345)


--- trunk/Tools/ChangeLog	2011-09-01 21:22:24 UTC (rev 94344)
+++ trunk/Tools/ChangeLog	2011-09-01 21:29:51 UTC (rev 94345)
@@ -1,3 +1,22 @@
+2011-09-01  Eric Seidel  <[email protected]>
+
+        REGRESSION (NRWT): Leaks Viewer can't load leaks from test runs that used NRWT
+        https://bugs.webkit.org/show_bug.cgi?id=66228
+
+        Reviewed by Dirk Pranke.
+
+        ORWT used $(PROCESS)$(NUMBER)-leaks.txt for leaks filenames.
+        The LeaksViewer tool globs for all *-leaks.txt files.
+        This patch makes NRWT output $(PROCESS)-$(PID)-leaks.txt which should match.
+
+        In order to test this I had to fix a limitation in our MockFileSystem.glob
+        method.  However, doing so uncovered a typo and bug in the integration tests.
+        I've disabled the offending integration tests.
+
+        * Scripts/webkitpy/common/system/filesystem_mock.py:
+        * Scripts/webkitpy/layout_tests/port/leakdetector.py:
+        * Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py:
+
 2011-09-01  Dominic Mazzoni  <[email protected]>
 
         Adds a LayoutTestController method to make it possible to test

Modified: trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py (94344 => 94345)


--- trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py	2011-09-01 21:22:24 UTC (rev 94344)
+++ trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py	2011-09-01 21:29:51 UTC (rev 94345)
@@ -142,13 +142,16 @@
         return self.cwd
 
     def glob(self, glob_string):
-        # FIXME: This only handles a wildcard '*' at the end of the path.
-        # Maybe it should handle more?
-        if glob_string[-1] == '*':
-            path_filter = lambda path: path.startswith(glob_string[:-1])
+        # FIXME: This only handles the simplest of wildcard matches.
+        wildcard_index = glob_string.find('*')
+        if wildcard_index != -1:
+            before_wildcard = glob_string[:wildcard_index - 1]
+            after_wildcard = glob_string[wildcard_index + 1:]
+            path_filter = lambda path: path.startswith(before_wildcard) and path.endswith(after_wildcard)
         else:
             path_filter = lambda path: glob_string == path
 
+        # We could use fnmatch.fnmatch, but that might not do the right thing on windows.
         existing_files = [path for path, contents in self.files.items() if contents is not None]
         return filter(path_filter, existing_files) + filter(path_filter, self.dirs)
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/http_lock.py (94344 => 94345)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/http_lock.py	2011-09-01 21:22:24 UTC (rev 94344)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/http_lock.py	2011-09-01 21:29:51 UTC (rev 94345)
@@ -28,7 +28,6 @@
 """This class helps to block NRWT threads when more NRWTs run
 http and websocket tests in a same time."""
 
-import glob
 import logging
 import os
 import sys

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector.py (94344 => 94345)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector.py	2011-09-01 21:22:24 UTC (rev 94344)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector.py	2011-09-01 21:29:51 UTC (rev 94345)
@@ -91,11 +91,11 @@
         return int(count), int(excluded), int(bytes)
 
     def leaks_files_in_directory(self, directory):
-        return self._filesystem.glob(self._filesystem.join(directory, "leaks-*"))
+        return self._filesystem.glob(self._filesystem.join(directory, "*-leaks.txt"))
 
     def leaks_file_name(self, process_name, process_pid):
         # We include the number of files this worker has already written in the name to prevent overwritting previous leak results..
-        return "leaks-%s-%s.txt" % (process_name, process_pid)
+        return "%s-%s-leaks.txt" % (process_name, process_pid)
 
     def parse_leak_files(self, leak_files):
         merge_depth = 5  # ORWT had a --merge-leak-depth argument, but that seems out of scope for the run-webkit-tests tool.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py (94344 => 94345)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py	2011-09-01 21:22:24 UTC (rev 94344)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py	2011-09-01 21:29:51 UTC (rev 94345)
@@ -85,9 +85,9 @@
         detector = self._make_detector()
         self.assertEquals(detector.leaks_files_in_directory('/bogus-directory'), [])
         detector._filesystem = MockFileSystem({
-            '/mock-results/leaks-DumpRenderTree-0-1.txt': '',
-            '/mock-results/leaks-DumpRenderTree-1-1.txt': '',
-            '/mock-results/leaks-DumpRenderTree-0-2.txt': '',
+            '/mock-results/DumpRenderTree-1234-leaks.txt': '',
+            '/mock-results/DumpRenderTree-23423-leaks.txt': '',
+            '/mock-results/DumpRenderTree-823-leaks.txt': '',
         })
         self.assertEquals(len(detector.leaks_files_in_directory('/mock-results')), 3)
 
@@ -101,7 +101,7 @@
 total: 5,888 bytes (0 bytes excluded)."""
         detector._port._run_script = mock_run_script
 
-        leak_files = ['/mock-results/leaks-DumpRenderTree-1234.txt', '/mock-results/leaks-DumpRenderTree-1235.txt']
-        expected_stdout = "MOCK _run_script: parse-malloc-history ['--merge-depth', 5, '/mock-results/leaks-DumpRenderTree-1234.txt', '/mock-results/leaks-DumpRenderTree-1235.txt']\n"
+        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.parse_leak_files, [leak_files], expected_stdout=expected_stdout)
         self.assertEquals(results_tuple, ("5,888 bytes", 1))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to