AnyBot/deploy/linux/dev/test.sh

30 lines
1.5 KiB
Bash
Raw Permalink Normal View History

#!/bin/sh
# Build and test the Linux version from a Mac (or anywhere with Docker), on a virtual screen.
# docker build -t anybot-linux-dev deploy/linux/dev (once)
# deploy/linux/dev/test.sh (from app/)
# Runs: every unit test; the live X11 test (screenshot, clicks, keys, recording a demo); the live Wayland test (headless sway: screenshot,
# clicks, Chinese typing, keys, scroll); and screenshots of the window into ./linux-shots.
set -e
cd "$(dirname "$0")/../../.."
mkdir -p linux-shots
docker run --rm -v "$PWD":/src -v anybot-linux-target:/target -v anybot-linux-cargo:/usr/local/cargo/registry \
-v "$PWD/linux-shots":/out -e CARGO_TARGET_DIR=/target -w /src anybot-linux-dev sh -c '
set -e
cargo build --release 2>&1 | grep -E "^(error|warning)" -A7 || true
Xvfb :99 -screen 0 1400x900x24 >/dev/null 2>&1 &
export DISPLAY=:99 LANG=zh_TW.UTF-8
sleep 1
Bug sweep: gates, relay 2FA, Windows input, snapshots, encodings Permissions and reach - a file leaving a computer passes the same questions as reading it; "looking" shell commands that do more than look ask first - a symlink out of the work/sealed folder counts as outside it (real paths, not just lexical ones); the search walk skips links - web_fetch and skill_install read the public web only: localhost, the LAN and cloud metadata are refused, at every redirect - preview shows a file without running it; browser_upload may ask - vault: logins no longer match across shared suffixes (pages.dev, com.tw, ...); registrable_domain knows public suffixes - axwrite: found elements are retained (use-after-free) Relay - replacing or turning off 2FA needs the current code (rate-limited); new recovery codes only count once enrollment is verified - a removed computer loses its socket and its `call` access - a site name taken by another account answers 409 - RELAY_TRUST_PROXY: the login lock counts the caller's address, not the proxy's (compose files and README) - httpd: half a body is not a request Desktop - sign-in, join and restore work with 2FA on (code field; --serve reads ANYBOT_ACCOUNT_CODE; the setup wizard points to a pairing code) - Windows: text was typed twice; modifiers are held through click, drag and scroll; horizontal scroll; screen control is no longer refused - a recording that hits the limit is transcribed, not thrown away - bot's computer: a new home volume restores the snapshot; a snapshot is read through before the home is wiped; a failed volume removal stops reset/restore - events of a stopped turn no longer land in the next one; each channel message gets a turn of its own - saving a bot's settings keeps what it got meanwhile (three-way merge); a save file that cannot be read is kept - pages in Big5/GBK/Shift_JIS are read in their own encoding (encoding_rs); osascript output past 64 KB no longer stalls - pick_tab keeps a job's own non-http tab; pictures larger than the texture limit are fitted; the auto-update time field takes typing - skills live in <data>/skills; memories are unnumbered in the prompt; the phone may skillify and skill_install CI - the test step fails when the tests fail (it piped into tail) Tests: anybot 268 passed, 27 ignored; relay 16 passed; clippy unchanged. Not run: Windows on a real machine (win.rs type-checked alone), the Docker paths of the bot's computer, the live accessibility writes. Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-10 03:46:17 +00:00
# (A failing test stops here: piped straight into grep, the result was the one grep gave.)
run_tests() {
cargo test --release "$@" >/tmp/anybot-test.log 2>&1 && rc=0 || rc=$?
grep -E "test result|FAILED|panicked" /tmp/anybot-test.log || true
return $rc
}
run_tests
run_tests x11_live -- --ignored
useradd -m t 2>/dev/null; chmod 777 /out
runuser -u t -- env CARGO_TARGET_DIR=/target HOME=/home/t sh deploy/linux/dev/wayland_live.sh 2>&1 | sed -n "/--- wev heard/,\$p"
for v in chat computers general; do
ANYBOT_DATA_DIR=/tmp/anybot-data ANYBOT_SHOT_VIEW=$v ANYBOT_SHOT_DARK=1 timeout 90 /target/release/anybot --screenshot /out/$v.png >/dev/null 2>&1 && echo "shot $v"
done'