|
1 | 1 | #!/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. |
3 | 3 |
|
4 | 4 | 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. |
6 | 8 | The saved work directory includes the generated app, native assets and logs. |
7 | 9 | Flutter-only controls run the same lifecycle without nativeapi native assets; |
8 | 10 | SDK warnings remain visible, and additional nativeapi diagnostics fail the test. |
@@ -49,9 +51,15 @@ def main(): |
49 | 51 | default=Path(__file__).resolve().parents[2]) |
50 | 52 | parser.add_argument("--flutter", default="flutter") |
51 | 53 | 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") |
52 | 56 | parser.add_argument("--fatal-warnings", action="store_true", |
53 | 57 | help="Also make Flutter/GTK SDK diagnostics fatal") |
54 | 58 | 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") |
55 | 63 | work = (args.work_dir or Path(tempfile.mkdtemp(prefix="nativeapi-flutter-exit-"))).resolve() |
56 | 64 | work.mkdir(parents=True, exist_ok=True) |
57 | 65 | print(f"Artifacts: {work}", flush=True) |
@@ -120,10 +128,16 @@ def main(): |
120 | 128 | runtime.mkdir(mode=0o700, exist_ok=True) |
121 | 129 | runtime.chmod(0o700) |
122 | 130 | 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"): |
125 | 132 | 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) |
127 | 141 | if args.fatal_warnings: |
128 | 142 | test_env["G_DEBUG"] = "fatal-warnings" |
129 | 143 |
|
@@ -163,6 +177,10 @@ def verify(backend, launcher, extra): |
163 | 177 | if diagnostics(control_output): |
164 | 178 | print(f"SDK diagnostics also occur in Flutter-only control: {dict(diagnostics(control_output))}", flush=True) |
165 | 179 | 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 |
166 | 184 | verify("x11", ["dbus-run-session", "--", "xvfb-run", "-a", "-s", |
167 | 185 | "-screen 0 1280x960x24"], {}) |
168 | 186 | weston_log = work / "weston.log" |
|
0 commit comments