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

Side by Side Diff: scripts/slave/runtest.py

Issue 881743004: Remove obsolete sandbox disabling logic from runtest.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: s/should/must/ Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A tool used to run a Chrome test executable and process the output. 6 """A tool used to run a Chrome test executable and process the output.
7 7
8 This script is used by the buildbot slaves. It must be run from the outer 8 This script is used by the buildbot slaves. It must be run from the outer
9 build directory, e.g. chrome-release/build/. 9 build directory, e.g. chrome-release/build/.
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 # The directory that this script is in. 78 # The directory that this script is in.
79 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 79 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
80 80
81 LOG_PROCESSOR_CLASSES = { 81 LOG_PROCESSOR_CLASSES = {
82 'gtest': gtest_utils.GTestLogParser, 82 'gtest': gtest_utils.GTestLogParser,
83 'graphing': performance_log_processor.GraphingLogProcessor, 83 'graphing': performance_log_processor.GraphingLogProcessor,
84 'pagecycler': performance_log_processor.GraphingPageCyclerLogProcessor, 84 'pagecycler': performance_log_processor.GraphingPageCyclerLogProcessor,
85 } 85 }
86 86
87 87
88 def _ShouldEnableSandbox(sandbox_path):
89 """Checks whether the current slave should use the sandbox.
90
91 This is based on should_enable_sandbox in src/testing/test_env.py.
92
93 Args:
94 sandbox_path: Path to sandbox file.
95
96 Returns:
97 True iff the slave is a Linux host with the sandbox file both present and
98 configured correctly.
99 """
100 if not (sys.platform.startswith('linux') and
101 os.path.exists(sandbox_path)):
102 return False
103 sandbox_stat = os.stat(sandbox_path)
104 if ((sandbox_stat.st_mode & stat.S_ISUID) and
105 (sandbox_stat.st_mode & stat.S_IRUSR) and
106 (sandbox_stat.st_mode & stat.S_IXUSR) and
107 (sandbox_stat.st_uid == 0)):
108 return True
109 return False
110
111
112 def _GetTempCount(): 88 def _GetTempCount():
113 """Returns the number of files and directories inside the temporary dir.""" 89 """Returns the number of files and directories inside the temporary dir."""
114 return len(os.listdir(tempfile.gettempdir())) 90 return len(os.listdir(tempfile.gettempdir()))
115 91
116 92
117 def _LaunchDBus(): 93 def _LaunchDBus():
118 """Launches DBus to work around a bug in GLib. 94 """Launches DBus to work around a bug in GLib.
119 95
120 Works around a bug in GLib where it performs operations which aren't 96 Works around a bug in GLib where it performs operations which aren't
121 async-signal-safe (in particular, memory allocations) between fork and exec 97 async-signal-safe (in particular, memory allocations) between fork and exec
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 1306
1331 # Unset http_proxy and HTTPS_PROXY environment variables. When set, this 1307 # Unset http_proxy and HTTPS_PROXY environment variables. When set, this
1332 # causes some tests to hang. See http://crbug.com/139638 for more info. 1308 # causes some tests to hang. See http://crbug.com/139638 for more info.
1333 if 'http_proxy' in os.environ: 1309 if 'http_proxy' in os.environ:
1334 del os.environ['http_proxy'] 1310 del os.environ['http_proxy']
1335 print 'Deleted http_proxy environment variable.' 1311 print 'Deleted http_proxy environment variable.'
1336 if 'HTTPS_PROXY' in os.environ: 1312 if 'HTTPS_PROXY' in os.environ:
1337 del os.environ['HTTPS_PROXY'] 1313 del os.environ['HTTPS_PROXY']
1338 print 'Deleted HTTPS_PROXY environment variable.' 1314 print 'Deleted HTTPS_PROXY environment variable.'
1339 1315
1340 # Decide whether to enable the suid sandbox for Chrome. 1316 # Path to SUID sandbox binary. This must be installed on all bots.
1341 if (_ShouldEnableSandbox(CHROME_SANDBOX_PATH) and 1317 extra_env['CHROME_DEVEL_SANDBOX'] = CHROME_SANDBOX_PATH
1342 not options.enable_tsan and
1343 not options.enable_lsan):
1344 print 'Enabling sandbox. Setting environment variable:'
1345 print ' CHROME_DEVEL_SANDBOX="%s"' % CHROME_SANDBOX_PATH
1346 extra_env['CHROME_DEVEL_SANDBOX'] = CHROME_SANDBOX_PATH
1347 else:
1348 print 'Disabling sandbox. Setting environment variable:'
1349 print ' CHROME_DEVEL_SANDBOX=""'
1350 extra_env['CHROME_DEVEL_SANDBOX'] = ''
1351 1318
1352 # Nuke anything that appears to be stale chrome items in the temporary 1319 # Nuke anything that appears to be stale chrome items in the temporary
1353 # directory from previous test runs (i.e.- from crashes or unittest leaks). 1320 # directory from previous test runs (i.e.- from crashes or unittest leaks).
1354 slave_utils.RemoveChromeTemporaryFiles() 1321 slave_utils.RemoveChromeTemporaryFiles()
1355 1322
1356 extra_env['LD_LIBRARY_PATH'] = '' 1323 extra_env['LD_LIBRARY_PATH'] = ''
1357 1324
1358 if options.enable_lsan: 1325 if options.enable_lsan:
1359 # Use the debug version of libstdc++ under LSan. If we don't, there will be 1326 # Use the debug version of libstdc++ under LSan. If we don't, there will be
1360 # a lot of incomplete stack traces in the reports. 1327 # a lot of incomplete stack traces in the reports.
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 finally: 2046 finally:
2080 if did_launch_dbus: 2047 if did_launch_dbus:
2081 # It looks like the command line argument --exit-with-session 2048 # It looks like the command line argument --exit-with-session
2082 # isn't working to clean up the spawned dbus-daemon. Kill it 2049 # isn't working to clean up the spawned dbus-daemon. Kill it
2083 # manually. 2050 # manually.
2084 _ShutdownDBus() 2051 _ShutdownDBus()
2085 2052
2086 2053
2087 if '__main__' == __name__: 2054 if '__main__' == __name__:
2088 sys.exit(main()) 2055 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698