Hash :
6bdbe9cc
Author :
Date :
2025-05-01T12:33:41
Manual roll Chromium from dd275389e023 to cf3a960742c3 (1975 revisions) Use third_party/depot_tools/gn.py instead of gn to accommodate https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6504176 Manual roll requested by ynovikov@google.com https://chromium.googlesource.com/chromium/src.git/+log/dd275389e023..cf3a960742c3 If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/chromium-angle-autoroll Please CC angle-team@google.com,geofflang@google.com,ynovikov@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Chromium: https://bugs.chromium.org/p/chromium/issues/entry To file a bug in ANGLE: https://bugs.chromium.org/p/angleproject/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Changed dependencies * build: https://chromium.googlesource.com/chromium/src/build.git/+log/88030b3203..aaf578b4fc * buildtools: https://chromium.googlesource.com/chromium/src/buildtools.git/+log/0f32cb9025..6d4e129ac6 * buildtools/linux64: git_revision:90478db6b59b9bebf7ca4cf912d860cf868e724c..git_revision:487f8353f15456474437df32bb186187b0940b45 * buildtools/mac: git_revision:90478db6b59b9bebf7ca4cf912d860cf868e724c..git_revision:487f8353f15456474437df32bb186187b0940b45 * buildtools/win: git_revision:90478db6b59b9bebf7ca4cf912d860cf868e724c..git_revision:487f8353f15456474437df32bb186187b0940b45 * testing: https://chromium.googlesource.com/chromium/src/testing/+log/fe092931f1..35b04da37d * third_party/android_build_tools/error_prone/cipd: -IrkxgAkj3RxGNBPp6b4r9OWZC6_dTbI-jC3c3UPgq8C..2t_u1XEjof609BQE4czlCQzEqRliKS_qY35FOu_VckgC * third_party/android_build_tools/lint/cipd: gx4NrAApWUVG5HG3WJRIIzZrTssD6H5uGbKe0g77mucC..TEDRB0F7VgCgyepd8FsIxPRqvKjvWQ_YkLV-ybx-GQYC * third_party/android_build_tools/manifest_merger/cipd: HhXknpcPosMUDHZQD-8Ogve-HaG4HmJ4p082zKKAcnMC..fPGWiT0LVG2_ifxOpHb5KNwTL-_7lb7tYOsB_ZoIiskC * third_party/android_deps: https://chromium.googlesource.com/chromium/src/third_party/android_deps/+log/1ea2115b17..a86aaa9531 * third_party/catapult: https://chromium.googlesource.com/catapult.git/+log/000f47cfa3..1591e813b6 * third_party/depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+log/1fcc527019..5982a1aeb3 * third_party/fuchsia-sdk/sdk: version:27.20250424.2.1..version:27.20250501.3.1 * third_party/libc++/src: https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libcxx.git/+log/917609c669..62724eb55f * third_party/llvm-libc/src: https://chromium.googlesource.com/external/github.com/llvm/llvm-project/libc.git/+log/912274164f..bf95cc5da6 * third_party/r8/cipd: bA3htCoEd_EArHekDGQSNpmBzQrcby2ioG6SFyl3AtwC..sxgLKZyJNZMVi8cot5yvRzqCFQxX_HbbR0psaeto5RcC * third_party/r8/d8/cipd: 6qLey8EBp9ivhThnqVPWy2ZDGpsf5Y29EsTbi_rZ1pMC..bA3htCoEd_EArHekDGQSNpmBzQrcby2ioG6SFyl3AtwC * third_party/rust: https://chromium.googlesource.com/chromium/src/third_party/rust/+log/926ec54499..7c098b791b * third_party/zlib: https://chromium.googlesource.com/chromium/src/third_party/zlib/+log/1e85c01b15..6f9b4e6192 * tools/android: https://chromium.googlesource.com/chromium/src/tools/android/+log/60443ebac3..e4c0da2094 * tools/clang: https://chromium.googlesource.com/chromium/src/tools/clang.git/+log/6c4f037a98..5ae6e4bfb4 * tools/luci-go: git_revision:fd48b8efe637ea5f431fc371f1617b215b7ba1a2..git_revision:a9a10995e2889126ace91faf4052949e38c69d33 * tools/luci-go: git_revision:fd48b8efe637ea5f431fc371f1617b215b7ba1a2..git_revision:a9a10995e2889126ace91faf4052949e38c69d33 * tools/luci-go: git_revision:fd48b8efe637ea5f431fc371f1617b215b7ba1a2..git_revision:a9a10995e2889126ace91faf4052949e38c69d33 * tools/mb: https://chromium.googlesource.com/chromium/src/tools/mb/+log/3b0c718c2d..e3589a5831 * tools/perf: https://chromium.googlesource.com/chromium/src/tools/perf/+log/9c8188cae9..1a0049ce09 * tools/rust: https://chromium.googlesource.com/chromium/src/tools/rust.git/+log/fa679ed68e..7e70cdf64e * tools/skia_goldctl/linux: M9CSmdri8G3miQpGPQeqstBvQ3TtlngrsiF5GdSTYs0C..srGbc-O6bVQmBoT6VLvP66h6Be4A-nffx4UhixUJ9w0C * tools/skia_goldctl/mac_amd64: Txs7Izu5kRGbcoAc9qESynBnBHo8RdRIyim5zF9rWbgC..tZvHxy8AcDJhO9A-5UuZKL_-5vfE_wC-RBkElqWZpM4C * tools/skia_goldctl/mac_arm64: LTzU4UbKV4zw61tWyttEX62vyq7nErr2gD8-jiH8IhgC..2br8hIWKHDAaOt77siYyRUclHBYUZX6dj8jtogL90nwC * tools/skia_goldctl/win: UKiySjywM8juGVuMwWbOdaBXFD1TbzUOWcGGVTYfem0C..zasiUhQIHGZ2e60_M6g41oz8mYgPta5JmOWV5LwFjGMC No update to Clang. Bug: chromium:414330998 Change-Id: I5ce14c5574391c1dd638787c09789f0577ee26a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6503456 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891
#! /usr/bin/env vpython3
#
# Copyright 2020 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""
Script testing capture_replay with angle_end2end_tests
"""
# Automation script will:
# 1. Build all tests in angle_end2end with frame capture enabled
# 2. Run each test with frame capture
# 3. Build CaptureReplayTest with cpp trace files
# 4. Run CaptureReplayTest
# 5. Output the number of test successes and failures. A test succeeds if no error occurs during
# its capture and replay, and the GL states at the end of two runs match. Any unexpected failure
# will return non-zero exit code
# Run this script with Python to test capture replay on angle_end2end tests
# python path/to/capture_replay_tests.py
# Command line arguments: run with --help for a full list.
import argparse
import concurrent.futures
import contextlib
import difflib
import distutils.util
import getpass
import glob
import json
import logging
import os
import pathlib
import queue
import random
import re
import shutil
import subprocess
import sys
import tempfile
import threading
import time
import traceback
SCRIPT_DIR = str(pathlib.Path(__file__).resolve().parent)
PY_UTILS = str(pathlib.Path(SCRIPT_DIR) / 'py_utils')
if PY_UTILS not in sys.path:
os.stat(PY_UTILS) and sys.path.insert(0, PY_UTILS)
import angle_test_util
PIPE_STDOUT = True
DEFAULT_OUT_DIR = "out_CaptureReplayTest" # relative to angle folder
DEFAULT_FILTER = "*/ES2_Vulkan_SwiftShader"
DEFAULT_TEST_SUITE = "angle_end2end_tests"
REPLAY_SAMPLE_FOLDER = "src/tests/capture_replay_tests" # relative to angle folder
DEFAULT_BATCH_COUNT = 1 # number of tests batched together for capture
CAPTURE_FRAME_END = 100
TRACE_FILE_SUFFIX = "_context" # because we only deal with 1 context right now
RESULT_TAG = "*RESULT"
STATUS_MESSAGE_PERIOD = 20 # in seconds
CAPTURE_SUBPROCESS_TIMEOUT = 600 # in seconds
REPLAY_SUBPROCESS_TIMEOUT = 60 # in seconds
DEFAULT_RESULT_FILE = "results.txt"
DEFAULT_LOG_LEVEL = "info"
DEFAULT_MAX_JOBS = 8
REPLAY_BINARY = "capture_replay_tests"
if sys.platform == "win32":
REPLAY_BINARY += ".exe"
TRACE_FOLDER = "traces"
EXIT_SUCCESS = 0
EXIT_FAILURE = 1
REPLAY_INITIALIZATION_FAILURE = -1
REPLAY_SERIALIZATION_FAILURE = -2
switch_case_without_return_template = """\
case {case}:
{namespace}::{call}({params});
break;
"""
switch_case_with_return_template = """\
case {case}:
return {namespace}::{call}({params});
"""
default_case_without_return_template = """\
default:
break;"""
default_case_with_return_template = """\
default:
return {default_val};"""
def winext(name, ext):
return ("%s.%s" % (name, ext)) if sys.platform == "win32" else name
GN_PATH = os.path.join('third_party', 'depot_tools', 'gn.py')
AUTONINJA_PATH = os.path.join('third_party', 'depot_tools', 'autoninja.py')
def GetGnArgsStr(args, extra_gn_args=[]):
gn_args = [('angle_with_capture_by_default', 'true'),
('angle_enable_vulkan_api_dump_layer', 'false'),
('angle_enable_wgpu', 'false')] + extra_gn_args
if args.use_siso:
gn_args.append(('use_siso', 'true'))
if args.use_remoteexec:
gn_args.append(('use_remoteexec', 'true'))
if not args.debug:
gn_args.append(('is_debug', 'false'))
gn_args.append(('symbol_level', '1'))
gn_args.append(('angle_assert_always_on', 'true'))
if args.asan:
gn_args.append(('is_asan', 'true'))
return ' '.join(['%s=%s' % (k, v) for (k, v) in gn_args])
class XvfbPool(object):
def __init__(self, worker_count):
self.queue = queue.Queue()
self.processes = []
displays = set()
tmp = tempfile.TemporaryDirectory()
logging.info('Starting xvfb and openbox...')
# Based on the simplest case from testing/xvfb.py, with tweaks to minimize races.
try:
for worker in range(worker_count):
while True:
# Pick a set of random displays from a custom range to hopefully avoid
# collisions with anything else that might be using xvfb.
# Another option would be -displayfd but that has its quirks too.
display = random.randint(7700000, 7800000)
if display in displays:
continue
x11_display_file = '/tmp/.X11-unix/X%d' % display
if not os.path.exists(x11_display_file):
break
displays.add(display)
x11_proc = subprocess.Popen([
'Xvfb',
':%d' % display, '-screen', '0', '1280x1024x24', '-ac', '-nolisten', 'tcp',
'-dpi', '96', '+extension', 'RANDR', '-maxclients', '512'
],
stderr=subprocess.STDOUT)
self.processes.append(x11_proc)
start_time = time.time()
while not os.path.exists(x11_display_file):
if time.time() - start_time >= 30:
raise Exception('X11 failed to start')
time.sleep(0.1)
env = os.environ.copy()
env['DISPLAY'] = ':%d' % display
# testing/xvfb.py uses signals instead, which is tricky with multiple displays.
openbox_ready_file = os.path.join(tmp.name, str(display))
openbox_proc = subprocess.Popen(
['openbox', '--sm-disable', '--startup',
'touch %s' % openbox_ready_file],
stderr=subprocess.STDOUT,
env=env)
self.processes.append(openbox_proc)
start_time = time.time()
while not os.path.exists(openbox_ready_file):
if time.time() - start_time >= 30:
raise Exception('Openbox failed to start')
time.sleep(0.1)
self.queue.put(display)
logging.info('Started a pool of %d xvfb displays: %s', worker_count,
' '.join(str(d) for d in sorted(displays)))
except Exception:
self.Teardown()
raise
finally:
tmp.cleanup()
def GrabDisplay(self):
return self.queue.get()
def ReleaseDisplay(self, display):
self.queue.put(display)
def Teardown(self):
logging.info('Stopping xvfb pool')
for p in reversed(self.processes):
p.kill()
p.wait()
self.processes = []
@contextlib.contextmanager
def MaybeXvfbPool(xvfb, worker_count):
if xvfb:
try:
xvfb_pool = XvfbPool(worker_count)
yield xvfb_pool
finally:
xvfb_pool.Teardown()
else:
yield None
@contextlib.contextmanager
def GetDisplayEnv(env, xvfb_pool):
if not xvfb_pool:
yield env
return
display = xvfb_pool.GrabDisplay()
display_var = ':%d' % display
try:
yield {**env, 'DISPLAY': display_var, 'XVFB_DISPLAY': display_var}
finally:
xvfb_pool.ReleaseDisplay(display)
def TestLabel(test_name):
return test_name.replace(".", "_").replace("/", "_")
def ParseTestNamesFromTestList(output, test_expectation, also_run_skipped_for_capture_tests):
output_lines = output.splitlines()
tests = []
seen_start_of_tests = False
disabled = 0
for line in output_lines:
l = line.strip()
if l == 'Tests list:':
seen_start_of_tests = True
elif l == 'End tests list.':
break
elif not seen_start_of_tests:
pass
elif not test_expectation.TestIsSkippedForCapture(l) or also_run_skipped_for_capture_tests:
tests.append(l)
else:
disabled += 1
logging.info('Found %s tests and %d disabled tests.' % (len(tests), disabled))
return tests
class GroupedResult():
Passed = "Pass"
Failed = "Fail"
TimedOut = "Timeout"
CompileFailed = "CompileFailed"
CaptureFailed = "CaptureFailed"
ReplayFailed = "ReplayFailed"
Skipped = "Skipped"
FailedToTrace = "FailedToTrace"
ResultTypes = [
Passed, Failed, TimedOut, CompileFailed, CaptureFailed, ReplayFailed, Skipped,
FailedToTrace
]
def __init__(self, resultcode, message, output, tests):
self.resultcode = resultcode
self.message = message
self.output = output
self.tests = []
for test in tests:
self.tests.append(test)
def CaptureProducedRequiredFiles(all_trace_files, test_name):
label = TestLabel(test_name)
test_files = [f for f in all_trace_files if f.startswith(label)]
frame_files_count = 0
context_header_count = 0
context_source_count = 0
source_json_count = 0
context_id = 0
for f in test_files:
# TODO: Consolidate. http://anglebug.com/42266223
if "_001.cpp" in f or "_001.c" in f:
frame_files_count += 1
elif f.endswith(".json"):
source_json_count += 1
elif f.endswith(".h"):
context_header_count += 1
if TRACE_FILE_SUFFIX in f:
context = f.split(TRACE_FILE_SUFFIX)[1][:-2]
context_id = int(context)
# TODO: Consolidate. http://anglebug.com/42266223
elif f.endswith(".cpp") or f.endswith(".c"):
context_source_count += 1
got_all_files = (
frame_files_count >= 1 and context_header_count >= 1 and context_source_count >= 1 and
source_json_count == 1)
return got_all_files
def GetCaptureEnv(args, trace_folder_path):
env = {
'ANGLE_CAPTURE_SERIALIZE_STATE': '1',
'ANGLE_FEATURE_OVERRIDES_ENABLED': 'forceRobustResourceInit:forceInitShaderVariables',
'ANGLE_FEATURE_OVERRIDES_DISABLED': 'supportsHostImageCopy',
'ANGLE_CAPTURE_ENABLED': '1',
'ANGLE_CAPTURE_OUT_DIR': trace_folder_path,
}
if args.mec > 0:
env['ANGLE_CAPTURE_FRAME_START'] = '{}'.format(args.mec)
env['ANGLE_CAPTURE_FRAME_END'] = '{}'.format(args.mec + 1)
else:
env['ANGLE_CAPTURE_FRAME_END'] = '{}'.format(CAPTURE_FRAME_END)
if args.expose_nonconformant_features:
env['ANGLE_FEATURE_OVERRIDES_ENABLED'] += ':exposeNonConformantExtensionsAndVersions'
return env
def PrintContextDiff(replay_build_dir, test_name):
frame = 1
found = False
while True:
capture_file = "{}/{}_ContextCaptured{}.json".format(replay_build_dir, test_name, frame)
replay_file = "{}/{}_ContextReplayed{}.json".format(replay_build_dir, test_name, frame)
if os.path.exists(capture_file) and os.path.exists(replay_file):
found = True
captured_context = open(capture_file, "r").readlines()
replayed_context = open(replay_file, "r").readlines()
for line in difflib.unified_diff(
captured_context, replayed_context, fromfile=capture_file, tofile=replay_file):
print(line, end="")
else:
if frame > CAPTURE_FRAME_END:
break
frame = frame + 1
if not found:
logging.error('Could not find serialization diff files for %s' % test_name)
def UnlinkContextStateJsonFilesIfPresent(replay_build_dir):
for f in glob.glob(os.path.join(replay_build_dir, '*_ContextCaptured*.json')):
os.unlink(f)
for f in glob.glob(os.path.join(replay_build_dir, '*_ContextReplayed*.json')):
os.unlink(f)
class TestExpectation():
# tests that must not be run as list
skipped_for_capture_tests = {}
skipped_for_capture_tests_re = {}
# test expectations for tests that do not pass
non_pass_results = {}
# COMPILE_FAIL
compile_fail_tests = {}
compile_fail_tests_re = {}
flaky_tests = []
non_pass_re = {}
result_map = {
"FAIL": GroupedResult.Failed,
"TIMEOUT": GroupedResult.TimedOut,
"COMPILE_FAIL": GroupedResult.CompileFailed,
"NOT_RUN": GroupedResult.Skipped,
"SKIP_FOR_CAPTURE": GroupedResult.Skipped,
"PASS": GroupedResult.Passed,
}
def __init__(self, args):
expected_results_filename = "capture_replay_expectations.txt"
expected_results_path = os.path.join(REPLAY_SAMPLE_FOLDER, expected_results_filename)
self._asan = args.asan
with open(expected_results_path, "rt") as f:
for line in f:
l = line.strip()
if l != "" and not l.startswith("#"):
self.ReadOneExpectation(l, args.debug)
def _CheckTagsWithConfig(self, tags, config_tags):
for tag in tags:
if tag not in config_tags:
return False
return True
def ReadOneExpectation(self, line, is_debug):
(testpattern, result) = line.split('=')
(test_info_string, test_name_string) = testpattern.split(':')
test_name = test_name_string.strip()
test_info = test_info_string.strip().split()
result_stripped = result.strip()
tags = []
if len(test_info) > 1:
tags = test_info[1:]
config_tags = [GetPlatformForSkip()]
if self._asan:
config_tags += ['ASAN']
if is_debug:
config_tags += ['DEBUG']
if self._CheckTagsWithConfig(tags, config_tags):
test_name_regex = re.compile('^' + test_name.replace('*', '.*') + '$')
if result_stripped == 'COMPILE_FAIL':
self.compile_fail_tests[test_name] = self.result_map[result_stripped]
self.compile_fail_tests_re[test_name] = test_name_regex
if result_stripped == 'SKIP_FOR_CAPTURE' or result_stripped == 'TIMEOUT':
self.skipped_for_capture_tests[test_name] = self.result_map[result_stripped]
self.skipped_for_capture_tests_re[test_name] = test_name_regex
elif result_stripped == 'FLAKY':
self.flaky_tests.append(test_name_regex)
else:
self.non_pass_results[test_name] = self.result_map[result_stripped]
self.non_pass_re[test_name] = test_name_regex
def TestIsSkippedForCapture(self, test_name):
return any(p.match(test_name) for p in self.skipped_for_capture_tests_re.values())
def TestIsCompileFail(self, test_name):
return any(p.match(test_name) for p in self.compile_fail_tests_re.values())
def Filter(self, test_list, run_all_tests):
result = {}
for t in test_list:
for key in self.non_pass_results.keys():
if self.non_pass_re[key].match(t) is not None:
result[t] = self.non_pass_results[key]
for key in self.compile_fail_tests.keys():
if self.compile_fail_tests_re[key].match(t) is not None:
result[t] = self.compile_fail_tests[key]
if run_all_tests:
for [key, r] in self.skipped_for_capture_tests.items():
if self.skipped_for_capture_tests_re[key].match(t) is not None:
result[t] = r
return result
def IsFlaky(self, test_name):
for flaky in self.flaky_tests:
if flaky.match(test_name) is not None:
return True
return False
def GetPlatformForSkip():
# yapf: disable
# we want each pair on one line
platform_map = { 'win32' : 'WIN',
'linux' : 'LINUX' }
# yapf: enable
return platform_map.get(sys.platform, 'UNKNOWN')
def RunInParallel(f, lst, max_workers, stop_event):
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
future_to_arg = {executor.submit(f, arg): arg for arg in lst}
try:
for future in concurrent.futures.as_completed(future_to_arg):
yield future, future_to_arg[future]
except KeyboardInterrupt:
stop_event.set()
raise
def RunProcess(cmd, env, xvfb_pool, stop_event, timeout):
stdout = [None]
def _Reader(process):
stdout[0] = process.stdout.read().decode()
with GetDisplayEnv(env, xvfb_pool) as run_env:
process = subprocess.Popen(
cmd, env=run_env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
t = threading.Thread(target=_Reader, args=(process,))
t.start()
time_start = time.time()
while True:
time.sleep(0.1)
if process.poll() is not None:
t.join()
return process.returncode, stdout[0]
if timeout is not None and time.time() - time_start > timeout:
process.kill()
t.join()
return subprocess.TimeoutExpired, stdout[0]
if stop_event.is_set():
process.kill()
t.join()
return None, stdout[0]
def ReturnCodeWithNote(rc):
s = 'rc=%s' % rc
if sys.platform.startswith('linux'):
if rc == -9:
# OOM killer sends SIGKILL to the process, return code is -signal
s += ' SIGKILL possibly due to OOM'
return s
def RunCaptureInParallel(args, trace_folder_path, test_names, worker_count, xvfb_pool):
n = args.batch_count
test_batches = [test_names[i:i + n] for i in range(0, len(test_names), n)]
extra_env = GetCaptureEnv(args, trace_folder_path)
env = {**os.environ.copy(), **extra_env}
test_exe_path = os.path.join(args.out_dir, 'Capture', args.test_suite)
stop_event = threading.Event()
def _RunCapture(tests):
filt = ':'.join(tests)
results_file = tempfile.mktemp()
cmd = [
test_exe_path,
'--gtest_filter=%s' % filt,
'--angle-per-test-capture-label',
'--results-file=' + results_file,
]
# Add --use-config to avoid registering all test configurations
configs = set([t.split('/')[-1] for t in filt.split(':')])
if len(configs) == 1:
config, = configs
if '*' not in config:
cmd.append('--use-config=%s' % config)
test_results = None
try:
rc, stdout = RunProcess(cmd, env, xvfb_pool, stop_event, CAPTURE_SUBPROCESS_TIMEOUT)
if rc == 0:
with open(results_file) as f:
test_results = json.load(f)
finally:
try:
os.unlink(results_file)
except Exception:
pass
return rc, test_results, stdout
skipped_by_suite = set()
capture_failed = False
for (future, tests) in RunInParallel(_RunCapture, test_batches, worker_count, stop_event):
rc, test_results, stdout = future.result()
if rc == subprocess.TimeoutExpired:
logging.error('Capture failed - timed out after %ss\nTests: %s\nPartial stdout:\n%s',
CAPTURE_SUBPROCESS_TIMEOUT, ':'.join(tests), stdout)
capture_failed = True
continue
if rc != 0:
logging.error('Capture failed (%s)\nTests: %s\nStdout:\n%s', ReturnCodeWithNote(rc),
':'.join(tests), stdout)
capture_failed = True
continue
if args.show_capture_stdout:
logging.info('Capture test stdout:\n%s', stdout)
for test_name, res in test_results['tests'].items():
if res['actual'] == 'SKIP':
skipped_by_suite.add(test_name)
return not capture_failed, skipped_by_suite
def RunReplayTestsInParallel(args, replay_build_dir, replay_tests, expected_results,
labels_to_tests, worker_count, xvfb_pool):
extra_env = {}
if args.expose_nonconformant_features:
extra_env['ANGLE_FEATURE_OVERRIDES_ENABLED'] = 'exposeNonConformantExtensionsAndVersions'
env = {**os.environ.copy(), **extra_env}
stop_event = threading.Event()
def _RunReplay(test):
replay_exe_path = os.path.join(replay_build_dir, REPLAY_BINARY)
cmd = [replay_exe_path, TestLabel(test)]
return RunProcess(cmd, env, xvfb_pool, stop_event, REPLAY_SUBPROCESS_TIMEOUT)
replay_failed = False
for (future, test) in RunInParallel(_RunReplay, replay_tests, worker_count, stop_event):
expected_to_pass = expected_results[test] == GroupedResult.Passed
rc, stdout = future.result()
if rc == subprocess.TimeoutExpired:
if expected_to_pass:
logging.error('Replay failed - timed out after %ss\nTest: %s\nPartial stdout:\n%s',
REPLAY_SUBPROCESS_TIMEOUT, test, stdout)
replay_failed = True
else:
logging.info('Ignoring replay timeout due to expectation: %s [expected %s]', test,
expected_results[test])
continue
if rc != 0:
if expected_to_pass:
logging.error('Replay failed (%s)\nTest: %s\nStdout:\n%s', ReturnCodeWithNote(rc),
test, stdout)
replay_failed = True
else:
logging.info('Ignoring replay failure due to expectation: %s [expected %s]', test,
expected_results[test])
continue
if args.show_replay_stdout:
logging.info('Replay test stdout:\n%s', stdout)
output_lines = stdout.splitlines()
for output_line in output_lines:
words = output_line.split(" ")
if len(words) == 3 and words[0] == RESULT_TAG:
test_name = labels_to_tests[words[1]]
result = int(words[2])
if result == 0:
pass
elif result == REPLAY_INITIALIZATION_FAILURE:
if expected_to_pass:
replay_failed = True
logging.error('Replay failed. Initialization failure: %s' % test_name)
else:
logging.info(
'Ignoring replay failure due to expectation: %s [expected %s]', test,
expected_results[test])
elif result == REPLAY_SERIALIZATION_FAILURE:
if expected_to_pass:
replay_failed = True
logging.error('Replay failed. Context comparison failed: %s' % test_name)
PrintContextDiff(replay_build_dir, words[1])
else:
logging.info(
'Ignoring replay context diff due to expectation: %s [expected %s]',
test, expected_results[test])
else:
replay_failed = True
logging.error('Replay failed. Unknown result code: %s -> %d' %
(test_name, result))
return not replay_failed
def CleanupAfterReplay(replay_build_dir, test_labels):
# Remove files that have test labels in the file name, .e.g:
# ClearTest_ClearIsClamped_ES2_Vulkan_SwiftShader.dll.pdb
for build_file in os.listdir(replay_build_dir):
if any(label in build_file for label in test_labels):
os.unlink(os.path.join(replay_build_dir, build_file))
def main(args):
angle_test_util.SetupLogging(args.log.upper())
# Set cwd to ANGLE root
os.chdir(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
if getpass.getuser() == 'chrome-bot':
# bots need different re-client auth settings than developers b/319246651
os.environ["RBE_use_gce_credentials"] = "true"
os.environ["RBE_use_application_default_credentials"] = "false"
os.environ["RBE_automatic_auth"] = "false"
os.environ["RBE_experimental_credentials_helper"] = ""
os.environ["RBE_experimental_credentials_helper_args"] = ""
trace_dir = "%s%d" % (TRACE_FOLDER, 0)
trace_folder_path = os.path.join(REPLAY_SAMPLE_FOLDER, trace_dir)
if os.path.exists(trace_folder_path):
shutil.rmtree(trace_folder_path)
os.makedirs(trace_folder_path)
capture_build_dir = os.path.join(args.out_dir, 'Capture')
replay_build_dir = os.path.join(args.out_dir, 'Replay%d' % 0)
logging.info('Building capture tests')
if args.use_siso:
for build_dir in [capture_build_dir, replay_build_dir]:
if os.path.exists(os.path.join(build_dir, '.ninja_deps')):
logging.info('Removing %s to switch from Ninja to Siso', build_dir)
shutil.rmtree(build_dir)
subprocess.check_call(
[sys.executable, GN_PATH, 'gen',
'--args=%s' % GetGnArgsStr(args), capture_build_dir])
subprocess.check_call(
[sys.executable, AUTONINJA_PATH, '-C', capture_build_dir, args.test_suite])
with MaybeXvfbPool(args.xvfb, 1) as xvfb_pool:
logging.info('Getting test list')
test_path = os.path.join(capture_build_dir, args.test_suite)
with GetDisplayEnv(os.environ, xvfb_pool) as env:
test_list = subprocess.check_output(
[test_path, "--list-tests",
"--gtest_filter=%s" % args.filter], env=env, text=True)
test_expectation = TestExpectation(args)
test_names = ParseTestNamesFromTestList(test_list, test_expectation,
args.also_run_skipped_for_capture_tests)
test_expectation_for_list = test_expectation.Filter(test_names,
args.also_run_skipped_for_capture_tests)
test_names = [
t for t in test_names if (not test_expectation.TestIsCompileFail(t) and
not test_expectation.TestIsSkippedForCapture(t))
]
if not test_names:
logging.error('No capture tests to run. Is everything skipped?')
return EXIT_FAILURE
worker_count = min(args.max_jobs, os.cpu_count(), 1 + len(test_names) // 10)
logging.info('Running %d capture tests, worker_count=%d batch_count=%d', len(test_names),
worker_count, args.batch_count)
with MaybeXvfbPool(args.xvfb, worker_count) as xvfb_pool:
success, skipped_by_suite = RunCaptureInParallel(args, trace_folder_path, test_names,
worker_count, xvfb_pool)
if not success:
logging.error('Capture tests failed, see "Capture failed" errors above')
return EXIT_FAILURE
logging.info('RunCaptureInParallel finished')
labels_to_tests = {TestLabel(t): t for t in test_names}
all_trace_files = [f.name for f in os.scandir(trace_folder_path) if f.is_file()]
replay_tests = []
failed = False
for test_name in test_names:
if test_name not in skipped_by_suite:
if CaptureProducedRequiredFiles(all_trace_files, test_name):
replay_tests.append(test_name)
else:
logging.error('Capture failed: test missing replay files: %s', test_name)
failed = True
if failed:
logging.error('Capture tests failed, see "Capture failed" errors above')
return EXIT_FAILURE
logging.info('CaptureProducedRequiredFiles finished')
composite_file_id = 1
names_path = os.path.join(trace_folder_path, 'test_names_%d.json' % composite_file_id)
with open(names_path, 'w') as f:
f.write(json.dumps({'traces': [TestLabel(t) for t in replay_tests]}))
replay_build_dir = os.path.join(args.out_dir, 'Replay%d' % 0)
UnlinkContextStateJsonFilesIfPresent(replay_build_dir)
logging.info('Building replay tests')
extra_gn_args = [('angle_build_capture_replay_tests', 'true'),
('angle_capture_replay_test_trace_dir', '"%s"' % trace_dir),
('angle_capture_replay_composite_file_id', str(composite_file_id))]
subprocess.check_call([
sys.executable, GN_PATH, 'gen',
'--args=%s' % GetGnArgsStr(args, extra_gn_args), replay_build_dir
])
subprocess.check_call(
[sys.executable, AUTONINJA_PATH, '-C', replay_build_dir, REPLAY_BINARY])
if not replay_tests:
logging.error('No replay tests to run. Is everything skipped?')
return EXIT_FAILURE
logging.info('Running %d replay tests', len(replay_tests))
expected_results = {}
for test in replay_tests:
expected_result = test_expectation_for_list.get(test, GroupedResult.Passed)
if test_expectation.IsFlaky(test):
expected_result = 'Flaky'
expected_results[test] = expected_result
if not RunReplayTestsInParallel(args, replay_build_dir, replay_tests, expected_results,
labels_to_tests, worker_count, xvfb_pool):
logging.error('Replay tests failed, see "Replay failed" errors above')
return EXIT_FAILURE
logging.info('Replay tests finished successfully')
if not args.keep_temp_files:
CleanupAfterReplay(replay_build_dir, list(labels_to_tests.keys()))
shutil.rmtree(trace_folder_path)
return EXIT_SUCCESS
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--out-dir',
default=DEFAULT_OUT_DIR,
help='Where to build ANGLE for capture and replay. Relative to the ANGLE folder. Default is "%s".'
% DEFAULT_OUT_DIR)
parser.add_argument(
'-f',
'--filter',
'--gtest_filter',
default=DEFAULT_FILTER,
help='Same as GoogleTest\'s filter argument. Default is "%s".' % DEFAULT_FILTER)
parser.add_argument(
'--test-suite',
default=DEFAULT_TEST_SUITE,
help='Test suite binary to execute. Default is "%s".' % DEFAULT_TEST_SUITE)
parser.add_argument(
'--batch-count',
default=DEFAULT_BATCH_COUNT,
type=int,
help='Number of tests in a (capture) batch. Default is %d.' % DEFAULT_BATCH_COUNT)
parser.add_argument(
'--keep-temp-files',
action='store_true',
help='Whether to keep the temp files and folders. Off by default')
parser.add_argument(
'--use-remoteexec',
'--use-reclient', # TODO: crbug.com/401959048 - remove after siso migration.
default=False,
action='store_true',
help='Set use_remoteexec=true in args.gn.')
parser.add_argument(
'--use-siso', default=False, action='store_true', help='Set use_siso=true in args.gn.')
parser.add_argument(
'--result-file',
default=DEFAULT_RESULT_FILE,
help='Name of the result file in the capture_replay_tests folder. Default is "%s".' %
DEFAULT_RESULT_FILE)
parser.add_argument('-v', '--verbose', action='store_true', help='Shows full test output.')
parser.add_argument(
'-l',
'--log',
default=DEFAULT_LOG_LEVEL,
help='Controls the logging level. Default is "%s".' % DEFAULT_LOG_LEVEL)
parser.add_argument(
'-j',
'--max-jobs',
default=DEFAULT_MAX_JOBS,
type=int,
help='Maximum number of test processes. Default is %d.' % DEFAULT_MAX_JOBS)
parser.add_argument(
'-M',
'--mec',
default=0,
type=int,
help='Enable mid execution capture starting at specified frame, (default: 0 = normal capture)'
)
parser.add_argument(
'-a',
'--also-run-skipped-for-capture-tests',
action='store_true',
help='Also run tests that are disabled in the expectations by SKIP_FOR_CAPTURE')
parser.add_argument('--xvfb', action='store_true', help='Run with xvfb.')
parser.add_argument('--asan', action='store_true', help='Build with ASAN.')
parser.add_argument(
'-E',
'--expose-nonconformant-features',
action='store_true',
help='Expose non-conformant features to advertise GLES 3.2')
parser.add_argument(
'--show-capture-stdout', action='store_true', help='Print test stdout during capture.')
parser.add_argument(
'--show-replay-stdout', action='store_true', help='Print test stdout during replay.')
parser.add_argument('--debug', action='store_true', help='Debug builds (default is Release).')
args = parser.parse_args()
if args.debug and (args.out_dir == DEFAULT_OUT_DIR):
args.out_dir = args.out_dir + "Debug"
if sys.platform == "win32":
args.test_suite += ".exe"
sys.exit(main(args))