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

Side by Side Diff: pydir/utils.py

Issue 1604063002: Subzero: Always enable --echo-cmd in the lit tests. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: changes suggested by stichnot Created 4 years, 11 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 | tests_lit/lit.cfg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os 1 import os
2 import subprocess 2 import subprocess
3 import sys 3 import sys
4 4
5 def shellcmd(command, echo=True): 5 def shellcmd(command, echo=True):
6 if not isinstance(command, str): 6 if not isinstance(command, str):
7 command = ' '.join(command) 7 command = ' '.join(command)
8 8
9 if echo: print '[cmd]', command 9 if echo:
10 print >> sys.stderr, '[cmd]'
11 print >> sys.stderr, command
12 print >> sys.stderr
10 13
11 stdout_result = subprocess.check_output(command, shell=True) 14 stdout_result = subprocess.check_output(command, shell=True)
12 if echo: sys.stdout.write(stdout_result) 15 if echo: sys.stdout.write(stdout_result)
13 return stdout_result 16 return stdout_result
14 17
15 def FindBaseNaCl(): 18 def FindBaseNaCl():
16 """Find the base native_client/ directory.""" 19 """Find the base native_client/ directory."""
17 nacl = 'native_client' 20 nacl = 'native_client'
18 path_list = os.getcwd().split(os.sep) 21 path_list = os.getcwd().split(os.sep)
19 """Use the executable path if cwd does not contain 'native_client' """ 22 """Use the executable path if cwd does not contain 'native_client' """
20 path_list = path_list if nacl in path_list else sys.argv[0].split(os.sep) 23 path_list = path_list if nacl in path_list else sys.argv[0].split(os.sep)
21 if nacl not in path_list: 24 if nacl not in path_list:
22 print "Script must be executed from within 'native_client' directory" 25 print "Script must be executed from within 'native_client' directory"
23 exit(1) 26 exit(1)
24 last_index = len(path_list) - path_list[::-1].index(nacl) 27 last_index = len(path_list) - path_list[::-1].index(nacl)
25 return os.sep.join(path_list[:last_index]) 28 return os.sep.join(path_list[:last_index])
26 29
27 def get_sfi_string(args, sb_ret, nonsfi_ret, native_ret): 30 def get_sfi_string(args, sb_ret, nonsfi_ret, native_ret):
28 """Return a value depending on args.sandbox and args.nonsfi.""" 31 """Return a value depending on args.sandbox and args.nonsfi."""
29 if args.sandbox: 32 if args.sandbox:
30 assert(not args.nonsfi) 33 assert(not args.nonsfi)
31 return sb_ret 34 return sb_ret
32 if args.nonsfi: 35 if args.nonsfi:
33 return nonsfi_ret 36 return nonsfi_ret
34 return native_ret 37 return native_ret
OLDNEW
« no previous file with comments | « no previous file | tests_lit/lit.cfg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698