From c706078691b29a2e5f41f494fb05d059474a0c84 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Fri, 3 Jul 2026 12:13:34 +0200 Subject: [PATCH] test: Add customer_testing script for the flutter/tests registry Adds scripts/customer_testing.dart, invoked by an entry in the flutter/tests registry (registry/flame.test) so that Flame's tests run as a presubmit against flutter/flutter framework changes, catching breaking changes early. flutter analyze runs on every platform over the whole pub workspace, and the full per-package test suites run on Linux only, since golden and rendering tests are platform-sensitive. --- .github/.cspell/words_dictionary.txt | 1 + scripts/customer_testing.dart | 50 ++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 scripts/customer_testing.dart diff --git a/.github/.cspell/words_dictionary.txt b/.github/.cspell/words_dictionary.txt index c0afbc5ba92..67a568df51a 100644 --- a/.github/.cspell/words_dictionary.txt +++ b/.github/.cspell/words_dictionary.txt @@ -17,6 +17,7 @@ preorder prerender prerendered pressable +presubmit ptero # short for pterodactyl rasterizes refreshable diff --git a/scripts/customer_testing.dart b/scripts/customer_testing.dart new file mode 100644 index 00000000000..38ffd6d7f31 --- /dev/null +++ b/scripts/customer_testing.dart @@ -0,0 +1,50 @@ +// This file is invoked by the flutter/tests registry entry for Flame +// (https://github.com/flutter/tests/blob/main/registry/flame.test) to run +// Flame's tests as a presubmit against flutter/flutter framework changes. +// Changes here are only honored after the commit hash in that registry entry +// is updated. + +import 'dart:io'; + +Future main() async { + await _run('flutter', ['analyze', '--no-fatal-infos']); + + // Golden and rendering tests are platform-sensitive, so the full per-package + // test suites only run on Linux, where the golden files are generated. + if (!Platform.isLinux) { + return; + } + + final packages = + Directory('packages') + .listSync() + .whereType() + .where( + (directory) => Directory('${directory.path}/test').existsSync(), + ) + .toList() + ..sort((a, b) => a.path.compareTo(b.path)); + + for (final package in packages) { + stdout.writeln('Running tests in ${package.path}'); + await _run('flutter', ['test'], workingDirectory: package.path); + } +} + +Future _run( + String executable, + List arguments, { + String? workingDirectory, +}) async { + final process = await Process.start( + executable, + arguments, + workingDirectory: workingDirectory, + mode: ProcessStartMode.inheritStdio, + runInShell: true, + ); + final exitCode = await process.exitCode; + if (exitCode != 0) { + exit(exitCode); + } +}