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

Side by Side Diff: testing/test_env.py

Issue 10825322: Set LANG variable in test_env.py (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« 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 subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 12 matching lines...) Expand all
23 return out 23 return out
24 24
25 25
26 def run_executable(cmd, env): 26 def run_executable(cmd, env):
27 """Runs an executable with: 27 """Runs an executable with:
28 - environment variable CR_SOURCE_ROOT set to the root directory. 28 - environment variable CR_SOURCE_ROOT set to the root directory.
29 - environment variable LANGUAGE to en_US.UTF-8. 29 - environment variable LANGUAGE to en_US.UTF-8.
30 - Reuses sys.executable automatically. 30 - Reuses sys.executable automatically.
31 """ 31 """
32 # Many tests assume a English interface... 32 # Many tests assume a English interface...
33 env['LANGUAGE'] = 'en_US.UTF-8' 33 env['LANG'] = 'en_US.UTF-8'
34 # Used by base/base_paths_linux.cc as an override. Just make sure the default 34 # Used by base/base_paths_linux.cc as an override. Just make sure the default
35 # logic is used. 35 # logic is used.
36 env.pop('CR_SOURCE_ROOT', None) 36 env.pop('CR_SOURCE_ROOT', None)
37 # Ensure paths are correctly separated on windows. 37 # Ensure paths are correctly separated on windows.
38 cmd[0] = cmd[0].replace('/', os.path.sep) 38 cmd[0] = cmd[0].replace('/', os.path.sep)
39 cmd = fix_python_path(cmd) 39 cmd = fix_python_path(cmd)
40 try: 40 try:
41 return subprocess.call(cmd, env=env) 41 return subprocess.call(cmd, env=env)
42 except OSError: 42 except OSError:
43 print >> sys.stderr, 'Failed to start %s' % cmd 43 print >> sys.stderr, 'Failed to start %s' % cmd
44 raise 44 raise
45 45
46 46
47 def main(): 47 def main():
48 return run_executable(sys.argv[1:], os.environ.copy()) 48 return run_executable(sys.argv[1:], os.environ.copy())
49 49
50 50
51 if __name__ == "__main__": 51 if __name__ == "__main__":
52 sys.exit(main()) 52 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