- tools/nested-session.sh (Xvfb -> nested niri, own display/runtime dir, xresize for SMOKE_SIZE); smoke.sh and hidden.sh run in it; wl-input moved to tools/wl-input (own crate) - selftest: click/rclick/pagescroll via wl-input, pagetype via wtype, resize via the nested niri - WebKit sandbox: XDG user dirs (+ test pages in scripted runs) read-only so file:// media plays (D-043) - SMOKE_VISIBLE needs the user's niri window rule, never moves focus (D-044) - launch, basics, input, keys, chrome green hidden Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
2.7 KiB
Shell
Executable file
51 lines
2.7 KiB
Shell
Executable file
#!/bin/bash
|
|
# Hidden run of the WebKit Nacre (S045): Xvfb -> nested niri (tools/nested-session.sh) -> target/release/nacre
|
|
# with a throwaway home, software GL, and a NACRE_SCRIPT selftest script (see src/selftest.rs).
|
|
#
|
|
# tools/hidden.sh <script> [outdir] [-- driver.sh]
|
|
#
|
|
# outdir (default target/hidden/<name>-<time>) gets nacre.log, selftest.log, the script's shots and status files, and
|
|
# home/. @PAGES@ / @PAGESDIR@ in the script are replaced as in tools/smoke.sh. An optional driver script runs next to
|
|
# Nacre with the nested session's environment and these helpers, for real input and compositor screenshots:
|
|
# click X Y [right] wl-input pointer click (logical px of the nested output) scroll X Y N
|
|
# grab NAME grim screenshot of the nested output to $OUT/NAME.png key ... / type TEXT (wtype)
|
|
# Never connects to Tor or proxies. Exits non-zero if Nacre panicked, crashed or the script didn't finish.
|
|
set -u
|
|
root=$(cd "$(dirname "$0")/.." && pwd)
|
|
script=$1; shift
|
|
name=$(basename "$script" .txt)
|
|
out=${1:-$root/target/hidden/$name-$(date +%Y%m%d-%H%M%S)}; [ $# -gt 0 ] && shift
|
|
driver=""; [ "${1:-}" = "--" ] && driver=$2
|
|
mkdir -p "$out"; out=$(cd "$out" && pwd)
|
|
session=$out/session
|
|
sed -e "s|@PAGES@|file://$root/tests/smoke/pages|g" -e "s|@PAGESDIR@|$root/tests/smoke/pages|g" "$script" >"$out/script.txt"
|
|
"$root/tools/nested-session.sh" start "$session" >"$out/nested.log" 2>&1 || { cat "$out/nested.log"; exit 1; }
|
|
trap '"$root/tools/nested-session.sh" stop "$session"' EXIT
|
|
source "$session/env"
|
|
export HOME=$out/home XDG_CONFIG_HOME=$out/home/.config XDG_CACHE_HOME=$out/home/.cache XDG_DATA_HOME=$out/home/.local/share
|
|
mkdir -p "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME"
|
|
W=$root/tools/wl-input/target/release/wl-input
|
|
[ -x "$W" ] || nice cargo build --release -q --manifest-path "$root/tools/wl-input/Cargo.toml"
|
|
export RUST_BACKTRACE=1 NACRE_SCRIPT=$out/script.txt
|
|
dbus-run-session -- "$root/target/release/nacre" >"$out/nacre.log" 2>&1 &
|
|
pid=$!
|
|
if [ -n "$driver" ]; then
|
|
(
|
|
export OUT=$out
|
|
click() { "$W" winit click "$@"; }
|
|
scroll() { "$W" winit scroll "$@"; }
|
|
grab() { grim "$OUT/$1.png"; }
|
|
key() { wtype "$@"; }
|
|
type() { wtype "$1"; }
|
|
source "$driver"
|
|
) >"$out/driver.log" 2>&1 &
|
|
fi
|
|
timeout "${HIDDEN_TIMEOUT:-300}" tail --pid=$pid -f /dev/null
|
|
status=0
|
|
if kill -0 $pid 2>/dev/null; then echo "timeout"; kill $pid; status=1; fi
|
|
wait $pid 2>/dev/null; code=$?
|
|
grep -q "panicked" "$out/nacre.log" && { echo "panic"; status=1; }
|
|
[ $code -ne 0 ] && [ $status -eq 0 ] && { echo "exit code $code"; status=1; }
|
|
grep -q "ASSERT FAILED" "$out/selftest.log" 2>/dev/null && { echo "assert failed"; status=1; }
|
|
echo "out: $out"
|
|
exit $status
|