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

Side by Side Diff: build/android/pylib/gtest/test_package_exe.py

Issue 22903016: [android] Adds constants.GetOutDirectory() and converts test scripts to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix provision_devices.py which never set the build type Created 7 years, 3 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
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 """Defines TestPackageExecutable to help run stand-alone executables.""" 5 """Defines TestPackageExecutable to help run stand-alone executables."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import shutil 9 import shutil
10 import sys 10 import sys
(...skipping 10 matching lines...) Expand all
21 """A helper class for running stand-alone executables.""" 21 """A helper class for running stand-alone executables."""
22 22
23 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval' 23 _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval'
24 24
25 def __init__(self, suite_name): 25 def __init__(self, suite_name):
26 """ 26 """
27 Args: 27 Args:
28 suite_name: Name of the test suite (e.g. base_unittests). 28 suite_name: Name of the test suite (e.g. base_unittests).
29 """ 29 """
30 TestPackage.__init__(self, suite_name) 30 TestPackage.__init__(self, suite_name)
31 product_dir = os.path.join(cmd_helper.OutDirectory.get(), 31 self.suite_path = os.path.join(constants.GetOutDirectory(), suite_name)
32 constants.GetBuildType()) 32 self._symbols_dir = os.path.join(constants.GetOutDirectory(),
33 self.suite_path = os.path.join(product_dir, suite_name) 33 'lib.target')
34 self._symbols_dir = os.path.join(product_dir, 'lib.target')
35 34
36 #override 35 #override
37 def GetGTestReturnCode(self, adb): 36 def GetGTestReturnCode(self, adb):
38 ret = None 37 ret = None
39 ret_code = 1 # Assume failure if we can't find it 38 ret_code = 1 # Assume failure if we can't find it
40 ret_code_file = tempfile.NamedTemporaryFile() 39 ret_code_file = tempfile.NamedTemporaryFile()
41 try: 40 try:
42 if not adb.Adb().Pull( 41 if not adb.Adb().Pull(
43 constants.TEST_EXECUTABLE_DIR + '/' + 42 constants.TEST_EXECUTABLE_DIR + '/' +
44 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE, 43 TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 'new one (%s).' % target_name) 138 'new one (%s).' % target_name)
140 # Whenever we generate a stripped binary, copy to the symbols dir. If we 139 # Whenever we generate a stripped binary, copy to the symbols dir. If we
141 # aren't stripping a new binary, assume it's there. 140 # aren't stripping a new binary, assume it's there.
142 if not os.path.exists(self._symbols_dir): 141 if not os.path.exists(self._symbols_dir):
143 os.makedirs(self._symbols_dir) 142 os.makedirs(self._symbols_dir)
144 shutil.copy(self.suite_path, self._symbols_dir) 143 shutil.copy(self.suite_path, self._symbols_dir)
145 strip = os.environ['STRIP'] 144 strip = os.environ['STRIP']
146 cmd_helper.RunCmd([strip, self.suite_path, '-o', target_name]) 145 cmd_helper.RunCmd([strip, self.suite_path, '-o', target_name])
147 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name 146 test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.suite_name
148 adb.PushIfNeeded(target_name, test_binary) 147 adb.PushIfNeeded(target_name, test_binary)
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/test_package_apk.py ('k') | build/android/pylib/host_driven/test_case.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698