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

Side by Side Diff: build/android/pylib/test_package_apk.py

Issue 10804003: Android: fix test runners for non-rooted devices. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 8 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 | testing/android/AndroidManifest.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 import os 6 import os
7 import re 7 import re
8 import sys 8 import sys
9 9
10 import cmd_helper 10 import cmd_helper
(...skipping 11 matching lines...) Expand all
22 device: Device to run the tests. 22 device: Device to run the tests.
23 test_suite: A specific test suite to run, empty to run all. 23 test_suite: A specific test suite to run, empty to run all.
24 timeout: Timeout for each test. 24 timeout: Timeout for each test.
25 rebaseline: Whether or not to run tests in isolation and update the filter. 25 rebaseline: Whether or not to run tests in isolation and update the filter.
26 performance_test: Whether or not performance test(s). 26 performance_test: Whether or not performance test(s).
27 cleanup_test_files: Whether or not to cleanup test files on device. 27 cleanup_test_files: Whether or not to cleanup test files on device.
28 tool: Name of the Valgrind tool. 28 tool: Name of the Valgrind tool.
29 dump_debug_info: A debug_info object. 29 dump_debug_info: A debug_info object.
30 """ 30 """
31 31
32 APK_DATA_DIR = '/data/user/0/org.chromium.native_test/files/' 32 # The stdout.txt path is determined by:
33 # testing/android/java/src/org/chromium/native_test/
34 # ChromeNativeTestActivity.java
35 APK_STDOUT_FILE = '/sdcard/native_tests/stdout.txt'
33 36
34 def __init__(self, adb, device, test_suite, timeout, rebaseline, 37 def __init__(self, adb, device, test_suite, timeout, rebaseline,
35 performance_test, cleanup_test_files, tool, 38 performance_test, cleanup_test_files, tool,
36 dump_debug_info): 39 dump_debug_info):
37 TestPackage.__init__(self, adb, device, test_suite, timeout, 40 TestPackage.__init__(self, adb, device, test_suite, timeout,
38 rebaseline, performance_test, cleanup_test_files, 41 rebaseline, performance_test, cleanup_test_files,
39 tool, dump_debug_info) 42 tool, dump_debug_info)
40 43
41 def _CreateTestRunnerScript(self, options): 44 def _CreateTestRunnerScript(self, options):
42 command_line_file = tempfile.NamedTemporaryFile() 45 command_line_file = tempfile.NamedTemporaryFile()
(...skipping 19 matching lines...) Expand all
62 'am start -n ' 65 'am start -n '
63 'org.chromium.native_test/' 66 'org.chromium.native_test/'
64 'org.chromium.native_test.ChromeNativeTestActivity') 67 'org.chromium.native_test.ChromeNativeTestActivity')
65 # Wait for native test to complete. 68 # Wait for native test to complete.
66 self.adb.WaitForLogMatch(re.compile('<<nativeRunTests'), None) 69 self.adb.WaitForLogMatch(re.compile('<<nativeRunTests'), None)
67 finally: 70 finally:
68 self.tool.CleanUpEnvironment() 71 self.tool.CleanUpEnvironment()
69 # Copy stdout.txt and read contents. 72 # Copy stdout.txt and read contents.
70 stdout_file = tempfile.NamedTemporaryFile() 73 stdout_file = tempfile.NamedTemporaryFile()
71 ret = [] 74 ret = []
72 self.adb.Adb().Pull(TestPackageApk.APK_DATA_DIR + 'stdout.txt', 75 self.adb.Adb().Pull(TestPackageApk.APK_STDOUT_FILE, stdout_file.name)
73 stdout_file.name)
74 # We need to strip the trailing newline. 76 # We need to strip the trailing newline.
75 content = [line.rstrip() for line in open(stdout_file.name)] 77 content = [line.rstrip() for line in open(stdout_file.name)]
76 ret = self._ParseGTestListTests(content) 78 ret = self._ParseGTestListTests(content)
77 return ret 79 return ret
78 80
79 def CreateTestRunnerScript(self, gtest_filter, test_arguments): 81 def CreateTestRunnerScript(self, gtest_filter, test_arguments):
80 self._CreateTestRunnerScript('--gtest_filter=%s %s' % (gtest_filter, 82 self._CreateTestRunnerScript('--gtest_filter=%s %s' % (gtest_filter,
81 test_arguments)) 83 test_arguments))
82 84
83 def RunTestsAndListResults(self): 85 def RunTestsAndListResults(self):
(...skipping 16 matching lines...) Expand all
100 timeout_time=60*5) 102 timeout_time=60*5)
101 logging.info('Installing new apk') 103 logging.info('Installing new apk')
102 self.adb.Adb().SendCommand('install -r ' + self.test_suite_full, 104 self.adb.Adb().SendCommand('install -r ' + self.test_suite_full,
103 timeout_time=60*5) 105 timeout_time=60*5)
104 logging.info('Install has completed.') 106 logging.info('Install has completed.')
105 107
106 def _GetTestSuiteBaseName(self): 108 def _GetTestSuiteBaseName(self):
107 """Returns the base name of the test suite.""" 109 """Returns the base name of the test suite."""
108 # APK test suite names end with '-debug.apk' 110 # APK test suite names end with '-debug.apk'
109 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0] 111 return os.path.basename(self.test_suite).rsplit('-debug', 1)[0]
OLDNEW
« no previous file with comments | « no previous file | testing/android/AndroidManifest.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698