• Home
  • Raw
  • Download

Lines Matching +full:test +full:- +full:path

4 # Use of this source code is governed by a BSD-style license that can be
9 to setup build directory with the lacros-chrome-on-linux build configuration,
10 and corresponding test targets are built successfully.
14 ./build/lacros/test_runner.py test out/lacros/url_unittests
15 ./build/lacros/test_runner.py test out/lacros/browser_tests
19 executed with the latest version of prebuilt ash-chrome, and the behavior is
24 ./build/lacros/test_runner.py test out/lacros/browser_tests \\
25 --gtest_filter=BrowserTest.Title
28 the underlying test binary can be specified in the command.
30 ./build/lacros/test_runner.py test out/lacros/browser_tests \\
31 --ash-chrome-version=793554
33 The above command runs tests with a given version of ash-chrome, which is
34 useful to reproduce test failures, the version corresponds to the commit
36 be found at: gs://ash-chromium-on-linux-prebuilts/x86_64.
38 ./testing/xvfb.py ./build/lacros/test_runner.py test out/lacros/browser_tests
40 The above command starts ash-chrome with xvfb instead of an X11 window, and
43 For version skew testing when passing --ash-chrome-path-override, the runner
51 --gdb
52 --lldb
69 _SRC_ROOT = os.path.abspath(
70 os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir))
71 sys.path.append(os.path.join(_SRC_ROOT, 'third_party', 'depot_tools'))
74 # The cipd path for prebuilt ash chrome.
75 _ASH_CIPD_PATH = 'chromium/testing/linux-ash-chromium/x86_64/ash.zip'
78 # Directory to cache downloaded ash-chrome versions to avoid re-downloading.
79 _PREBUILT_ASH_CHROME_DIR = os.path.join(os.path.dirname(__file__),
82 # File path to the asan symbolizer executable.
83 _ASAN_SYMBOLIZER_PATH = os.path.join(_SRC_ROOT, 'tools', 'valgrind', 'asan',
86 # Number of seconds to wait for ash-chrome to start.
90 # List of targets that require ash-chrome as a Wayland server in order to run.
113 # List of targets that require ash-chrome to support crosapi mojo APIs.
123 # Default test filter file for each target. These filter files will be
126 'browser_tests': 'linux-lacros.browser_tests.filter',
127 'components_unittests': 'linux-lacros.components_unittests.filter',
128 'content_browsertests': 'linux-lacros.content_browsertests.filter',
129 'interactive_ui_tests': 'linux-lacros.interactive_ui_tests.filter',
131 'linux-lacros.lacros_chrome_browsertests.filter',
132 'sync_integration_tests': 'linux-lacros.sync_integration_tests.filter',
133 'unit_tests': 'linux-lacros.unit_tests.filter',
138 """Returns a path to the dir storing the downloaded version of ash-chrome."""
139 return os.path.join(_PREBUILT_ASH_CHROME_DIR, version)
143 """Removes unused ash-chrome versions to save disk space.
145 Currently, when an ash-chrome zip is downloaded and unpacked, the atime/mtime
160 p = os.path.join(_PREBUILT_ASH_CHROME_DIR, f)
161 if os.path.isfile(p):
162 # The prebuilt ash-chrome dir is NOT supposed to contain any files, remove
166 chrome_path = os.path.join(p, 'test_ash_chrome')
167 if not os.path.exists(chrome_path):
169 age = time.time() - os.path.getatime(chrome_path)
172 'Removing ash-chrome: "%s" as it hasn\'t been used in the '
189 ['cipd', 'describe', _ASH_CIPD_PATH, '-version', 'canary'],
199 def _DownloadAshChromeFromCipd(path, version): argument
203 path: string for the downloaded ash chrome folder.
207 A string representing the path for the downloaded ash chrome.
210 ensure_file_path = os.path.join(temp_dir, 'ensure_file.txt')
215 ['cipd', 'ensure', '-ensure-file', ensure_file_path, '-root', path])
218 def _DoubleCheckDownloadedAshChrome(path, version): argument
221 Double check by running the chrome binary with --version.
224 path: string for the downloaded ash chrome folder.
230 test_ash_chrome = os.path.join(path, 'test_ash_chrome')
231 if not os.path.exists(test_ash_chrome):
232 raise RuntimeError('Can not find test_ash_chrome binary under %s' % path)
233 cp = subprocess.run([test_ash_chrome, '--version'], capture_output=True)
235 if str(cp.stdout).find(version) == -1:
244 """Download a given version of ash-chrome if not already exists.
256 # will be present as well, it's not always true, for example, if the test
259 return os.path.isdir(ash_chrome_dir) and os.path.isfile(
260 os.path.join(ash_chrome_dir, 'test_ash_chrome'))
275 """Waits for Ash-Chrome to be up and running and returns a boolean indicator.
277 Determine whether ash-chrome is up and running by checking whether two files
281 status of ash-chrome, likely through mojo connection.
284 tmp_xdg_dir (str): Path to the XDG_RUNTIME_DIR.
285 lacros_mojo_socket_file (str): Path to the lacros mojo socket file.
287 between ash and the lacros test binary.
288 ash_ready_file (str): Path to a non-existing file. After ash is ready for
292 A boolean indicating whether Ash-chrome is up and running.
300 if enable_mojo_crosapi and not os.path.exists(lacros_mojo_socket_file):
302 return os.path.exists(ash_ready_file)
319 File path like this:
327 'lacros_version_skew_tests_v(?P<version>[0-9]+).[0-9]+.[0-9]+.[0-9]+/',
339 # we don't copy source files to test machines. So we build a
341 if not os.path.exists('metadata.json'):
362 version_file = os.path.abspath(
363 os.path.join(os.path.abspath(os.path.dirname(__file__)),
367 if os.path.exists(version_file):
369 return int(lines[0][lines[0].find('=') + 1:-1])
374 """Find the summary output file path.
377 forward_args (list): Args to be forwarded to the test command.
380 None if not found, or str representing the output file path.
384 if arg.startswith('--test-launcher-summary-output='):
385 return arg[len('--test-launcher-summary-output='):]
393 forward_args (list): Args to be forwarded to the test command.
398 return '--test-launcher-bot-mode' in forward_args
432 dirpath: The path of the directory.
436 shutil.rmtree(e.path)
438 os.remove(e.path)
444 This is used to wrap the test invocation in a debugger. It returns the
449 forward_args (list): Args to be forwarded to the test command.
450 test_env (dict): Computed environment variables for the test.
454 # Force the tests into single-process-test mode for debugging unless manually
457 if not ("--single-process" in forward_args
458 or "--single-process-tests" in forward_args):
459 forward_args += ["--single-process-tests"]
461 # Adding --single-process-tests can cause some tests to fail when they're
464 if not [i for i in forward_args if i.startswith("--gtest_filter")]:
465 logging.error("""Interactive debugging requested without --gtest_filter
467 This script adds --single-process-tests to support interactive debugging but
468 some tests will fail in this mode unless run independently. To debug a test
469 specify a --gtest_filter=Foo.Bar to name the test you want to debug.
477 gdbinit_file = os.path.normpath(
478 os.path.join(os.path.realpath(__file__), "../../../tools/gdb/gdbinit"))
480 'gdb', '--init-eval-command', 'source ' + gdbinit_file, '--args'
483 lldbinit_dir = os.path.normpath(
484 os.path.join(os.path.realpath(__file__), "../../../tools/lldb"))
486 'lldb', '-O',
487 "script sys.path[:0] = ['%s']" % lldbinit_dir, '-O',
488 'script import lldbinit', '--'
495 """Runs tests with ash-chrome.
499 forward_args (list): Args to be forwarded to the test command.
519 if not os.path.exists(ash_chrome_file):
523 $ cipd auth-login
524 $ echo "chromium/testing/linux-ash-chromium/x86_64/ash.zip \
525 version:92.0.4515.130" > /tmp/ensure-file.txt
526 $ cipd ensure -ensure-file /tmp/ensure-file.txt \
527 -root lacros_version_skew_tests_v92.0.4515.130
528 Then you can use --ash-chrome-path-override=\
538 logging.info('Ash-chrome version: %s', ash_chrome_version)
540 ash_chrome_file = os.path.join(_GetAshChromeDirPath(ash_chrome_version),
543 # Starts Ash-Chrome.
550 lacros_mojo_socket_arg = ('--lacros-mojo-socket-for-testing=%s' %
553 enable_mojo_crosapi = any(t == os.path.basename(args.command)
555 ash_wayland_socket_name = 'wayland-exo'
562 '--user-data-dir=%s' % tmp_ash_data_dir_name,
563 '--enable-wayland-server',
564 '--no-startup-window',
565 '--disable-input-event-activation-protection',
566 '--disable-lacros-keep-alive',
567 '--disable-login-lacros-opening',
568 '--enable-field-trial-config',
569 '--enable-features=LacrosSupport,LacrosPrimary,LacrosOnly',
570 '--ash-ready-file-path=%s' % ash_ready_file,
571 '--wayland-server-socket=%s' % ash_wayland_socket_name,
573 if '--enable-pixel-output-in-tests' not in forward_args:
574 ash_cmd.append('--disable-gl-drawing-for-tests')
582 # $ export ASH_WRAPPER="gnome-terminal -- gdb --ex=r --args"
607 ash_log_path = os.path.join(os.path.dirname(summary_file),
612 logging.info("Running in the debugger and --ash-logging-path is not " +
618 logging.info('Writing ash-chrome logs to: %s', ash_log_path)
627 if args.asan_symbolize_output and os.path.exists(_ASAN_SYMBOLIZER_PATH):
636 logging.info('Starting ash-chrome.')
657 logging.warning('Starting ash-chrome timed out after %ds',
670 raise RuntimeError('Timed out waiting for ash-chrome to start')
672 ash_elapsed_time = time.monotonic() - ash_start_time
673 logging.info('Started ash-chrome in %.3fs on try %d.', ash_elapsed_time,
680 forward_args.append('--ash-chrome-path=' + ash_chrome_file)
689 logging.info('Starting test process.')
695 logging.info('Symbolizing test logs with asan symbolizer.')
713 """Runs tests by invoking the test command directly.
716 forward_args (list): Args to be forwarded to the test command.
727 """Handles received signals to make sure spawned test process are killed.
738 # Exit code 128+n -> Fatal error signal "n".
744 [arg.startswith('--test-launcher-filter-file') for arg in forward_args])):
745 file_path = os.path.abspath(
746 os.path.join(os.path.dirname(__file__), '..', '..', 'testing',
749 forward_args.append(f'--test-launcher-filter-file={file_path}')
756 forward_args (list): Args to be forwarded to the test command.
759 RuntimeError: If the given test binary doesn't exist or the test runner
763 if not os.path.isfile(args.command):
764 raise RuntimeError('Specified test command: "%s" doesn\'t exist' %
767 test_target = os.path.basename(args.command)
772 # behavior with a specified ash-chrome version, which makes sure that
792 test_parser = subparsers.add_parser('test', help='Run tests')
798 '"./url_unittests". Any argument unknown to this test runner script will '
799 'be forwarded to the command, for example: "--gtest_filter=Suite.Test"')
803 '--ash-chrome-version',
805 help='Version of an prebuilt ash-chrome to use for testing, for example: '
810 '--ash-chrome-path',
812 help='Path to an locally built ash-chrome to use for testing. '
813 'In general you should build //chrome/test:test_ash_chrome.')
816 debugger_group.add_argument('--gdb',
818 help='Run the test in GDB.')
819 debugger_group.add_argument('--lldb',
821 help='Run the test in LLDB.')
824 # an ash chrome and pass it using --ash-chrome-path. In order to use the same
828 '--ash-chrome-path-override',
830 help='The same as --ash-chrome-path. But this will override '
831 '--ash-chrome-path or --ash-chrome-version if any of these '
834 '--ash-logging-path',
836 help='File & path to ash-chrome logging output while running Lacros '
838 test_parser.add_argument('--combine-ash-logs-on-bots',
842 '--asan-symbolize-output',