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

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

Issue 135583003: checkpoint Blink-side work to use Apache on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: first complete patch 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
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 result = self.check_image_diff( 341 result = self.check_image_diff(
342 'To override, invoke with --no-pixel-tests') and result 342 'To override, invoke with --no-pixel-tests') and result
343 343
344 # It's okay if pretty patch and wdiff aren't available, but we will at l east log messages. 344 # It's okay if pretty patch and wdiff aren't available, but we will at l east log messages.
345 self._pretty_patch_available = self.check_pretty_patch() 345 self._pretty_patch_available = self.check_pretty_patch()
346 self._wdiff_available = self.check_wdiff() 346 self._wdiff_available = self.check_wdiff()
347 347
348 if self._dump_reader: 348 if self._dump_reader:
349 result = self._dump_reader.check_is_functional() and result 349 result = self._dump_reader.check_is_functional() and result
350 350
351 if needs_http:
352 result = self.check_httpd() and result
353
351 return test_run_results.OK_EXIT_STATUS if result else test_run_results.U NEXPECTED_ERROR_EXIT_STATUS 354 return test_run_results.OK_EXIT_STATUS if result else test_run_results.U NEXPECTED_ERROR_EXIT_STATUS
352 355
353 def _check_driver(self): 356 def _check_driver(self):
354 driver_path = self._path_to_driver() 357 driver_path = self._path_to_driver()
355 if not self._filesystem.exists(driver_path): 358 if not self._filesystem.exists(driver_path):
356 _log.error("%s was not found at %s" % (self.driver_name(), driver_pa th)) 359 _log.error("%s was not found at %s" % (self.driver_name(), driver_pa th))
357 return False 360 return False
358 return True 361 return True
359 362
360 def _check_port_build(self): 363 def _check_port_build(self):
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 _log.warning(' ' + line) 428 _log.warning(' ' + line)
426 _log.warning('') 429 _log.warning('')
427 return False 430 return False
428 431
429 return True 432 return True
430 433
431 def _wdiff_missing_message(self): 434 def _wdiff_missing_message(self):
432 return 'wdiff is not installed; please install it to generate word-by-wo rd diffs.' 435 return 'wdiff is not installed; please install it to generate word-by-wo rd diffs.'
433 436
434 def check_httpd(self): 437 def check_httpd(self):
435 if self._uses_apache(): 438 if self.uses_apache():
436 httpd_path = self._path_to_apache() 439 httpd_path = self.path_to_apache()
437 else: 440 else:
438 httpd_path = self._path_to_lighttpd() 441 httpd_path = self.path_to_lighttpd()
439 442
440 try: 443 try:
441 server_name = self._filesystem.basename(httpd_path) 444 server_name = self._filesystem.basename(httpd_path)
442 env = self.setup_environ_for_server(server_name) 445 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: 446 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.") 447 _log.error("httpd seems broken. Cannot run http tests.")
445 return False 448 return False
446 return True 449 return True
447 except OSError: 450 except OSError:
448 _log.error("No httpd found. Cannot run http tests.") 451 _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 1093 """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.""" 1094 be the case when the tests aren't run on the host platform."""
1092 return False 1095 return False
1093 1096
1094 def start_http_server(self, additional_dirs=None, number_of_servers=None): 1097 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. 1098 """Start a web server. Raise an error if it can't start or is already ru nning.
1096 1099
1097 Ports can stub this out if they don't need a web server to be running."" " 1100 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.' 1101 assert not self._http_server, 'Already running an http server.'
1099 1102
1100 if self._uses_apache(): 1103 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) 1104 server = apache_http_server.LayoutTestApacheHttpd(self, self.results _directory(), additional_dirs=additional_dirs, number_of_servers=number_of_serve rs)
1102 else: 1105 else:
1103 server = http_server.Lighttpd(self, self.results_directory(), additi onal_dirs=additional_dirs, number_of_servers=number_of_servers) 1106 server = http_server.Lighttpd(self, self.results_directory(), additi onal_dirs=additional_dirs, number_of_servers=number_of_servers)
1104 1107
1105 server.start() 1108 server.start()
1106 self._http_server = server 1109 self._http_server = server
1107 1110
1108 def start_websocket_server(self): 1111 def start_websocket_server(self):
1109 """Start a web server. Raise an error if it can't start or is already ru nning. 1112 """Start a web server. Raise an error if it can't start or is already ru nning.
1110 1113
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 self._pretty_patch_available = False 1363 self._pretty_patch_available = False
1361 _log.error("Failed to run PrettyPatch (%s):\n%s" % (command, e.messa ge_with_output())) 1364 _log.error("Failed to run PrettyPatch (%s):\n%s" % (command, e.messa ge_with_output()))
1362 return self._pretty_patch_error_html 1365 return self._pretty_patch_error_html
1363 1366
1364 def default_configuration(self): 1367 def default_configuration(self):
1365 return self._config.default_configuration() 1368 return self._config.default_configuration()
1366 1369
1367 def clobber_old_port_specific_results(self): 1370 def clobber_old_port_specific_results(self):
1368 pass 1371 pass
1369 1372
1373 def uses_apache(self):
1374 return True
1375
1376 # FIXME: This does not belong on the port object.
1377 @memoized
1378 def path_to_apache(self):
1379 """Returns the full path to the apache binary.
1380
1381 This is needed only by ports that use the apache_http_server module."""
1382 raise NotImplementedError('Port.path_to_apache')
1383
1384 def path_to_apache_config_file(self):
1385 """Returns the full path to the apache configuration file.
1386
1387 If the WEBKIT_HTTP_SERVER_CONF_PATH environment variable is set, its
1388 contents will be used instead.
1389
1390 This is needed only by ports that use the apache_http_server module."""
1391 config_file_from_env = os.environ.get('WEBKIT_HTTP_SERVER_CONF_PATH')
1392 if config_file_from_env:
1393 if not self._filesystem.exists(config_file_from_env):
1394 raise IOError('%s was not found on the system' % config_file_fro m_env)
1395 return config_file_from_env
1396
1397 config_file_name = self._apache_config_file_name_for_platform(sys.platfo rm)
1398 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', co nfig_file_name)
1399
1400 def path_to_lighttpd(self):
1401 """Returns the path to the LigHTTPd binary.
1402
1403 This is needed only by ports that use the http_server.py module."""
1404 raise NotImplementedError('Port._path_to_lighttpd')
1405
1406 def path_to_lighttpd_modules(self):
1407 """Returns the path to the LigHTTPd modules directory.
1408
1409 This is needed only by ports that use the http_server.py module."""
1410 raise NotImplementedError('Port._path_to_lighttpd_modules')
1411
1412 def path_to_lighttpd_php(self):
1413 """Returns the path to the LigHTTPd PHP executable.
1414
1415 This is needed only by ports that use the http_server.py module."""
1416 raise NotImplementedError('Port._path_to_lighttpd_php')
1417
1418
1370 # 1419 #
1371 # PROTECTED ROUTINES 1420 # PROTECTED ROUTINES
1372 # 1421 #
1373 # The routines below should only be called by routines in this class 1422 # The routines below should only be called by routines in this class
1374 # or any of its subclasses. 1423 # or any of its subclasses.
1375 # 1424 #
1376 1425
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. 1426 # FIXME: This belongs on some platform abstraction instead of Port.
1389 def _is_redhat_based(self): 1427 def _is_redhat_based(self):
1390 return self._filesystem.exists('/etc/redhat-release') 1428 return self._filesystem.exists('/etc/redhat-release')
1391 1429
1392 def _is_debian_based(self): 1430 def _is_debian_based(self):
1393 return self._filesystem.exists('/etc/debian_version') 1431 return self._filesystem.exists('/etc/debian_version')
1394 1432
1395 def _apache_version(self): 1433 def _apache_version(self):
1396 config = self._executive.run_command([self._path_to_apache(), '-v']) 1434 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) 1435 return re.sub(r'(?:.|\n)*Server version: Apache/(\d+\.\d+)(?:.|\n)*', r' \1', config)
1398 1436
1399 # We pass sys_platform into this method to make it easy to unit test. 1437 # 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): 1438 def _apache_config_file_name_for_platform(self, sys_platform):
1401 if sys_platform == 'cygwin': 1439 if sys_platform == 'cygwin':
1402 return 'cygwin-httpd.conf' # CYGWIN is the only platform to still u se Apache 1.3. 1440 return 'cygwin-httpd.conf' # CYGWIN is the only platform to still u se Apache 1.3.
1403 if sys_platform.startswith('linux'): 1441 if sys_platform.startswith('linux'):
1404 if self._is_redhat_based(): 1442 if self._is_redhat_based():
1405 return 'fedora-httpd-' + self._apache_version() + '.conf' 1443 return 'fedora-httpd-' + self._apache_version() + '.conf'
1406 if self._is_debian_based(): 1444 if self._is_debian_based():
1407 return 'debian-httpd-' + self._apache_version() + '.conf' 1445 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). 1446 # 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" 1447 return "apache2-httpd.conf"
1410 1448
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): 1449 def _path_to_driver(self, configuration=None):
1428 """Returns the full path to the test driver.""" 1450 """Returns the full path to the test driver."""
1429 return self._build_path(self.driver_name()) 1451 return self._build_path(self.driver_name())
1430 1452
1431 def _path_to_webcore_library(self): 1453 def _path_to_webcore_library(self):
1432 """Returns the full path to a built copy of WebCore.""" 1454 """Returns the full path to a built copy of WebCore."""
1433 return None 1455 return None
1434 1456
1435 def _path_to_helper(self): 1457 def _path_to_helper(self):
1436 """Returns the full path to the layout_test_helper binary, which 1458 """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 1459 is used to help configure the system for the test run, or None
1438 if no helper is needed. 1460 if no helper is needed.
1439 1461
1440 This is likely only used by start/stop_helper().""" 1462 This is likely only used by start/stop_helper()."""
1441 return None 1463 return None
1442 1464
1443 def _path_to_image_diff(self): 1465 def _path_to_image_diff(self):
1444 """Returns the full path to the image_diff binary, or None if it is not available. 1466 """Returns the full path to the image_diff binary, or None if it is not available.
1445 1467
1446 This is likely used only by diff_image()""" 1468 This is likely used only by diff_image()"""
1447 return self._build_path('image_diff') 1469 return self._build_path('image_diff')
1448 1470
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 1471 @memoized
1468 def _path_to_wdiff(self): 1472 def _path_to_wdiff(self):
1469 """Returns the full path to the wdiff binary, or None if it is not avail able. 1473 """Returns the full path to the wdiff binary, or None if it is not avail able.
1470 1474
1471 This is likely used only by wdiff_text()""" 1475 This is likely used only by wdiff_text()"""
1472 for path in ("/usr/bin/wdiff", "/usr/bin/dwdiff"): 1476 for path in ("/usr/bin/wdiff", "/usr/bin/dwdiff"):
1473 if self._filesystem.exists(path): 1477 if self._filesystem.exists(path):
1474 return path 1478 return path
1475 return None 1479 return None
1476 1480
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 if name.find('/') != -1: 1745 if name.find('/') != -1:
1742 _log.error("Virtual test suites names cannot contain /'s: %s" % name) 1746 _log.error("Virtual test suites names cannot contain /'s: %s" % name)
1743 return 1747 return
1744 self.name = 'virtual/' + name + '/' + base 1748 self.name = 'virtual/' + name + '/' + base
1745 self.base = base 1749 self.base = base
1746 self.args = args 1750 self.args = args
1747 self.tests = tests or set() 1751 self.tests = tests or set()
1748 1752
1749 def __repr__(self): 1753 def __repr__(self):
1750 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args) 1754 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698