Skip to content

Commit e939b41

Browse files
committed
Let the Linux Flutter exit runner use the logged-on desktop
--display desktop-wayland / desktop-x11 keep the session's display and graphics driver instead of private Xvfb/Weston with software rendering, and run the Flutter-only control plus both nativeapi modes (36 checks). Not yet run on a real desktop; the private-display default is unchanged.
1 parent 8ff0460 commit e939b41

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

‎tools/gui/README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ reports compositor shader setup/cleanup warnings, and headless Weston has no key
121121
seat. The runner preserves these messages and compares their counts with the control;
122122
`--fatal-warnings` additionally makes all SDK/GTK warnings fatal.
123123

124+
For the real compositor and graphics driver, run inside the logged-on session with
125+
`--display desktop-wayland` (or `--display desktop-x11` for X11/Xwayland).
126+
These modes retain the session environment and do not force software rendering;
127+
they run the Flutter-only control plus both nativeapi modes (36 checks). The apps
128+
show and close their own windows without synthetic input. Xvfb and Weston are only
129+
required for the default private-display mode.
130+
124131
The shape demo runs against a debug build of the example in the host's scratch dir
125132
(`$REMOTE_SCRATCH/shape-flutter-linux/examples/flutter_shaped_window_example`, or `SHAPE_EXAMPLE_DIR`);
126133
put one there with `git archive <sha> pubspec.yaml bindings/dart examples/flutter_shaped_window_example | ssh <host> "mkdir -p ... && tar -x -C ..."` (the example resolves through the root pub workspace, so all three paths are needed)

‎tools/gui/core_application_exit_flutter_linux.py‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env python3
2-
"""Build a real Flutter app and test secondary close/exit on private displays.
2+
"""Build a real Flutter app and test secondary close/exit on Linux displays.
33
44
Run on Linux with Flutter, clang, GTK3 development files, Xvfb, Weston and
5-
dbus-run-session installed. No desktop input or existing display is used.
5+
dbus-run-session installed for private displays. Use --display desktop-wayland
6+
or desktop-x11 inside a logged-on desktop session to test its real compositor
7+
and graphics driver instead. No synthetic input is sent in either mode.
68
The saved work directory includes the generated app, native assets and logs.
79
Flutter-only controls run the same lifecycle without nativeapi native assets;
810
SDK warnings remain visible, and additional nativeapi diagnostics fail the test.
@@ -49,9 +51,15 @@ def main():
4951
default=Path(__file__).resolve().parents[2])
5052
parser.add_argument("--flutter", default="flutter")
5153
parser.add_argument("--work-dir", type=Path)
54+
parser.add_argument("--display", choices=("private", "desktop-wayland", "desktop-x11"),
55+
default="private", help="Private displays or the current desktop")
5256
parser.add_argument("--fatal-warnings", action="store_true",
5357
help="Also make Flutter/GTK SDK diagnostics fatal")
5458
args = parser.parse_args()
59+
if args.display == "desktop-wayland" and not os.environ.get("WAYLAND_DISPLAY"):
60+
raise ValueError("desktop-wayland requires the logged-on Wayland session environment")
61+
if args.display == "desktop-x11" and not os.environ.get("DISPLAY"):
62+
raise ValueError("desktop-x11 requires the logged-on X11/Xwayland session environment")
5563
work = (args.work_dir or Path(tempfile.mkdtemp(prefix="nativeapi-flutter-exit-"))).resolve()
5664
work.mkdir(parents=True, exist_ok=True)
5765
print(f"Artifacts: {work}", flush=True)
@@ -120,10 +128,16 @@ def main():
120128
runtime.mkdir(mode=0o700, exist_ok=True)
121129
runtime.chmod(0o700)
122130
test_env = env.copy()
123-
for key in ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS",
124-
"NO_AT_BRIDGE", "G_DEBUG"):
131+
for key in ("NO_AT_BRIDGE", "G_DEBUG"):
125132
test_env.pop(key, None)
126-
test_env.update(XDG_RUNTIME_DIR=str(runtime), LIBGL_ALWAYS_SOFTWARE="1")
133+
if args.display == "private":
134+
for key in ("DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "DBUS_SESSION_BUS_ADDRESS"):
135+
test_env.pop(key, None)
136+
test_env.update(XDG_RUNTIME_DIR=str(runtime), LIBGL_ALWAYS_SOFTWARE="1")
137+
else:
138+
print(f"Using {args.display}: DISPLAY={test_env.get('DISPLAY')}, "
139+
f"WAYLAND_DISPLAY={test_env.get('WAYLAND_DISPLAY')}, "
140+
f"LIBGL_ALWAYS_SOFTWARE={test_env.get('LIBGL_ALWAYS_SOFTWARE', 'unset')}", flush=True)
127141
if args.fatal_warnings:
128142
test_env["G_DEBUG"] = "fatal-warnings"
129143

@@ -163,6 +177,10 @@ def verify(backend, launcher, extra):
163177
if diagnostics(control_output):
164178
print(f"SDK diagnostics also occur in Flutter-only control: {dict(diagnostics(control_output))}", flush=True)
165179
print(f"PASS: {backend}/{mode}: 18 checks and real GTK process exit 0", flush=True)
180+
if args.display != "private":
181+
verify(args.display.removeprefix("desktop-"), [], {})
182+
print(f"ALL PASS: real Flutter secondary close and normal exit on {args.display}", flush=True)
183+
return
166184
verify("x11", ["dbus-run-session", "--", "xvfb-run", "-a", "-s",
167185
"-screen 0 1280x960x24"], {})
168186
weston_log = work / "weston.log"

0 commit comments

Comments
 (0)