Fail run_impeller_golden_tests if LUCI_CONTEXT && !GOLDCTL (flutter/engine#52300)

Works to prevent future outages like https://github.com/flutter/flutter/issues/147180.

Also added an explicit `--no-skia-gold` flag to use when we don't want Skia Gold used, and used it in the one place we decided (in internal chat) it made sense, `mac_unopt.json` (was added in 674874e613 for validation-layers testing only).
This commit is contained in:
Matan Lurey
2024-04-22 16:17:41 -07:00
committed by GitHub
parent 1fd38c8986
commit 627238cc93
2 changed files with 28 additions and 3 deletions

View File

@@ -166,7 +166,8 @@
"ci/host_debug_unopt_arm64",
"--type",
"dart,dart-host,engine,impeller-golden",
"--engine-capture-core-dump"
"--engine-capture-core-dump",
"--no-skia-gold"
]
}
]

View File

@@ -1053,7 +1053,7 @@ class DirectoryChange():
os.chdir(self.old_cwd)
def run_impeller_golden_tests(build_dir: str):
def run_impeller_golden_tests(build_dir: str, require_skia_gold: bool = False):
"""
Executes the impeller golden image tests from in the `variant` build.
"""
@@ -1085,10 +1085,27 @@ def run_impeller_golden_tests(build_dir: str):
print(diff_result.stdout.decode())
raise RuntimeError('impeller_golden_tests diff failure')
if not require_skia_gold:
print_divider('<')
print('Skipping any SkiaGoldClient invocation as the --no-skia-gold flag was set.')
return
# On release builds and local builds, we typically do not have GOLDCTL set,
# which on other words means that this invoking the SkiaGoldClient would
# throw. Skip this step in those cases and log a notice.
if 'GOLDCTL' not in os.environ:
# On CI, we never want to be running golden tests without Skia Gold.
# See https://github.com/flutter/flutter/issues/147180 as an example.
is_luci = 'LUCI_CONTEXT' in os.environ
if is_luci:
raise RuntimeError(
"""
The GOLDCTL environment variable is not set. This is required for Skia Gold tests.
See https://github.com/flutter/engine/tree/main/testing/skia_gold_client#configuring-ci
for more information.
"""
)
print_divider('<')
print(
'Skipping the SkiaGoldClient invocation as the GOLDCTL environment variable is not set.'
@@ -1223,6 +1240,13 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
type=str,
help='The directory that verbose logs will be copied to in --quiet mode.',
)
parser.add_argument(
'--no-skia-gold',
dest='no_skia_gold',
action='store_true',
default=False,
help='Do not compare golden images with Skia Gold.',
)
args = parser.parse_args()
@@ -1341,7 +1365,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
run_cmd(cmd, cwd=FONT_SUBSET_DIR)
if 'impeller-golden' in types:
run_impeller_golden_tests(build_dir)
run_impeller_golden_tests(build_dir, require_skia_gold=not args.no_skia_gold)
if args.quiet and args.logs_dir:
shutil.copy(LOG_FILE, os.path.join(args.logs_dir, 'run_tests.log'))