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

Side by Side Diff: tools/android-run.py

Issue 2070323002: Bug fix: android-run.py (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Error loading file Created 4 years, 6 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 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 tmp_file = open(fname, "w") 81 tmp_file = open(fname, "w")
82 tmp_file.write(data) 82 tmp_file.write(data)
83 tmp_file.close() 83 tmp_file.close()
84 return fname 84 return fname
85 85
86 def Main(): 86 def Main():
87 if (len(sys.argv) == 1): 87 if (len(sys.argv) == 1):
88 print("Usage: %s <command-to-run-on-device>" % sys.argv[0]) 88 print("Usage: %s <command-to-run-on-device>" % sys.argv[0])
89 return 1 89 return 1
90 workspace = abspath(join(dirname(sys.argv[0]), '..')) 90 workspace = abspath(join(dirname(sys.argv[0]), '..'))
91 android_workspace = os.getenv("ANDROID_V8", "/data/local/tmp/v8") 91 v8_root = "/data/local/tmp/v8"
92 android_workspace = os.getenv("ANDROID_V8", v8_root)
92 args = [Escape(arg) for arg in sys.argv[1:]] 93 args = [Escape(arg) for arg in sys.argv[1:]]
93 script = (" ".join(args) + "\n" 94 script = (" ".join(args) + "\n"
94 "case $? in\n" 95 "case $? in\n"
95 " 0) ;;\n" 96 " 0) ;;\n"
96 " *) echo \"ANDROID: Error returned by test\";;\n" 97 " *) echo \"ANDROID: Error returned by test\";;\n"
97 "esac\n") 98 "esac\n")
98 script = script.replace(workspace, android_workspace) 99 script = script.replace(workspace, android_workspace)
99 script_file = WriteToTemporaryFile(script) 100 script_file = WriteToTemporaryFile(script)
100 android_script_file = android_workspace + "/" + script_file 101 android_script_file = android_workspace + "/" + script_file
101 command = ("adb push '%s' %s;" % (script_file, android_script_file) + 102 command = ("adb push '%s' %s;" % (script_file, android_script_file) +
102 "adb shell 'sh %s';" % android_script_file + 103 "adb shell 'cd %s && sh %s';" % (v8_root, android_script_file) +
103 "adb shell 'rm %s'" % android_script_file) 104 "adb shell 'rm %s'" % android_script_file)
104 error_code = Execute(command) 105 error_code = Execute(command)
105 os.unlink(script_file) 106 os.unlink(script_file)
106 return error_code 107 return error_code
107 108
108 if __name__ == '__main__': 109 if __name__ == '__main__':
109 sys.exit(Main()) 110 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