Title: [138294] trunk/Tools
Revision
138294
Author
tha...@chromium.org
Date
2012-12-20 13:37:41 -0800 (Thu, 20 Dec 2012)

Log Message

chromium nrwt: Pick the newest binary found in DEFAULT_BUILD_DIRECTORIES, not the first
https://bugs.webkit.org/show_bug.cgi?id=105498

Reviewed by Dirk Pranke.

Use the newest binary available rather than an than always picking one
build directory over another based on iteration order.

* Scripts/webkitpy/layout_tests/port/chromium.py:
(ChromiumPort._static_build_path):
Check for timestamps.
* Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py:
(ChromiumMacPortTest.test_build_path_timestamps):
Test that out / xcodebuild selection happens based on timestamps
* Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
(ChromiumWinPortTest.test_build_path_timestamps):
Test that out / build selection happens based on timestamps

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (138293 => 138294)


--- trunk/Tools/ChangeLog	2012-12-20 21:35:56 UTC (rev 138293)
+++ trunk/Tools/ChangeLog	2012-12-20 21:37:41 UTC (rev 138294)
@@ -1,3 +1,23 @@
+2012-12-20  Nico Weber  <tha...@chromium.org>
+
+        chromium nrwt: Pick the newest binary found in DEFAULT_BUILD_DIRECTORIES, not the first
+        https://bugs.webkit.org/show_bug.cgi?id=105498
+
+        Reviewed by Dirk Pranke.
+
+        Use the newest binary available rather than an than always picking one
+        build directory over another based on iteration order.
+
+        * Scripts/webkitpy/layout_tests/port/chromium.py:
+        (ChromiumPort._static_build_path):
+        Check for timestamps.
+        * Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py:
+        (ChromiumMacPortTest.test_build_path_timestamps):
+        Test that out / xcodebuild selection happens based on timestamps
+        * Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py:
+        (ChromiumWinPortTest.test_build_path_timestamps):
+        Test that out / build selection happens based on timestamps
+
 2012-12-19  Simon Fraser  <simon.fra...@apple.com>
 
         Lots of sticky tests failing in WK2

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (138293 => 138294)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-12-20 21:35:56 UTC (rev 138293)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py	2012-12-20 21:37:41 UTC (rev 138294)
@@ -84,16 +84,26 @@
         if build_directory:
             return filesystem.join(build_directory, configuration, *comps)
 
+        hits = []
         for directory in cls.DEFAULT_BUILD_DIRECTORIES:
             base_dir = filesystem.join(chromium_base, directory, configuration)
-            if filesystem.exists(base_dir):
-                return filesystem.join(base_dir, *comps)
+            path = filesystem.join(base_dir, *comps)
+            if filesystem.exists(path):
+                hits.append((filesystem.mtime(path), path))
+        if hits:
+            hits.sort(reverse=True)
+            return hits[0][1]  # Return the newest file found.
 
         for directory in cls.DEFAULT_BUILD_DIRECTORIES:
             base_dir = filesystem.join(webkit_base, directory, configuration)
-            if filesystem.exists(base_dir):
-                return filesystem.join(base_dir, *comps)
+            path = filesystem.join(base_dir, *comps)
+            if filesystem.exists(path):
+                hits.append((filesystem.mtime(path), path))
 
+        if hits:
+            hits.sort(reverse=True)
+            return hits[0][1]  # Return the newest file found.
+
         # We have to default to something, so pick the last one.
         return filesystem.join(base_dir, *comps)
 

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py (138293 => 138294)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py	2012-12-20 21:35:56 UTC (rev 138293)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py	2012-12-20 21:37:41 UTC (rev 138294)
@@ -95,6 +95,18 @@
         options = MockOptions(configuration='Release', build_directory=None)
         self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/xcodebuild/Release', '/mock-checkout/Source/WebKit/chromium/out/Release'], '/mock-checkout/Source/WebKit/chromium/xcodebuild/Release')
 
+    def test_build_path_timestamps(self):
+        options = MockOptions(configuration='Release', build_directory=None)
+        port = self.make_port(options=options)
+        port.host.filesystem.maybe_make_directory('/mock-checkout/out/Release')
+        port.host.filesystem.maybe_make_directory('/mock-checkout/xcodebuild/Release')
+        # Check with 'out' being newer.
+        port.host.filesystem.mtime = lambda f: 5 if '/out/' in f else 4
+        self.assertEqual(port._build_path(), '/mock-checkout/out/Release')
+        # Check with 'xcodebuild' being newer.
+        port.host.filesystem.mtime = lambda f: 5 if '/xcodebuild/' in f else 4
+        self.assertEqual(port._build_path(), '/mock-checkout/xcodebuild/Release')
+
     def test_driver_name_option(self):
         self.assertTrue(self.make_port()._path_to_driver().endswith('DumpRenderTree'))
         self.assertTrue(self.make_port(options=MockOptions(driver_name='OtherDriver'))._path_to_driver().endswith('OtherDriver'))

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py (138293 => 138294)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py	2012-12-20 21:35:56 UTC (rev 138293)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py	2012-12-20 21:37:41 UTC (rev 138294)
@@ -114,6 +114,18 @@
         options = MockOptions(configuration='Release', build_directory=None)
         self.assert_build_path(options, ['/mock-checkout/Source/WebKit/chromium/build/Release', '/mock-checkout/Source/WebKit/chromium/out'], '/mock-checkout/Source/WebKit/chromium/build/Release')
 
+    def test_build_path_timestamps(self):
+        options = MockOptions(configuration='Release', build_directory=None)
+        port = self.make_port(options=options)
+        port.host.filesystem.maybe_make_directory('/mock-checkout/out/Release')
+        port.host.filesystem.maybe_make_directory('/mock-checkout/build/Release')
+        # Check with 'out' being newer.
+        port.host.filesystem.mtime = lambda f: 5 if '/out/' in f else 4
+        self.assertEqual(port._build_path(), '/mock-checkout/out/Release')
+        # Check with 'build' being newer.
+        port.host.filesystem.mtime = lambda f: 5 if '/build/' in f else 4
+        self.assertEqual(port._build_path(), '/mock-checkout/build/Release')
+
     def test_operating_system(self):
         self.assertEqual('win', self.make_port().operating_system())
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to