Commit eaf49626 authored by jbudorick's avatar jbudorick Committed by Commit bot

[Android] Fix a few more symlink issues in test_runner.py.

BUG=641597

Review-Url: https://codereview.chromium.org/2294843002
Cr-Commit-Position: refs/heads/master@{#415364}
parent e465f9c7
...@@ -263,7 +263,8 @@ class GtestTestInstance(test_instance.TestInstance): ...@@ -263,7 +263,8 @@ class GtestTestInstance(test_instance.TestInstance):
self._isolated_abs_path = os.path.join( self._isolated_abs_path = os.path.join(
constants.GetOutDirectory(), '%s.isolated' % self._suite) constants.GetOutDirectory(), '%s.isolated' % self._suite)
else: else:
logging.warning('No isolate file provided. No data deps will be pushed.') logging.warning('%s isolate file provided. No data deps will be pushed.',
'Empty' if args.isolate_file_path else 'No')
self._isolate_delegate = None self._isolate_delegate = None
if args.app_data_files: if args.app_data_files:
......
...@@ -406,6 +406,10 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -406,6 +406,10 @@ class InstrumentationTestInstance(test_instance.TestInstance):
constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR,
'%s.apk' % args.apk_under_test) '%s.apk' % args.apk_under_test)
# TODO(jbudorick): Move the realpath up to the argument parser once
# APK-by-name is no longer supported.
apk_under_test_path = os.path.realpath(apk_under_test_path)
if not os.path.exists(apk_under_test_path): if not os.path.exists(apk_under_test_path):
error_func('Unable to find APK under test: %s' % apk_under_test_path) error_func('Unable to find APK under test: %s' % apk_under_test_path)
...@@ -413,12 +417,22 @@ class InstrumentationTestInstance(test_instance.TestInstance): ...@@ -413,12 +417,22 @@ class InstrumentationTestInstance(test_instance.TestInstance):
if args.test_apk.endswith('.apk'): if args.test_apk.endswith('.apk'):
self._suite = os.path.splitext(os.path.basename(args.test_apk))[0] self._suite = os.path.splitext(os.path.basename(args.test_apk))[0]
test_apk_path = args.test_apk
self._test_apk = apk_helper.ToHelper(args.test_apk) self._test_apk = apk_helper.ToHelper(args.test_apk)
else: else:
self._suite = args.test_apk self._suite = args.test_apk
self._test_apk = apk_helper.ToHelper(os.path.join( test_apk_path = os.path.join(
constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR, constants.GetOutDirectory(), constants.SDK_BUILD_APKS_DIR,
'%s.apk' % args.test_apk)) '%s.apk' % args.test_apk)
# TODO(jbudorick): Move the realpath up to the argument parser once
# APK-by-name is no longer supported.
test_apk_path = os.path.realpath(test_apk_path)
if not os.path.exists(test_apk_path):
error_func('Unable to find test APK: %s' % test_apk_path)
self._test_apk = apk_helper.ToHelper(test_apk_path)
self._apk_under_test_incremental_install_script = ( self._apk_under_test_incremental_install_script = (
args.apk_under_test_incremental_install_script) args.apk_under_test_incremental_install_script)
......
...@@ -95,21 +95,21 @@ def AddCommonOptions(parser): ...@@ -95,21 +95,21 @@ def AddCommonOptions(parser):
group.add_argument('-e', '--environment', default='local', group.add_argument('-e', '--environment', default='local',
choices=constants.VALID_ENVIRONMENTS, choices=constants.VALID_ENVIRONMENTS,
help='Test environment to run in (default: %(default)s).') help='Test environment to run in (default: %(default)s).')
group.add_argument('--adb-path', type=os.path.abspath, group.add_argument('--adb-path', type=os.path.realpath,
help=('Specify the absolute path of the adb binary that ' help=('Specify the absolute path of the adb binary that '
'should be used.')) 'should be used.'))
group.add_argument('--json-results-file', '--test-launcher-summary-output', group.add_argument('--json-results-file', '--test-launcher-summary-output',
dest='json_results_file', dest='json_results_file', type=os.path.realpath,
help='If set, will dump results in JSON form ' help='If set, will dump results in JSON form '
'to specified file.') 'to specified file.')
logcat_output_group = group.add_mutually_exclusive_group() logcat_output_group = group.add_mutually_exclusive_group()
logcat_output_group.add_argument( logcat_output_group.add_argument(
'--logcat-output-dir', '--logcat-output-dir', type=os.path.realpath,
help='If set, will dump logcats recorded during test run to directory. ' help='If set, will dump logcats recorded during test run to directory. '
'File names will be the device ids with timestamps.') 'File names will be the device ids with timestamps.')
logcat_output_group.add_argument( logcat_output_group.add_argument(
'--logcat-output-file', '--logcat-output-file', type=os.path.realpath,
help='If set, will merge logcats recorded during test run and dump them ' help='If set, will merge logcats recorded during test run and dump them '
'to the specified file.') 'to the specified file.')
...@@ -215,7 +215,8 @@ def AddDeviceOptions(parser): ...@@ -215,7 +215,8 @@ def AddDeviceOptions(parser):
group.add_argument('-d', '--device', dest='test_device', group.add_argument('-d', '--device', dest='test_device',
help=('Target device for the test suite ' help=('Target device for the test suite '
'to run on.')) 'to run on.'))
group.add_argument('--blacklist-file', help='Device blacklist file.') group.add_argument('--blacklist-file', type=os.path.realpath,
help='Device blacklist file.')
group.add_argument('--enable-device-cache', action='store_true', group.add_argument('--enable-device-cache', action='store_true',
help='Cache device state to disk between runs') help='Cache device state to disk between runs')
group.add_argument('--enable-concurrent-adb', action='store_true', group.add_argument('--enable-concurrent-adb', action='store_true',
...@@ -225,7 +226,7 @@ def AddDeviceOptions(parser): ...@@ -225,7 +226,7 @@ def AddDeviceOptions(parser):
help='Do not wipe app data between tests. Use this to ' help='Do not wipe app data between tests. Use this to '
'speed up local development and never on bots ' 'speed up local development and never on bots '
'(increases flakiness)') '(increases flakiness)')
group.add_argument('--target-devices-file', group.add_argument('--target-devices-file', type=os.path.realpath,
help='Path to file with json list of device serials to ' help='Path to file with json list of device serials to '
'run tests on. When not specified, all available ' 'run tests on. When not specified, all available '
'devices are used.') 'devices are used.')
...@@ -238,10 +239,11 @@ def AddGTestOptions(parser): ...@@ -238,10 +239,11 @@ def AddGTestOptions(parser):
group.add_argument('-s', '--suite', dest='suite_name', group.add_argument('-s', '--suite', dest='suite_name',
nargs='+', metavar='SUITE_NAME', required=True, nargs='+', metavar='SUITE_NAME', required=True,
help='Executable name of the test suite to run.') help='Executable name of the test suite to run.')
group.add_argument('--executable-dist-dir', group.add_argument('--executable-dist-dir', type=os.path.realpath,
help="Path to executable's dist directory for native" help="Path to executable's dist directory for native"
" (non-apk) tests.") " (non-apk) tests.")
group.add_argument('--test-apk-incremental-install-script', group.add_argument('--test-apk-incremental-install-script',
type=os.path.realpath,
help='Path to install script for the test apk.') help='Path to install script for the test apk.')
group.add_argument('--gtest_also_run_disabled_tests', group.add_argument('--gtest_also_run_disabled_tests',
'--gtest-also-run-disabled-tests', '--gtest-also-run-disabled-tests',
...@@ -257,6 +259,7 @@ def AddGTestOptions(parser): ...@@ -257,6 +259,7 @@ def AddGTestOptions(parser):
group.add_argument('--isolate_file_path', group.add_argument('--isolate_file_path',
'--isolate-file-path', '--isolate-file-path',
dest='isolate_file_path', dest='isolate_file_path',
type=os.path.realpath,
help='.isolate file path to override the default ' help='.isolate file path to override the default '
'path') 'path')
group.add_argument('--app-data-file', action='append', dest='app_data_files', group.add_argument('--app-data-file', action='append', dest='app_data_files',
...@@ -288,6 +291,7 @@ def AddGTestOptions(parser): ...@@ -288,6 +291,7 @@ def AddGTestOptions(parser):
dest='test_filter', dest='test_filter',
help='googletest-style filter string.') help='googletest-style filter string.')
filter_group.add_argument('--gtest-filter-file', dest='test_filter_file', filter_group.add_argument('--gtest-filter-file', dest='test_filter_file',
type=os.path.realpath,
help='Path to file that contains googletest-style ' help='Path to file that contains googletest-style '
'filter strings. (Lines will be joined with ' 'filter strings. (Lines will be joined with '
'":" to create a single filter string.)') '":" to create a single filter string.)')
...@@ -330,7 +334,7 @@ def AddJavaTestOptions(argument_group): ...@@ -330,7 +334,7 @@ def AddJavaTestOptions(argument_group):
help=('Comma-separated list of annotations. Exclude tests with these ' help=('Comma-separated list of annotations. Exclude tests with these '
'annotations.')) 'annotations.'))
argument_group.add_argument( argument_group.add_argument(
'--screenshot-directory', dest='screenshot_dir', '--screenshot-directory', dest='screenshot_dir', type=os.path.realpath,
help='Capture screenshots of test failures') help='Capture screenshots of test failures')
argument_group.add_argument( argument_group.add_argument(
'--save-perf-json', action='store_true', '--save-perf-json', action='store_true',
...@@ -383,6 +387,8 @@ def AddInstrumentationTestOptions(parser): ...@@ -383,6 +387,8 @@ def AddInstrumentationTestOptions(parser):
group.add_argument('-w', '--wait_debugger', dest='wait_for_debugger', group.add_argument('-w', '--wait_debugger', dest='wait_for_debugger',
action='store_true', action='store_true',
help='Wait for debugger.') help='Wait for debugger.')
# TODO(jbudorick): Remove support for name-style APK specification once
# bots are no longer doing it.
group.add_argument('--apk-under-test', group.add_argument('--apk-under-test',
help='Path or name of the apk under test.') help='Path or name of the apk under test.')
group.add_argument('--apk-under-test-incremental-install-script', group.add_argument('--apk-under-test-incremental-install-script',
...@@ -392,23 +398,27 @@ def AddInstrumentationTestOptions(parser): ...@@ -392,23 +398,27 @@ def AddInstrumentationTestOptions(parser):
'(name is without the .apk extension; ' '(name is without the .apk extension; '
'e.g. "ContentShellTest").') 'e.g. "ContentShellTest").')
group.add_argument('--test-apk-incremental-install-script', group.add_argument('--test-apk-incremental-install-script',
type=os.path.realpath,
help='Path to install script for the --test-apk.') help='Path to install script for the --test-apk.')
group.add_argument('--additional-apk', action='append', group.add_argument('--additional-apk', action='append',
dest='additional_apks', default=[], dest='additional_apks', default=[],
type=os.path.realpath,
help='Additional apk that must be installed on ' help='Additional apk that must be installed on '
'the device when the tests are run') 'the device when the tests are run')
group.add_argument('--coverage-dir', group.add_argument('--coverage-dir', type=os.path.realpath,
help=('Directory in which to place all generated ' help=('Directory in which to place all generated '
'EMMA coverage files.')) 'EMMA coverage files.'))
group.add_argument('--device-flags', dest='device_flags', default='', group.add_argument('--device-flags', dest='device_flags',
type=os.path.realpath,
help='The relative filepath to a file containing ' help='The relative filepath to a file containing '
'command-line flags to set on the device') 'command-line flags to set on the device')
group.add_argument('--device-flags-file', default='', group.add_argument('--device-flags-file', type=os.path.realpath,
help='The relative filepath to a file containing ' help='The relative filepath to a file containing '
'command-line flags to set on the device') 'command-line flags to set on the device')
group.add_argument('--isolate_file_path', group.add_argument('--isolate_file_path',
'--isolate-file-path', '--isolate-file-path',
dest='isolate_file_path', dest='isolate_file_path',
type=os.path.realpath,
help='.isolate file path to override the default ' help='.isolate file path to override the default '
'path') 'path')
group.add_argument('--delete-stale-data', dest='delete_stale_data', group.add_argument('--delete-stale-data', dest='delete_stale_data',
...@@ -454,7 +464,7 @@ def AddJUnitTestOptions(parser): ...@@ -454,7 +464,7 @@ def AddJUnitTestOptions(parser):
'--sdk-version', dest='sdk_version', type=int, '--sdk-version', dest='sdk_version', type=int,
help='The Android SDK version.') help='The Android SDK version.')
group.add_argument( group.add_argument(
'--coverage-dir', dest='coverage_dir', '--coverage-dir', dest='coverage_dir', type=os.path.realpath,
help='Directory to store coverage info.') help='Directory to store coverage info.')
AddCommonOptions(parser) AddCommonOptions(parser)
...@@ -558,7 +568,7 @@ def AddPerfTestOptions(parser): ...@@ -558,7 +568,7 @@ def AddPerfTestOptions(parser):
help='The name of a previously executed perf step to print.') help='The name of a previously executed perf step to print.')
group.add_argument( group.add_argument(
'--output-json-list', '--output-json-list', type=os.path.realpath,
help='Write a simple list of names from --steps into the given file.') help='Write a simple list of names from --steps into the given file.')
group.add_argument( group.add_argument(
'--collect-chartjson-data', '--collect-chartjson-data',
...@@ -567,19 +577,20 @@ def AddPerfTestOptions(parser): ...@@ -567,19 +577,20 @@ def AddPerfTestOptions(parser):
group.add_argument( group.add_argument(
'--output-chartjson-data', '--output-chartjson-data',
default='', default='',
type=os.path.realpath,
help='Write out chartjson into the given file.') help='Write out chartjson into the given file.')
# TODO(rnephew): Remove this when everything moves to new option in platform # TODO(rnephew): Remove this when everything moves to new option in platform
# mode. # mode.
group.add_argument( group.add_argument(
'--get-output-dir-archive', metavar='FILENAME', '--get-output-dir-archive', metavar='FILENAME', type=os.path.realpath,
help='Write the cached output directory archived by a step into the' help='Write the cached output directory archived by a step into the'
' given ZIP file.') ' given ZIP file.')
group.add_argument( group.add_argument(
'--output-dir-archive-path', metavar='FILENAME', '--output-dir-archive-path', metavar='FILENAME', type=os.path.realpath,
help='Write the cached output directory archived by a step into the' help='Write the cached output directory archived by a step into the'
' given ZIP file.') ' given ZIP file.')
group.add_argument( group.add_argument(
'--flaky-steps', '--flaky-steps', type=os.path.realpath,
help=('A JSON file containing steps that are flaky ' help=('A JSON file containing steps that are flaky '
'and will have its exit code ignored.')) 'and will have its exit code ignored.'))
group.add_argument( group.add_argument(
......
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