Changeset 57399 in webkit
- Timestamp:
- Apr 9, 2010 7:17:44 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r57398 r57399 1 2010-04-09 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Don't reinvent Executive.cpu_count for every port 6 https://bugs.webkit.org/show_bug.cgi?id=37377 7 8 mac.py and chromium_mac.py had some copy/paste code. This code doesn't 9 actually have anything to do with WebKit ports. It's really just 10 something in the multiprocessing package. The lame bit is that package 11 isn't available in older versions of Python, so we need to implement a 12 fallback. However, we already have the fallback in common. We don't 13 need to reinvent it specificly for layout_tests. 14 15 * Scripts/webkitpy/common/system/executive.py: 16 * Scripts/webkitpy/layout_tests/port/base.py: 17 * Scripts/webkitpy/layout_tests/port/chromium.py: 18 * Scripts/webkitpy/layout_tests/port/chromium_linux.py: 19 * Scripts/webkitpy/layout_tests/port/chromium_mac.py: 20 * Scripts/webkitpy/layout_tests/port/chromium_win.py: 21 * Scripts/webkitpy/layout_tests/port/mac.py: 22 * Scripts/webkitpy/layout_tests/port/test.py: 23 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 24 1 25 2010-04-09 Adam Barth <abarth@webkit.org> 2 26 -
trunk/WebKitTools/Scripts/webkitpy/common/system/executive.py
r57091 r57399 35 35 36 36 import os 37 import platform 37 38 import StringIO 38 39 import subprocess … … 123 124 if multiprocessing: 124 125 return multiprocessing.cpu_count() 126 # Darn. We don't have the multiprocessing package. 127 system_name = platform.system() 128 if system_name == "Dawin": 129 return int(self.run_command(["sysctl", "-n", "hw.ncpu"])) 130 elif system_name == "Windows": 131 return int(os.environ.get('NUMBER_OF_PROCESSORS', 1)) 132 elif system_name == "Linux": 133 num_cores = os.sysconf("SC_NPROCESSORS_ONLN") 134 if isinstance(num_cores, int) and num_cores > 0: 135 return num_cores 125 136 # This quantity is a lie but probably a reasonable guess for modern 126 137 # machines. -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
r57398 r57399 286 286 may be different (e.g., 'win-xp' instead of 'chromium-win-xp'.""" 287 287 return self._name 288 289 def num_cores(self):290 """Return the number of cores/cpus available on this machine.291 292 This routine is used to determine the default amount of parallelism293 used by run-chromium-webkit-tests."""294 raise NotImplementedError('Port.num_cores')295 288 296 289 # FIXME: This could be replaced by functions in webkitpy.common.checkout.scm. -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
r57381 r57399 45 45 46 46 47 # FIXME: This function doesn't belong in this package. 47 48 def check_file_exists(path_to_file, file_description, override_step=None, 48 49 logging=True): -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_linux.py
r57256 r57399 74 74 return result 75 75 76 def num_cores(self):77 num_cores = os.sysconf("SC_NPROCESSORS_ONLN")78 if isinstance(num_cores, int) and num_cores > 0:79 return num_cores80 return 181 82 76 def test_platform_name(self): 83 77 # We use 'linux' instead of 'chromium-linux' in test_expectations.txt. -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
r57256 r57399 66 66 'MacBuildInstructions') 67 67 return result 68 69 def num_cores(self):70 return int(subprocess.Popen(['sysctl','-n','hw.ncpu'],71 stdout=subprocess.PIPE).stdout.read())72 68 73 69 def test_platform_name(self): -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_win.py
r57256 r57399 78 78 abspath = os.path.abspath(filename) 79 79 return abspath.replace('\\', '/') 80 81 def num_cores(self):82 return int(os.environ.get('NUMBER_OF_PROCESSORS', 1))83 80 84 81 def relative_test_filename(self, filename): -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/mac.py
r57398 r57399 173 173 return result 174 174 175 def num_cores(self):176 ncores = int(executive.run_command(["sysctl", "-n", "hw.ncpu"]))177 # FIXME: new-run-webkit-tests is unstable running more than four178 # threads in parallel.179 # See https://bugs.webkit.org/show_bug.cgi?id=36622180 if ncores > 4:181 ncores = 4182 return ncores183 184 175 def path_to_test_expectations_file(self): 185 176 return self.path_from_webkit_base('LayoutTests', 'platform', -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/test.py
r55373 r57399 70 70 return self._name 71 71 72 def num_cores(self):73 return int(os.popen2("sysctl -n hw.ncpu")[1].read())74 75 72 def options(self): 76 73 return self._options -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r57381 r57399 51 51 import optparse 52 52 import os 53 import platform 53 54 import Queue 54 55 import random … … 71 72 from test_types import test_type_base 72 73 from test_types import text_diff 74 75 from webkitpy.common.system.executive import Executive 73 76 74 77 import port … … 1390 1393 1391 1394 port_obj = port.get(options.platform, options) 1395 executive = Executive() 1392 1396 1393 1397 if not options.configuration: … … 1423 1427 1424 1428 if not options.num_dump_render_trees: 1425 # TODO(ojan): Investigate perf/flakiness impact of using numcores + 1. 1426 options.num_dump_render_trees = port_obj.num_cores() 1429 # FIXME: Investigate perf/flakiness impact of using cpu_count + 1. 1430 options.num_dump_render_trees = executive.cpu_count() 1431 # FIXME: new-run-webkit-tests is unstable on Mac running more than 1432 # four threads in parallel. 1433 # See https://bugs.webkit.org/show_bug.cgi?id=36622 1434 if platform.system() == "Dawin" and options.num_dump_render_trees > 4: 1435 options.num_dump_render_trees = 4 1427 1436 1428 1437 write = create_logging_writer(options, 'config') … … 1462 1471 # all the test list parsing and ensures it's correct syntax (e.g. no 1463 1472 # dupes). 1464 for platform in port_obj.test_platform_names():1465 test_runner.parse_expectations(platform , is_debug_mode=True)1466 test_runner.parse_expectations(platform , is_debug_mode=False)1473 for platform_name in port_obj.test_platform_names(): 1474 test_runner.parse_expectations(platform_name, is_debug_mode=True) 1475 test_runner.parse_expectations(platform_name, is_debug_mode=False) 1467 1476 meter.update("") 1468 1477 print ("If there are no fail messages, errors or exceptions, then the "
Note: See TracChangeset
for help on using the changeset viewer.