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

Side by Side Diff: client/bin/unit_test.py

Issue 3116009: Update autotest tests to use make -j where possible. (Closed) Base URL: ssh://git@chromiumos-git/autotest.git
Patch Set: Convert last two tests to use utils.make(), saving another 20 seconds. Created 10 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 | client/common_lib/utils.py » ('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) 2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2010 The Chromium OS 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 import logging, os 5 import logging, os
6 6
7 from autotest_lib.client.bin import test 7 from autotest_lib.client.bin import test
8 from autotest_lib.client.common_lib import utils 8 from autotest_lib.client.common_lib import utils
9 9
10 class unit_test(test.test): 10 class unit_test(test.test):
11 """ 11 """
12 Unit test should simply subclass this test which handles everything. 12 Unit test should simply subclass this test which handles everything.
13 """ 13 """
14 version = 1 14 version = 1
15 preserve_srcdir = True 15 preserve_srcdir = True
16 16
17 17
18 def setup(self): 18 def setup(self):
19 os.chdir(self.srcdir) 19 os.chdir(self.srcdir)
20 utils.system('make clean') 20 utils.make('clean')
21 utils.system('make all') 21 utils.make('all')
22 22
23 self.job.setup_dep(['gtest']) 23 self.job.setup_dep(['gtest'])
24 24
25 def run_once(self): 25 def run_once(self):
26 dep ='gtest' 26 dep ='gtest'
27 dep_dir = os.path.join(self.autodir, 'deps', dep) 27 dep_dir = os.path.join(self.autodir, 'deps', dep)
28 self.job.install_pkg(dep, 'dep', dep_dir) 28 self.job.install_pkg(dep, 'dep', dep_dir)
29 29
30 # Run the unit test, gather the results and place the gcda files for 30 # Run the unit test, gather the results and place the gcda files for
31 # code coverage in the results directory. 31 # code coverage in the results directory.
32 32
33 os.chdir(self.srcdir) 33 os.chdir(self.srcdir)
34 result = utils.run('LD_LIBRARY_PATH=' + dep_dir + 34 result = utils.run('LD_LIBRARY_PATH=' + dep_dir +
35 ' GCOV_PREFIX=' + self.resultsdir + 35 ' GCOV_PREFIX=' + self.resultsdir +
36 ' GCOV_PREFIX_STRIP=9999 ./unit_test > ' + 36 ' GCOV_PREFIX_STRIP=9999 ./unit_test > ' +
37 self.resultsdir + '/unit_test_result.txt') 37 self.resultsdir + '/unit_test_result.txt')
38 logging.debug(result.stderr) 38 logging.debug(result.stderr)
39 logging.info('result: ' + self.resultsdir + '/unit_test_result.txt') 39 logging.info('result: ' + self.resultsdir + '/unit_test_result.txt')
40 40
41 def cleanup(self): 41 def cleanup(self):
42 # This is a hack - we should only need to copy back the .gcda file but 42 # This is a hack - we should only need to copy back the .gcda file but
43 # we don't know how to access the source on the server. So copy 43 # we don't know how to access the source on the server. So copy
44 # everything back. 44 # everything back.
45 45
46 os.chdir(self.srcdir) 46 os.chdir(self.srcdir)
47 utils.run('cp * ' + self.resultsdir) 47 utils.run('cp * ' + self.resultsdir)
OLDNEW
« no previous file with comments | « no previous file | client/common_lib/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698