Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 150573014: Rename various methods in webkitpy.layout_test.Port to be public (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove port.check_httpd stub call from port_testcase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 _log.warning(' ' + line) 425 _log.warning(' ' + line)
426 _log.warning('') 426 _log.warning('')
427 return False 427 return False
428 428
429 return True 429 return True
430 430
431 def _wdiff_missing_message(self): 431 def _wdiff_missing_message(self):
432 return 'wdiff is not installed; please install it to generate word-by-wo rd diffs.' 432 return 'wdiff is not installed; please install it to generate word-by-wo rd diffs.'
433 433
434 def check_httpd(self): 434 def check_httpd(self):
435 if self._uses_apache(): 435 if self.uses_apache():
436 httpd_path = self._path_to_apache() 436 httpd_path = self.path_to_apache()
437 else: 437 else:
438 httpd_path = self._path_to_lighttpd() 438 httpd_path = self.path_to_lighttpd()
439 439
440 try: 440 try:
441 server_name = self._filesystem.basename(httpd_path) 441 server_name = self._filesystem.basename(httpd_path)
442 env = self.setup_environ_for_server(server_name) 442 env = self.setup_environ_for_server(server_name)
443 if self._executive.run_command([httpd_path, "-v"], env=env, return_e xit_code=True) != 0: 443 if self._executive.run_command([httpd_path, "-v"], env=env, return_e xit_code=True) != 0:
444 _log.error("httpd seems broken. Cannot run http tests.") 444 _log.error("httpd seems broken. Cannot run http tests.")
445 return False 445 return False
446 return True 446 return True
447 except OSError: 447 except OSError:
448 _log.error("No httpd found. Cannot run http tests.") 448 _log.error("No httpd found. Cannot run http tests.")
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 """Does the port require an HTTP server for running tests? This could 1090 """Does the port require an HTTP server for running tests? This could
1091 be the case when the tests aren't run on the host platform.""" 1091 be the case when the tests aren't run on the host platform."""
1092 return False 1092 return False
1093 1093
1094 def start_http_server(self, additional_dirs=None, number_of_servers=None): 1094 def start_http_server(self, additional_dirs=None, number_of_servers=None):
1095 """Start a web server. Raise an error if it can't start or is already ru nning. 1095 """Start a web server. Raise an error if it can't start or is already ru nning.
1096 1096
1097 Ports can stub this out if they don't need a web server to be running."" " 1097 Ports can stub this out if they don't need a web server to be running."" "
1098 assert not self._http_server, 'Already running an http server.' 1098 assert not self._http_server, 'Already running an http server.'
1099 1099
1100 if self._uses_apache(): 1100 if self.uses_apache():
1101 server = apache_http_server.LayoutTestApacheHttpd(self, self.results _directory(), additional_dirs=additional_dirs, number_of_servers=number_of_serve rs) 1101 server = apache_http_server.LayoutTestApacheHttpd(self, self.results _directory(), additional_dirs=additional_dirs, number_of_servers=number_of_serve rs)
1102 else: 1102 else:
1103 server = http_server.Lighttpd(self, self.results_directory(), additi onal_dirs=additional_dirs, number_of_servers=number_of_servers) 1103 server = http_server.Lighttpd(self, self.results_directory(), additi onal_dirs=additional_dirs, number_of_servers=number_of_servers)
1104 1104
1105 server.start() 1105 server.start()
1106 self._http_server = server 1106 self._http_server = server
1107 1107
1108 def start_websocket_server(self): 1108 def start_websocket_server(self):
1109 """Start a web server. Raise an error if it can't start or is already ru nning. 1109 """Start a web server. Raise an error if it can't start or is already ru nning.
1110 1110
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 self._pretty_patch_available = False 1360 self._pretty_patch_available = False
1361 _log.error("Failed to run PrettyPatch (%s):\n%s" % (command, e.messa ge_with_output())) 1361 _log.error("Failed to run PrettyPatch (%s):\n%s" % (command, e.messa ge_with_output()))
1362 return self._pretty_patch_error_html 1362 return self._pretty_patch_error_html
1363 1363
1364 def default_configuration(self): 1364 def default_configuration(self):
1365 return self._config.default_configuration() 1365 return self._config.default_configuration()
1366 1366
1367 def clobber_old_port_specific_results(self): 1367 def clobber_old_port_specific_results(self):
1368 pass 1368 pass
1369 1369
1370 def uses_apache(self):
1371 return True
1372
1373 # FIXME: This does not belong on the port object.
1374 @memoized
1375 def path_to_apache(self):
1376 """Returns the full path to the apache binary.
1377
1378 This is needed only by ports that use the apache_http_server module."""
1379 raise NotImplementedError('Port.path_to_apache')
1380
1381 def path_to_apache_config_file(self):
1382 """Returns the full path to the apache configuration file.
1383
1384 If the WEBKIT_HTTP_SERVER_CONF_PATH environment variable is set, its
1385 contents will be used instead.
1386
1387 This is needed only by ports that use the apache_http_server module."""
1388 config_file_from_env = os.environ.get('WEBKIT_HTTP_SERVER_CONF_PATH')
1389 if config_file_from_env:
1390 if not self._filesystem.exists(config_file_from_env):
1391 raise IOError('%s was not found on the system' % config_file_fro m_env)
1392 return config_file_from_env
1393
1394 config_file_name = self._apache_config_file_name_for_platform(sys.platfo rm)
1395 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', co nfig_file_name)
1396
1397 def path_to_lighttpd(self):
1398 """Returns the path to the LigHTTPd binary.
1399
1400 This is needed only by ports that use the http_server.py module."""
1401 raise NotImplementedError('Port._path_to_lighttpd')
1402
1403 def path_to_lighttpd_modules(self):
1404 """Returns the path to the LigHTTPd modules directory.
1405
1406 This is needed only by ports that use the http_server.py module."""
1407 raise NotImplementedError('Port._path_to_lighttpd_modules')
1408
1409 def path_to_lighttpd_php(self):
1410 """Returns the path to the LigHTTPd PHP executable.
1411
1412 This is needed only by ports that use the http_server.py module."""
1413 raise NotImplementedError('Port._path_to_lighttpd_php')
1414
1415
1370 # 1416 #
1371 # PROTECTED ROUTINES 1417 # PROTECTED ROUTINES
1372 # 1418 #
1373 # The routines below should only be called by routines in this class 1419 # The routines below should only be called by routines in this class
1374 # or any of its subclasses. 1420 # or any of its subclasses.
1375 # 1421 #
1376 1422
1377 def _uses_apache(self):
1378 return True
1379
1380 # FIXME: This does not belong on the port object.
1381 @memoized
1382 def _path_to_apache(self):
1383 """Returns the full path to the apache binary.
1384
1385 This is needed only by ports that use the apache_http_server module."""
1386 raise NotImplementedError('Port._path_to_apache')
1387
1388 # FIXME: This belongs on some platform abstraction instead of Port. 1423 # FIXME: This belongs on some platform abstraction instead of Port.
1389 def _is_redhat_based(self): 1424 def _is_redhat_based(self):
1390 return self._filesystem.exists('/etc/redhat-release') 1425 return self._filesystem.exists('/etc/redhat-release')
1391 1426
1392 def _is_debian_based(self): 1427 def _is_debian_based(self):
1393 return self._filesystem.exists('/etc/debian_version') 1428 return self._filesystem.exists('/etc/debian_version')
1394 1429
1395 def _apache_version(self): 1430 def _apache_version(self):
1396 config = self._executive.run_command([self._path_to_apache(), '-v']) 1431 config = self._executive.run_command([self.path_to_apache(), '-v'])
1397 return re.sub(r'(?:.|\n)*Server version: Apache/(\d+\.\d+)(?:.|\n)*', r' \1', config) 1432 return re.sub(r'(?:.|\n)*Server version: Apache/(\d+\.\d+)(?:.|\n)*', r' \1', config)
1398 1433
1399 # We pass sys_platform into this method to make it easy to unit test. 1434 # We pass sys_platform into this method to make it easy to unit test.
1400 def _apache_config_file_name_for_platform(self, sys_platform): 1435 def _apache_config_file_name_for_platform(self, sys_platform):
1401 if sys_platform == 'cygwin': 1436 if sys_platform == 'cygwin':
1402 return 'cygwin-httpd.conf' # CYGWIN is the only platform to still u se Apache 1.3. 1437 return 'cygwin-httpd.conf' # CYGWIN is the only platform to still u se Apache 1.3.
1403 if sys_platform.startswith('linux'): 1438 if sys_platform.startswith('linux'):
1404 if self._is_redhat_based(): 1439 if self._is_redhat_based():
1405 return 'fedora-httpd-' + self._apache_version() + '.conf' 1440 return 'fedora-httpd-' + self._apache_version() + '.conf'
1406 if self._is_debian_based(): 1441 if self._is_debian_based():
1407 return 'debian-httpd-' + self._apache_version() + '.conf' 1442 return 'debian-httpd-' + self._apache_version() + '.conf'
1408 # All platforms use apache2 except for CYGWIN (and Mac OS X Tiger and pr ior, which we no longer support). 1443 # All platforms use apache2 except for CYGWIN (and Mac OS X Tiger and pr ior, which we no longer support).
1409 return "apache2-httpd.conf" 1444 return "apache2-httpd.conf"
1410 1445
1411 def _path_to_apache_config_file(self):
1412 """Returns the full path to the apache configuration file.
1413
1414 If the WEBKIT_HTTP_SERVER_CONF_PATH environment variable is set, its
1415 contents will be used instead.
1416
1417 This is needed only by ports that use the apache_http_server module."""
1418 config_file_from_env = os.environ.get('WEBKIT_HTTP_SERVER_CONF_PATH')
1419 if config_file_from_env:
1420 if not self._filesystem.exists(config_file_from_env):
1421 raise IOError('%s was not found on the system' % config_file_fro m_env)
1422 return config_file_from_env
1423
1424 config_file_name = self._apache_config_file_name_for_platform(sys.platfo rm)
1425 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', co nfig_file_name)
1426
1427 def _path_to_driver(self, configuration=None): 1446 def _path_to_driver(self, configuration=None):
1428 """Returns the full path to the test driver.""" 1447 """Returns the full path to the test driver."""
1429 return self._build_path(self.driver_name()) 1448 return self._build_path(self.driver_name())
1430 1449
1431 def _path_to_webcore_library(self): 1450 def _path_to_webcore_library(self):
1432 """Returns the full path to a built copy of WebCore.""" 1451 """Returns the full path to a built copy of WebCore."""
1433 return None 1452 return None
1434 1453
1435 def _path_to_helper(self): 1454 def _path_to_helper(self):
1436 """Returns the full path to the layout_test_helper binary, which 1455 """Returns the full path to the layout_test_helper binary, which
1437 is used to help configure the system for the test run, or None 1456 is used to help configure the system for the test run, or None
1438 if no helper is needed. 1457 if no helper is needed.
1439 1458
1440 This is likely only used by start/stop_helper().""" 1459 This is likely only used by start/stop_helper()."""
1441 return None 1460 return None
1442 1461
1443 def _path_to_image_diff(self): 1462 def _path_to_image_diff(self):
1444 """Returns the full path to the image_diff binary, or None if it is not available. 1463 """Returns the full path to the image_diff binary, or None if it is not available.
1445 1464
1446 This is likely used only by diff_image()""" 1465 This is likely used only by diff_image()"""
1447 return self._build_path('image_diff') 1466 return self._build_path('image_diff')
1448 1467
1449 def _path_to_lighttpd(self):
1450 """Returns the path to the LigHTTPd binary.
1451
1452 This is needed only by ports that use the http_server.py module."""
1453 raise NotImplementedError('Port._path_to_lighttpd')
1454
1455 def _path_to_lighttpd_modules(self):
1456 """Returns the path to the LigHTTPd modules directory.
1457
1458 This is needed only by ports that use the http_server.py module."""
1459 raise NotImplementedError('Port._path_to_lighttpd_modules')
1460
1461 def _path_to_lighttpd_php(self):
1462 """Returns the path to the LigHTTPd PHP executable.
1463
1464 This is needed only by ports that use the http_server.py module."""
1465 raise NotImplementedError('Port._path_to_lighttpd_php')
1466
1467 @memoized 1468 @memoized
1468 def _path_to_wdiff(self): 1469 def _path_to_wdiff(self):
1469 """Returns the full path to the wdiff binary, or None if it is not avail able. 1470 """Returns the full path to the wdiff binary, or None if it is not avail able.
1470 1471
1471 This is likely used only by wdiff_text()""" 1472 This is likely used only by wdiff_text()"""
1472 for path in ("/usr/bin/wdiff", "/usr/bin/dwdiff"): 1473 for path in ("/usr/bin/wdiff", "/usr/bin/dwdiff"):
1473 if self._filesystem.exists(path): 1474 if self._filesystem.exists(path):
1474 return path 1475 return path
1475 return None 1476 return None
1476 1477
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 if name.find('/') != -1: 1748 if name.find('/') != -1:
1748 _log.error("Virtual test suites names cannot contain /'s: %s" % name) 1749 _log.error("Virtual test suites names cannot contain /'s: %s" % name)
1749 return 1750 return
1750 self.name = 'virtual/' + name + '/' + base 1751 self.name = 'virtual/' + name + '/' + base
1751 self.base = base 1752 self.base = base
1752 self.args = args 1753 self.args = args
1753 self.tests = tests or set() 1754 self.tests = tests or set()
1754 1755
1755 def __repr__(self): 1756 def __repr__(self):
1756 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args) 1757 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args)
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/layout_tests/port/android.py ('k') | Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698