Commit 47d20da2 authored by craigdh@chromium.org's avatar craigdh@chromium.org

[Android] Move GTest options to test_options_parser.py.

Also move some packages to utils.

BUG=167331
TEST=run_tests.py, device_stats_monitor.py

Review URL: https://codereview.chromium.org/11759012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175397 0039d316-1c4b-4281-b951-d872f2087c98
parent ead9009e
......@@ -10,9 +10,9 @@ import os
import sys
from pylib import android_commands
from pylib import apk_info
from pylib import constants
from pylib import test_options_parser
from pylib.utils import apk_info
from pylib.utils import test_options_parser
def _InstallApk(args):
......
......@@ -17,7 +17,7 @@ import time
from pylib import android_commands
from pylib import device_stats_monitor
from pylib import test_options_parser
from pylib.utils import test_options_parser
def main(argv):
......
......@@ -13,10 +13,10 @@ from base_test_runner import BaseTestRunner
import constants
import debug_info
import perf_tests_helper
import run_tests_helper
from test_package_apk import TestPackageApk
from test_package_executable import TestPackageExecutable
from test_result import BaseTestResult, TestResults
from utils import run_tests_helper
class SingleTestRunner(BaseTestRunner):
......
......@@ -4,7 +4,9 @@
"""Parses options for the instrumentation tests."""
import constants
#TODO(craigdh): pylib/utils/ should not depend on pylib/.
from pylib import constants
import optparse
import os
import sys
......@@ -80,6 +82,58 @@ def AddTestRunnerOptions(option_parser, default_timeout=60):
AddBuildTypeOption(option_parser)
def AddGTestOptions(option_parser):
"""Decorates OptionParser with GTest tests options."""
AddTestRunnerOptions(option_parser, default_timeout=0)
option_parser.add_option('-s', '--suite', dest='test_suite',
help='Executable name of the test suite to run '
'(use -s help to list them).')
option_parser.add_option('--out-directory', dest='out_directory',
help='Path to the out/ directory, irrespective of '
'the build type. Only for non-Chromium uses.')
option_parser.add_option('-d', '--device', dest='test_device',
help='Target device for the test suite to run on.')
option_parser.add_option('-f', '--gtest_filter', dest='gtest_filter',
help='gtest filter.')
#TODO(craigdh): Replace _ with - in arguments for consistency.
option_parser.add_option('-a', '--test_arguments', dest='test_arguments',
help='Additional arguments to pass to the test.')
option_parser.add_option('-L', dest='log_dump',
help='File name of log dump, which will be put in '
'subfolder debug_info_dumps under the same '
'directory in where the test_suite exists.')
option_parser.add_option('-e', '--emulator', dest='use_emulator',
action='store_true',
help='Run tests in a new instance of emulator.')
option_parser.add_option('-n', '--emulator_count',
type='int', default=1,
help='Number of emulators to launch for running the '
'tests.')
option_parser.add_option('-x', '--xvfb', dest='use_xvfb',
action='store_true',
help='Use Xvfb around tests (ignored if not Linux).')
option_parser.add_option('--webkit', action='store_true',
help='Run the tests from a WebKit checkout.')
option_parser.add_option('--fast', '--fast_and_loose', dest='fast_and_loose',
action='store_true',
help='Go faster (but be less stable), '
'for quick testing. Example: when tracking down '
'tests that hang to add to the disabled list, '
'there is no need to redeploy the test binary '
'or data to the device again. '
'Don\'t use on bots by default!')
option_parser.add_option('--repeat', dest='repeat', type='int',
default=2,
help='Repeat count on test timeout.')
option_parser.add_option('--exit_code', action='store_true',
help='If set, the exit code will be total number '
'of failures.')
option_parser.add_option('--exe', action='store_true',
help='If set, use the exe test runner instead of '
'the APK.')
def AddInstrumentationOptions(option_parser):
"""Decorates OptionParser with instrumentation tests options."""
......
......@@ -17,9 +17,9 @@ from pylib import constants
from pylib import ports
from pylib import run_java_tests
from pylib import run_python_tests
from pylib import run_tests_helper
from pylib import test_options_parser
from pylib.test_result import TestResults
from pylib.utils import run_tests_helper
from pylib.utils import test_options_parser
def DispatchInstrumentationTests(options):
......
......@@ -51,10 +51,10 @@ from pylib import buildbot_report
from pylib import cmd_helper
from pylib import debug_info
from pylib import ports
from pylib import run_tests_helper
from pylib import test_options_parser
from pylib.base_test_sharder import BaseTestSharder
from pylib.single_test_runner import SingleTestRunner
from pylib.utils import run_tests_helper
from pylib.utils import test_options_parser
from pylib.utils import time_profile
from pylib.utils import xvfb
......@@ -344,59 +344,11 @@ def ListTestSuites():
def main(argv):
option_parser = optparse.OptionParser()
test_options_parser.AddTestRunnerOptions(option_parser, default_timeout=0)
option_parser.add_option('-s', '--suite', dest='test_suite',
help='Executable name of the test suite to run '
'(use -s help to list them)')
option_parser.add_option('--out-directory', dest='out_directory',
help='Path to the out/ directory, irrespective of '
'the build type. Only for non-Chromium uses.')
option_parser.add_option('-d', '--device', dest='test_device',
help='Target device the test suite to run ')
option_parser.add_option('-f', '--gtest_filter', dest='gtest_filter',
help='gtest filter')
option_parser.add_option('-a', '--test_arguments', dest='test_arguments',
help='Additional arguments to pass to the test')
option_parser.add_option('-L', dest='log_dump',
help='file name of log dump, which will be put in '
'subfolder debug_info_dumps under the same '
'directory in where the test_suite exists.')
option_parser.add_option('-e', '--emulator', dest='use_emulator',
action='store_true',
help='Run tests in a new instance of emulator')
option_parser.add_option('-n', '--emulator_count',
type='int', default=1,
help='Number of emulators to launch for running the '
'tests.')
option_parser.add_option('-x', '--xvfb', dest='use_xvfb',
action='store_true',
help='Use Xvfb around tests (ignored if not Linux)')
option_parser.add_option('--webkit', action='store_true',
help='Run the tests from a WebKit checkout.')
option_parser.add_option('--fast', '--fast_and_loose', dest='fast_and_loose',
action='store_true',
help='Go faster (but be less stable), '
'for quick testing. Example: when tracking down '
'tests that hang to add to the disabled list, '
'there is no need to redeploy the test binary '
'or data to the device again. '
'Don\'t use on bots by default!')
option_parser.add_option('--repeat', dest='repeat', type='int',
default=2,
help='Repeat count on test timeout')
option_parser.add_option('--exit_code', action='store_true',
help='If set, the exit code will be total number '
'of failures.')
option_parser.add_option('--exe', action='store_true',
help='If set, use the exe test runner instead of '
'the APK.')
test_options_parser.AddGTestOptions(option_parser)
options, args = option_parser.parse_args(argv)
if len(args) > 1:
print 'Unknown argument:', args[1:]
option_parser.print_usage()
sys.exit(1)
option_parser.error('Unknown argument: %s' % args[1:])
run_tests_helper.SetLogLevel(options.verbose_count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment