OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import json | 5 import json |
6 import os | 6 import os |
7 import tempfile | 7 import tempfile |
8 | 8 |
9 from devil.utils import cmd_helper | 9 from devil.utils import cmd_helper |
10 from pylib import constants | 10 from pylib import constants |
(...skipping 29 matching lines...) Expand all Loading... |
40 jar_args.extend(['-package-filter', self._package_filter]) | 40 jar_args.extend(['-package-filter', self._package_filter]) |
41 if self._runner_filter: | 41 if self._runner_filter: |
42 jar_args.extend(['-runner-filter', self._runner_filter]) | 42 jar_args.extend(['-runner-filter', self._runner_filter]) |
43 if self._sdk_version: | 43 if self._sdk_version: |
44 jar_args.extend(['-sdk-version', self._sdk_version]) | 44 jar_args.extend(['-sdk-version', self._sdk_version]) |
45 command.extend(['--jar-args', '"%s"' % ' '.join(jar_args)]) | 45 command.extend(['--jar-args', '"%s"' % ' '.join(jar_args)]) |
46 | 46 |
47 # Add JVM arguments. | 47 # Add JVM arguments. |
48 jvm_args = [] | 48 jvm_args = [] |
49 if self._coverage_dir: | 49 if self._coverage_dir: |
50 jvm_args.append('-Demma.coverage.out.file=%s' % self._coverage_dir) | 50 if not os.path.exists(self._coverage_dir): |
| 51 os.makedirs(self._coverage_dir) |
| 52 elif not os.path.isdir(self._coverage_dir): |
| 53 raise Exception('--coverage-dir takes a directory, not file path.') |
| 54 jvm_args.append('-Demma.coverage.out.file=%s' % os.path.join( |
| 55 self._coverage_dir, '%s.ec' % self._test_suite)) |
51 if jvm_args: | 56 if jvm_args: |
52 command.extend(['--jvm-args', '"%s"' % ' '.join(jvm_args)]) | 57 command.extend(['--jvm-args', '"%s"' % ' '.join(jvm_args)]) |
53 | 58 |
54 return_code = cmd_helper.RunCmd(command) | 59 return_code = cmd_helper.RunCmd(command) |
55 results_list = json_results.ParseResultsFromJson( | 60 results_list = json_results.ParseResultsFromJson( |
56 json.loads(json_file.read())) | 61 json.loads(json_file.read())) |
57 return (results_list, return_code) | 62 return (results_list, return_code) |
58 | 63 |
59 def TearDown(self): | 64 def TearDown(self): |
60 pass | 65 pass |
61 | 66 |
OLD | NEW |