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

Side by Side Diff: testing/test_env.py

Issue 17648002: testing/test_env.py: don't silently disable the sandbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 """Sets environment variables needed to run a chromium unit test.""" 6 """Sets environment variables needed to run a chromium unit test."""
7 7
8 import os 8 import os
9 import stat 9 import stat
10 import subprocess 10 import subprocess
(...skipping 26 matching lines...) Expand all
37 """Checks enables the sandbox if it is required, otherwise it disables it.""" 37 """Checks enables the sandbox if it is required, otherwise it disables it."""
38 chrome_sandbox_path = env.get(CHROME_SANDBOX_ENV, CHROME_SANDBOX_PATH) 38 chrome_sandbox_path = env.get(CHROME_SANDBOX_ENV, CHROME_SANDBOX_PATH)
39 39
40 if should_enable_sandbox(chrome_sandbox_path): 40 if should_enable_sandbox(chrome_sandbox_path):
41 if verbose: 41 if verbose:
42 print 'Enabling sandbox. Setting environment variable:' 42 print 'Enabling sandbox. Setting environment variable:'
43 print ' %s="%s"' % (CHROME_SANDBOX_ENV, chrome_sandbox_path) 43 print ' %s="%s"' % (CHROME_SANDBOX_ENV, chrome_sandbox_path)
44 env[CHROME_SANDBOX_ENV] = chrome_sandbox_path 44 env[CHROME_SANDBOX_ENV] = chrome_sandbox_path
45 else: 45 else:
46 if verbose: 46 if verbose:
47 print 'Disabling sandbox. Setting environment variable:' 47 print 'Sandbox not properly installed. Unsetting:'
48 print ' %s=""' % CHROME_SANDBOX_ENV 48 print ' %s' % CHROME_SANDBOX_ENV
49 env[CHROME_SANDBOX_ENV] = '' 49 # The variable should be removed from the environment, making
50 # the variable empty silently disables the sandbox.
51 env.pop(CHROME_SANDBOX_ENV)
50 52
51 53
52 def fix_python_path(cmd): 54 def fix_python_path(cmd):
53 """Returns the fixed command line to call the right python executable.""" 55 """Returns the fixed command line to call the right python executable."""
54 out = cmd[:] 56 out = cmd[:]
55 if out[0] == 'python': 57 if out[0] == 'python':
56 out[0] = sys.executable 58 out[0] = sys.executable
57 elif out[0].endswith('.py'): 59 elif out[0].endswith('.py'):
58 out.insert(0, sys.executable) 60 out.insert(0, sys.executable)
59 return out 61 return out
(...skipping 21 matching lines...) Expand all
81 print >> sys.stderr, 'Failed to start %s' % cmd 83 print >> sys.stderr, 'Failed to start %s' % cmd
82 raise 84 raise
83 85
84 86
85 def main(): 87 def main():
86 return run_executable(sys.argv[1:], os.environ.copy()) 88 return run_executable(sys.argv[1:], os.environ.copy())
87 89
88 90
89 if __name__ == '__main__': 91 if __name__ == '__main__':
90 sys.exit(main()) 92 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