Revert "Revert "Upgrade to 5.0.71.48"" DO NOT MERGE
This reverts commit f2e3994fa5148cc3d9946666f0b0596290192b0e,
and updates the x64 makefile properly so it doesn't break that
build.
Change-Id: Ib83e35bfbae6af627451c926a9650ec57c045605
(cherry picked from commit 109988c7ccb6f3fd1a58574fa3dfb88beaef6632)
diff --git a/build/android/pylib/junit/__init__.py b/build/android/pylib/junit/__init__.py
new file mode 100644
index 0000000..5cac026
--- /dev/null
+++ b/build/android/pylib/junit/__init__.py
@@ -0,0 +1,4 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
diff --git a/build/android/pylib/junit/setup.py b/build/android/pylib/junit/setup.py
new file mode 100644
index 0000000..94d4277
--- /dev/null
+++ b/build/android/pylib/junit/setup.py
@@ -0,0 +1,20 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from pylib.junit import test_runner
+
+def Setup(args):
+ """Creates a test runner factory for junit tests.
+
+ Args:
+ args: an argparse.Namespace object.
+ Return:
+ A (runner_factory, tests) tuple.
+ """
+
+ def TestRunnerFactory(_unused_device, _unused_shard_index):
+ return test_runner.JavaTestRunner(args)
+
+ return (TestRunnerFactory, ['JUnit tests'])
+
diff --git a/build/android/pylib/junit/test_dispatcher.py b/build/android/pylib/junit/test_dispatcher.py
new file mode 100644
index 0000000..51253d4
--- /dev/null
+++ b/build/android/pylib/junit/test_dispatcher.py
@@ -0,0 +1,29 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from pylib import constants
+from pylib.base import base_test_result
+
+def RunTests(tests, runner_factory):
+ """Runs a set of java tests on the host.
+
+ Return:
+ A tuple containing the results & the exit code.
+ """
+ def run(t):
+ runner = runner_factory(None, None)
+ runner.SetUp()
+ results_list, return_code = runner.RunTest(t)
+ runner.TearDown()
+ return (results_list, return_code == 0)
+
+ test_run_results = base_test_result.TestRunResults()
+ exit_code = 0
+ for t in tests:
+ results_list, passed = run(t)
+ test_run_results.AddResults(results_list)
+ if not passed:
+ exit_code = constants.ERROR_EXIT_CODE
+ return (test_run_results, exit_code)
+
diff --git a/build/android/pylib/junit/test_runner.py b/build/android/pylib/junit/test_runner.py
new file mode 100644
index 0000000..6238fe1
--- /dev/null
+++ b/build/android/pylib/junit/test_runner.py
@@ -0,0 +1,49 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import json
+import os
+import tempfile
+
+from devil.utils import cmd_helper
+from pylib import constants
+from pylib.results import json_results
+
+class JavaTestRunner(object):
+ """Runs java tests on the host."""
+
+ def __init__(self, args):
+ self._package_filter = args.package_filter
+ self._runner_filter = args.runner_filter
+ self._sdk_version = args.sdk_version
+ self._test_filter = args.test_filter
+ self._test_suite = args.test_suite
+
+ def SetUp(self):
+ pass
+
+ def RunTest(self, _test):
+ """Runs junit tests from |self._test_suite|."""
+ with tempfile.NamedTemporaryFile() as json_file:
+ java_script = os.path.join(
+ constants.GetOutDirectory(), 'bin', 'helper', self._test_suite)
+ command = [java_script,
+ '-test-jars', self._test_suite + '.jar',
+ '-json-results-file', json_file.name]
+ if self._test_filter:
+ command.extend(['-gtest-filter', self._test_filter])
+ if self._package_filter:
+ command.extend(['-package-filter', self._package_filter])
+ if self._runner_filter:
+ command.extend(['-runner-filter', self._runner_filter])
+ if self._sdk_version:
+ command.extend(['-sdk-version', self._sdk_version])
+ return_code = cmd_helper.RunCmd(command)
+ results_list = json_results.ParseResultsFromJson(
+ json.loads(json_file.read()))
+ return (results_list, return_code)
+
+ def TearDown(self):
+ pass
+