Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/wine11-source-trusted-gate-hil.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Wine 11 Pristine Source Trusted Gate HIL

on:
pull_request:
paths:
- 'rdte/protected-control/wine_gate_hil_test.go'
- '.github/workflows/wine11-source-trusted-gate-hil.yml'

permissions:
contents: read

jobs:
wine11-source-gate:
runs-on: ubuntu-24.04
timeout-minutes: 180
env:
GO111MODULE: 'off'
GOTOOLCHAIN: local
DOCKER_BUILD_RECORD_UPLOAD: 'false'
steps:
- name: Checkout exact gate candidate
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}
path: gate
- name: Checkout previously qualified pristine upstream source recipe
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
repository: SemperSupra/WineBot
persist-credentials: false
ref: 18d7fc5d22ffaa13564abb04810a691a96c3b100
path: runtime
- name: Free disposable runner disk
run: sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android /usr/share/swift
- name: Build unmodified SHA256-pinned Wine 11.0 upstream source
working-directory: runtime
shell: bash
run: |
set -euo pipefail
if ! docker build -f docker/wine11-source.Dockerfile -t winebot-r048:pristine . >"$RUNNER_TEMP/wine-r048-build.log" 2>&1; then
echo 'WINE_SOURCE_GATE stage=source_build_failed'
exit 1
fi
echo 'WINE_SOURCE_GATE stage=pristine_source_built'
- name: Add display readiness tool only
shell: bash
run: |
set -euo pipefail
if ! docker build -t winebot-r048:source - >"$RUNNER_TEMP/wine-r048-tool.log" 2>&1 <<'DOCKERFILE'
FROM winebot-r048:pristine
USER root
RUN apt-get update && apt-get install -y --no-install-recommends x11-utils && rm -rf /var/lib/apt/lists/*
USER winebot
DOCKERFILE
then
echo 'WINE_SOURCE_GATE stage=display_tool_failed'
exit 1
fi
echo 'WINE_SOURCE_GATE stage=display_tool_ready'
- name: Compile identical gate qualification
working-directory: gate
run: go test -c -o "$RUNNER_TEMP/wine-source-gate.test" ./rdte/protected-control
- name: Exercise real source-built GUI and durable STOP
run: sudo -n env WINEBOT_REAL_WINE_GATE=1 WINEBOT_WINE_GATE_VARIANT=source "$RUNNER_TEMP/wine-source-gate.test" -test.run '^TestWine11GateStopHIL$' -test.timeout=10m -test.v
- name: Remove private-to-runner raw diagnostics
if: always()
run: rm -f "$RUNNER_TEMP/wine-r048-build.log" "$RUNNER_TEMP/wine-r048-tool.log"
26 changes: 22 additions & 4 deletions rdte/protected-control/wine_gate_hil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ func TestWine11GateStopHIL(t *testing.T){
defer dir.Close()
id,err:=cgroupID(dir)
if err!=nil{t.Fatal("scope identity failed")}
image:=must("image_identity","docker","image","inspect","winebot-r046:local","--format","{{.Id}}")
variant:=os.Getenv("WINEBOT_WINE_GATE_VARIANT")
if variant==""{variant="package"}
imageTag:="winebot-r046:local"
switch variant{
case "package":
case "source":imageTag="winebot-r048:source"
default:t.Fatal("unknown runtime variant")
}
image:=must("image_identity","docker","image","inspect",imageTag,"--format","{{.Id}}")
if !strings.HasPrefix(image,"sha256:") || len(image)!=71{t.Fatal("invalid local image identity")}
g,err:=newWriterGate(root,0,0,dir,id)
if err!=nil{t.Fatal("scope reservation failed",err)}
Expand All @@ -75,7 +83,17 @@ func TestWine11GateStopHIL(t *testing.T){
fail() { printf "WINE_GATE_HIL=FAIL_%s\n" "$1"; exit 1; }
export WINEDLLOVERRIDES=mscoree,mshtml=
test "$(id -u)" = 1000 || fail IDENTITY
test "$(dpkg-query -W -f='${Version}' winehq-stable)" = '11.0.0.0~trixie-1' || fail PACKAGE
case "$WINEBOT_FIXTURE_VARIANT" in
package)
test "$(dpkg-query -W -f='${Version}' winehq-stable)" = '11.0.0.0~trixie-1' || fail PACKAGE
;;
source)
export WINEARCH=wow64
test "$(command -v wine)" = /opt/winebot-wine/11.0/bin/wine || fail SOURCE_PATH
test "$(wine --version)" = wine-11.0 || fail VERSION
;;
*) fail VARIANT ;;
esac
wine --version | grep -Eq '^wine-11[.]0([[:space:]]|$)' || fail VERSION
echo WINE_GATE_HIL=VERSION_OK
Xvfb "$DISPLAY" -screen 0 1024x768x24 -noreset >/dev/null 2>&1 &
Expand Down Expand Up @@ -108,7 +126,7 @@ func TestWine11GateStopHIL(t *testing.T){
`
container:=must("create_fixture","docker","create","--name",name,"--cgroup-parent",parent,
"--network","none","--user","1000:1000","--cap-drop","ALL","--security-opt","no-new-privileges",
"--pids-limit","256","--memory","2g","--init","--entrypoint","/bin/sh",image,"-c",script)
"--pids-limit","256","--memory","2g","--init","--env","WINEBOT_FIXTURE_VARIANT="+variant,"--entrypoint","/bin/sh",image,"-c",script)
if len(container)!=64{t.Fatal("invalid container identity")}
defer exec.Command("docker","rm","-f",container).Run()
if err=e.run(func(context.Context)error{
Expand All @@ -129,7 +147,7 @@ func TestWine11GateStopHIL(t *testing.T){
// Emit only exact allowlisted synthetic receipts; never print raw logs.
stages:=map[string]bool{}
allowed:=[]string{"VERSION_OK","X11_OK","BOOT_OK","PREFIX_OK","WINDOW_OK",
"FAIL_IDENTITY","FAIL_PACKAGE","FAIL_VERSION","FAIL_X11","FAIL_PREFIX_DIRECTORY",
"FAIL_IDENTITY","FAIL_PACKAGE","FAIL_SOURCE_PATH","FAIL_VARIANT","FAIL_VERSION","FAIL_X11","FAIL_PREFIX_DIRECTORY",
"FAIL_PREFIX_WRITABLE","FAIL_WINEBOOT","FAIL_SERVER_WAIT","FAIL_REGISTRY",
"FAIL_COMMAND","FAIL_NOTEPAD_EXIT","FAIL_WINDOW","FAIL_NOTEPAD_WAIT"}
observeStages:=func(){
Expand Down