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

Unified Diff: mojo/tools/apptest_runner.py

Issue 878933003: Move the apptest runner and parts of mopy to the public SDK. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/tools/android_mojo_shell.py ('k') | mojo/tools/check_mojom_golden_files.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/apptest_runner.py
diff --git a/mojo/tools/apptest_runner.py b/mojo/tools/apptest_runner.py
deleted file mode 100755
index c3e61ad107d473c0a091b89f6b2557b6514d4d83..0000000000000000000000000000000000000000
--- a/mojo/tools/apptest_runner.py
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""A test runner for gtest application tests."""
-
-import argparse
-import ast
-import logging
-import sys
-
-_logging = logging.getLogger()
-
-from mopy import android
-from mopy import gtest
-from mopy.background_app_group import BackgroundAppGroup
-from mopy.config import Config
-from mopy.gn import ConfigForGNArgs, ParseGNConfig
-from mopy.paths import Paths
-
-
-def main():
- logging.basicConfig()
- # Uncomment to debug:
- #_logging.setLevel(logging.DEBUG)
-
- parser = argparse.ArgumentParser(description='A test runner for gtest '
- 'application tests.')
-
- parser.add_argument('apptest_list_file', type=file,
- help='A file listing apptests to run.')
- parser.add_argument('build_dir', type=str,
- help='The build output directory.')
- args = parser.parse_args()
-
- apptest_list = ast.literal_eval(args.apptest_list_file.read())
- _logging.debug("Test list: %s" % apptest_list)
-
- config = ConfigForGNArgs(ParseGNConfig(args.build_dir))
- is_android = (config.target_os == Config.OS_ANDROID)
- android_context = android.PrepareShellRun(config) if is_android else None
-
- gtest.set_color()
- mojo_paths = Paths(config)
-
- exit_code = 0
- for apptest_dict in apptest_list:
- if apptest_dict.get("disabled"):
- continue
-
- apptest = apptest_dict["test"]
- apptest_args = apptest_dict.get("test-args", [])
- shell_args = apptest_dict.get("shell-args", [])
- launched_services = apptest_dict.get("launched-services", [])
-
- print "Running " + apptest + "...",
- sys.stdout.flush()
-
- # List the apptest fixtures so they can be run independently for isolation.
- # TODO(msw): Run some apptests without fixture isolation?
- fixtures = gtest.get_fixtures(config, apptest, android_context)
-
- if not fixtures:
- print "Failed with no tests found."
- exit_code = 1
- continue
-
- if any(not mojo_paths.IsValidAppUrl(url) for url in launched_services):
- print "Failed with malformed launched-services: %r" % launched_services
- exit_code = 1
- continue
-
- apptest_result = "Succeeded"
- for fixture in fixtures:
- args_for_apptest = apptest_args + ["--gtest_filter=%s" % fixture]
- if launched_services:
- success = RunApptestInLauncher(config, mojo_paths, apptest,
- args_for_apptest, shell_args,
- launched_services)
- else:
- success = RunApptestInShell(config, apptest, args_for_apptest,
- shell_args, android_context)
-
- if not success:
- apptest_result = "Failed test(s) in %r" % apptest_dict
- exit_code = 1
-
- print apptest_result
-
- return exit_code
-
-
-def RunApptestInShell(config, application, application_args, shell_args,
- android_context):
- return gtest.run_test(config, shell_args,
- {application: application_args}, android_context)
-
-
-def RunApptestInLauncher(config, mojo_paths, application, application_args,
- shell_args, launched_services):
- with BackgroundAppGroup(
- mojo_paths, launched_services,
- gtest.build_shell_arguments(shell_args,
- {application: application_args},
- run_apps=False)) as apps:
- launcher_args = [
- '--shell-path=' + apps.socket_path,
- '--app-url=' + application,
- '--app-path=' + mojo_paths.FileFromUrl(application)]
- return gtest.run_test(config, launcher_args, run_launcher=True)
-
-
-if __name__ == '__main__':
- sys.exit(main())
« no previous file with comments | « mojo/tools/android_mojo_shell.py ('k') | mojo/tools/check_mojom_golden_files.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698