Index: build/android/pylib/junit/test_runner.py |
diff --git a/build/android/pylib/junit/test_runner.py b/build/android/pylib/junit/test_runner.py |
index a97841264dfaf13e314bdd553e5dda3226cc610b..9a60c12a991abd28ed2514689a7aa394c0c9ed2e 100644 |
--- a/build/android/pylib/junit/test_runner.py |
+++ b/build/android/pylib/junit/test_runner.py |
@@ -47,7 +47,12 @@ class JavaTestRunner(object): |
# Add JVM arguments. |
jvm_args = [] |
if self._coverage_dir: |
- jvm_args.append('-Demma.coverage.out.file=%s' % self._coverage_dir) |
+ if not os.path.exists(self._coverage_dir): |
+ os.makedirs(self._coverage_dir) |
+ elif not os.path.isdir(self._coverage_dir): |
+ raise Exception('--coverage-dir takes a directory, not file path.') |
+ jvm_args.append('-Demma.coverage.out.file=%s' % os.path.join( |
+ self._coverage_dir, '%s.ec' % self._test_suite)) |
if jvm_args: |
command.extend(['--jvm-args', '"%s"' % ' '.join(jvm_args)]) |