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

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

Issue 22978015: Clean up the way we determine which env vars to pass to content_shell. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/port/driver.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 return os.environ[name] 862 return os.environ[name]
863 return default 863 return default
864 864
865 def _copy_value_from_environ_if_set(self, clean_env, name): 865 def _copy_value_from_environ_if_set(self, clean_env, name):
866 if name in os.environ: 866 if name in os.environ:
867 clean_env[name] = os.environ[name] 867 clean_env[name] = os.environ[name]
868 868
869 def setup_environ_for_server(self, server_name=None): 869 def setup_environ_for_server(self, server_name=None):
870 # We intentionally copy only a subset of os.environ when 870 # We intentionally copy only a subset of os.environ when
871 # launching subprocesses to ensure consistent test results. 871 # launching subprocesses to ensure consistent test results.
872 clean_env = {} 872 clean_env = {
873 'LOCAL_RESOURCE_ROOT': self.layout_tests_dir(), # FIXME: Is this us ed?
874 }
873 variables_to_copy = [ 875 variables_to_copy = [
874 # For Linux: 876 'WEBKIT_TESTFONTS', # FIXME: Is this still used?
875 'XAUTHORITY', 877 'WEBKITOUTPUTDIR', # FIXME: Is this still used?
Dirk Pranke 2013/08/19 21:58:52 Note that I don't want to actually try and figure
876 'HOME',
877 'LANG',
878 'LD_LIBRARY_PATH',
879 'DBUS_SESSION_BUS_ADDRESS',
880 'XDG_DATA_DIRS',
881
882 # Darwin:
883 'DYLD_LIBRARY_PATH',
884 'HOME',
885
886 # CYGWIN:
887 'HOMEDRIVE',
888 'HOMEPATH',
889 '_NT_SYMBOL_PATH',
890
891 # Windows:
892 'PATH',
893
894 # Most ports (?):
895 'WEBKIT_TESTFONTS',
896 'WEBKITOUTPUTDIR',
897
898 # Chromium:
899 'CHROME_DEVEL_SANDBOX', 878 'CHROME_DEVEL_SANDBOX',
900 'CHROME_IPC_LOGGING', 879 'CHROME_IPC_LOGGING',
901 'ASAN_OPTIONS', 880 'ASAN_OPTIONS',
881 ]
882 if self.host.platform.is_linux() or self.host.platform.is_freebsd():
883 variables_to_copy += [
884 'XAUTHORITY',
885 'HOME',
886 'LANG',
887 'LD_LIBRARY_PATH',
888 'DBUS_SESSION_BUS_ADDRESS',
889 'XDG_DATA_DIRS',
890 ]
891 clean_env['DISPLAY'] = self._value_or_default_from_environ('DISPLAY' , ':1')
892 if self.host.platform.is_mac():
893 clean_env['DYLD_LIBRARY_PATH'] = self._build_path()
894 clean_env['DYLD_FRAMEWORK_PATH'] = self._build_path()
895 variables_to_copy += [
896 'HOME',
897 ]
898 if self.host.platform.is_win():
899 variables_to_copy += [
900 'PATH',
901 ]
902 if self.host.platform.is_cygwin():
903 variables_to_copy += [
904 'HOMEDRIVE',
905 'HOMEPATH',
906 '_NT_SYMBOL_PATH',
907 ]
902 908
903 ]
904 for variable in variables_to_copy: 909 for variable in variables_to_copy:
905 self._copy_value_from_environ_if_set(clean_env, variable) 910 self._copy_value_from_environ_if_set(clean_env, variable)
906 911
907 # For Linux:
908 clean_env['DISPLAY'] = self._value_or_default_from_environ('DISPLAY', ': 1')
909
910 for string_variable in self.get_option('additional_env_var', []): 912 for string_variable in self.get_option('additional_env_var', []):
911 [name, value] = string_variable.split('=', 1) 913 [name, value] = string_variable.split('=', 1)
912 clean_env[name] = value 914 clean_env[name] = value
913 915
914 return clean_env 916 return clean_env
915 917
916 def show_results_html_file(self, results_filename): 918 def show_results_html_file(self, results_filename):
917 """This routine should display the HTML file pointed at by 919 """This routine should display the HTML file pointed at by
918 results_filename in a users' browser.""" 920 results_filename in a users' browser."""
919 return self.host.user.open_url(path.abspath_to_uri(self.host.platform, r esults_filename)) 921 return self.host.user.open_url(path.abspath_to_uri(self.host.platform, r esults_filename))
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 1446
1445 class VirtualTestSuite(object): 1447 class VirtualTestSuite(object):
1446 def __init__(self, name, base, args, tests=None): 1448 def __init__(self, name, base, args, tests=None):
1447 self.name = name 1449 self.name = name
1448 self.base = base 1450 self.base = base
1449 self.args = args 1451 self.args = args
1450 self.tests = tests or set() 1452 self.tests = tests or set()
1451 1453
1452 def __repr__(self): 1454 def __repr__(self):
1453 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args) 1455 return "VirtualTestSuite('%s', '%s', %s)" % (self.name, self.base, self. args)
OLDNEW
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/port/driver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698