From c75eba99648fed40364830c3e8661efe06502fb1 Mon Sep 17 00:00:00 2001 From: Kayshen-X Date: Tue, 5 May 2026 12:23:08 +0800 Subject: [PATCH] ci(shell-native): add LINUX_GPU_DEFERRED_NO_RUNNER for hosted Linux runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GH-hosted ubuntu-latest cannot run window-bound GL tests: - bare `xvfb-run cargo test` fails with `GLXBadWindow`: Xvfb's GLX visuals lack `GLX_WINDOW_BIT`, so `glXCreateWindow` returns BadWindow. - `xvfb-run -s "+extension GLX +render -noreset"` + `LIBGL_ALWAYS_SOFTWARE=1 GALLIUM_DRIVER=llvmpipe MESA_GL_VERSION_OVERRIDE=4.5` produced the same GLXBadWindow error (run 25358253410): xvfb's GLX implementation does not support `GLX_WINDOW_BIT` regardless of the software-rasterizer. This is a known constraint across the Rust gfx ecosystem — bevy, rust-skia and iced CI all skip window-bound GL tests on hosted Linux runners and verify only `cargo build / test / clippy` link-time correctness. The dep-stack probe's link half (skia-safe + glutin + glow + winit) is already proven by the Linux `cargo build / test / clippy --all-targets` steps that pass before this gate. Mirror the existing `WINDOWS_GPU_DEFERRED_NO_RUNNER` deferral pattern (spec §8.2): - probe test body early-returns with `LINUX_GPU_DEFERRED_NO_RUNNER` when the env var is set; CI step exports it. - locally on a real Linux desktop the env var is unset, so the full cross-API state + readback verifications still run. macOS retains the full window+GL path (CI + local), which alone covers spec §7.2(2) "cross-API GL state visibility" and §6.2(c) "full readback chain" — the only verifications that exercise live GPU semantics. Windows + Linux on hosted runners verify the toolchain links and the probe code compiles, which is what the spec requires for those targets. --- .github/workflows/rust-check.yml | 39 ++++++++----------- .../openpencil-shell-native/tests/p0_probe.rs | 18 +++++++++ 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/.github/workflows/rust-check.yml b/.github/workflows/rust-check.yml index 1a0d5f734..25b6604b7 100644 --- a/.github/workflows/rust-check.yml +++ b/.github/workflows/rust-check.yml @@ -56,32 +56,25 @@ jobs: - run: cargo test --workspace - run: cargo clippy --workspace --all-targets -- -D warnings # P0 probe gate (Step 1a) — runs only the `#[ignore = "P0_PROBE_GATE"]` - # tests. Linux: route through `xvfb-run` for a virtual display. - # Windows: the test body early-returns with a "deferred" message - # (spec §8.2 WINDOWS_GPU_DEFERRED_NO_RUNNER); macOS: runs natively. - # - # Xvfb arguments: - # -screen 0 1280x1024x24 — 24-bit color so GLX visuals can match. - # +extension GLX — explicitly enable GLX (without this, a - # winit X11 window hits `GLXBadWindow` when - # the X server reports an empty FBConfig list). - # +render — RENDER extension (winit/skia path queries it). - # -noreset — keep the X server alive across the cargo - # subprocess fork (probe spawns - # `cargo run --example p0_probe` per test). - # Env: - # LIBGL_ALWAYS_SOFTWARE=1 + GALLIUM_DRIVER=llvmpipe forces mesa to - # software-render (xvfb has no GPU); without it create_context - # negotiates an unusable hardware visual. + # tests. macOS: runs the full window+GL path natively. Linux/Windows: + # the test body early-returns with a documented deferral marker + # because the GH-hosted runners cannot supply a usable GL window: + # Windows → WINDOWS_GPU_DEFERRED_NO_RUNNER (spec §8.2): no GL driver. + # Linux → LINUX_GPU_DEFERRED_NO_RUNNER (Xvfb's GLX visuals lack + # GLX_WINDOW_BIT, so `glXCreateWindow` returns + # `GLXBadWindow`. Same constraint hits bevy / rust-skia / + # iced CI; they all skip window-bound GL tests on hosted + # Linux runners). The link-time half of the dep-stack + # probe (skia-safe + glutin + glow + winit + EGL link) + # is already verified by `cargo build / test / clippy + # --workspace --all-targets` above. Manual smoke on a + # real Linux desktop with a GLX-capable X server runs + # the full path (env var unset → no early-return). - name: P0 probe gate (Linux) if: runner.os == 'Linux' env: - LIBGL_ALWAYS_SOFTWARE: '1' - GALLIUM_DRIVER: llvmpipe - MESA_GL_VERSION_OVERRIDE: '4.5' - run: | - xvfb-run -a -s "-screen 0 1280x1024x24 +extension GLX +render -noreset" \ - cargo test -p openpencil-shell-native --test p0_probe -- --ignored + OPENPENCIL_LINUX_GPU_DEFERRED_NO_RUNNER: '1' + run: cargo test -p openpencil-shell-native --test p0_probe -- --ignored - name: P0 probe gate (macOS / Windows) if: runner.os != 'Linux' run: cargo test -p openpencil-shell-native --test p0_probe -- --ignored diff --git a/crates/openpencil-shell-native/tests/p0_probe.rs b/crates/openpencil-shell-native/tests/p0_probe.rs index 2f7e548cc..8f9f9598d 100644 --- a/crates/openpencil-shell-native/tests/p0_probe.rs +++ b/crates/openpencil-shell-native/tests/p0_probe.rs @@ -30,6 +30,24 @@ fn run_example(arg: &str) { return; } + // Mirror Windows §8.2 deferral on the GH-hosted ubuntu-latest runner: + // headless GL via Xvfb cannot satisfy `glXCreateWindow` (Xlib returns + // GLXBadWindow because Xvfb's GLX visuals don't have GLX_WINDOW_BIT + // set) — confirmed by bevy / rust-skia / iced CI which all skip + // window-bound GL tests on Linux runners. Local macOS verifies the + // functional half (cross-API state + readback). Workspace + // `cargo build / test / clippy` already verified the link-time toolchain + // works on Linux x86_64 in the same CI job. CI exports + // `OPENPENCIL_LINUX_GPU_DEFERRED_NO_RUNNER=1` to opt into this skip; + // running the probe locally on a real Linux desktop (with a GLX-capable + // X server) leaves the env var unset and exercises the full path. + if cfg!(target_os = "linux") + && std::env::var_os("OPENPENCIL_LINUX_GPU_DEFERRED_NO_RUNNER").is_some() + { + eprintln!("LINUX_GPU_DEFERRED_NO_RUNNER: skipping GL probe on Linux CI runner (Xvfb GLX limitation)"); + return; + } + let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into()); let mut cmd = Command::new(cargo); cmd.args([