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

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

Issue 1201873002: Move LayoutTest Linux distribution detection to PlatformInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use ServerRoot without symlink Created 5 years, 6 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
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 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 If the WEBKIT_HTTP_SERVER_CONF_PATH environment variable is set, its 1434 If the WEBKIT_HTTP_SERVER_CONF_PATH environment variable is set, its
1435 contents will be used instead. 1435 contents will be used instead.
1436 1436
1437 This is needed only by ports that use the apache_http_server module.""" 1437 This is needed only by ports that use the apache_http_server module."""
1438 config_file_from_env = os.environ.get('WEBKIT_HTTP_SERVER_CONF_PATH') 1438 config_file_from_env = os.environ.get('WEBKIT_HTTP_SERVER_CONF_PATH')
1439 if config_file_from_env: 1439 if config_file_from_env:
1440 if not self._filesystem.exists(config_file_from_env): 1440 if not self._filesystem.exists(config_file_from_env):
1441 raise IOError('%s was not found on the system' % config_file_fro m_env) 1441 raise IOError('%s was not found on the system' % config_file_fro m_env)
1442 return config_file_from_env 1442 return config_file_from_env
1443 1443
1444 config_file_name = self._apache_config_file_name_for_platform(sys.platfo rm) 1444 config_file_name = self._apache_config_file_name_for_platform()
1445 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', co nfig_file_name) 1445 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', co nfig_file_name)
1446 1446
1447 # 1447 #
1448 # PROTECTED ROUTINES 1448 # PROTECTED ROUTINES
1449 # 1449 #
1450 # The routines below should only be called by routines in this class 1450 # The routines below should only be called by routines in this class
1451 # or any of its subclasses. 1451 # or any of its subclasses.
1452 # 1452 #
1453 1453
1454 # FIXME: This belongs on some platform abstraction instead of Port.
1455 def _is_redhat_based(self):
1456 return self._filesystem.exists('/etc/redhat-release')
1457
1458 def _is_debian_based(self):
1459 return self._filesystem.exists('/etc/debian_version')
1460
1461 def _apache_version(self): 1454 def _apache_version(self):
1462 config = self._executive.run_command([self.path_to_apache(), '-v']) 1455 config = self._executive.run_command([self.path_to_apache(), '-v'])
1463 return re.sub(r'(?:.|\n)*Server version: Apache/(\d+\.\d+)(?:.|\n)*', r' \1', config) 1456 return re.sub(r'(?:.|\n)*Server version: Apache/(\d+\.\d+)(?:.|\n)*', r' \1', config)
1464 1457
1465 # We pass sys_platform into this method to make it easy to unit test. 1458 def _apache_config_file_name_for_platform(self):
1466 def _apache_config_file_name_for_platform(self, sys_platform): 1459 if self.host.platform.is_cygwin():
1467 if sys_platform == 'cygwin':
1468 return 'cygwin-httpd.conf' # CYGWIN is the only platform to still u se Apache 1.3. 1460 return 'cygwin-httpd.conf' # CYGWIN is the only platform to still u se Apache 1.3.
1469 if sys_platform.startswith('linux'): 1461 if self.host.platform.is_linux():
1470 if self._is_redhat_based(): 1462 distribution = self.host.platform.linux_distribution()
1471 return 'fedora-httpd-' + self._apache_version() + '.conf' 1463
1472 if self._is_debian_based(): 1464 custom_configuration_distributions = ['arch', 'debian', 'redhat']
1473 return 'debian-httpd-' + self._apache_version() + '.conf' 1465 if distribution in custom_configuration_distributions:
1466 return "%s-httpd-%s.conf" % (distribution, self._apache_version( ))
1467
1474 # All platforms use apache2 except for CYGWIN (and Mac OS X Tiger and pr ior, which we no longer support). 1468 # All platforms use apache2 except for CYGWIN (and Mac OS X Tiger and pr ior, which we no longer support).
Dirk Pranke 2015/06/22 22:58:05 Can you delete line 1468 while you're at it; we do
1475 return 'apache2-httpd-' + self._apache_version() + '.conf' 1469 return 'apache2-httpd-' + self._apache_version() + '.conf'
1476 1470
1477 def _path_to_driver(self, configuration=None): 1471 def _path_to_driver(self, configuration=None):
1478 """Returns the full path to the test driver.""" 1472 """Returns the full path to the test driver."""
1479 return self._build_path(self.driver_name()) 1473 return self._build_path(self.driver_name())
1480 1474
1481 def _path_to_webcore_library(self): 1475 def _path_to_webcore_library(self):
1482 """Returns the full path to a built copy of WebCore.""" 1476 """Returns the full path to a built copy of WebCore."""
1483 return None 1477 return None
1484 1478
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 class PhysicalTestSuite(object): 1763 class PhysicalTestSuite(object):
1770 def __init__(self, base, args, reference_args=None): 1764 def __init__(self, base, args, reference_args=None):
1771 self.name = base 1765 self.name = base
1772 self.base = base 1766 self.base = base
1773 self.args = args 1767 self.args = args
1774 self.reference_args = args if reference_args is None else reference_args 1768 self.reference_args = args if reference_args is None else reference_args
1775 self.tests = set() 1769 self.tests = set()
1776 1770
1777 def __repr__(self): 1771 def __repr__(self):
1778 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1772 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698