Simplify AUR test: use yay like a real user
All checks were successful
CI / test (push) Successful in 2m7s

Instead of manually setting up rust + makepkg, install yay first
then `yay -S btest-rs --noconfirm` — exactly how a user would.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-01 13:51:02 +04:00
parent 66be99bef0
commit fe28c04c19

View File

@@ -4,9 +4,8 @@
# Usage:
# ./scripts/test-aur-remote.sh [user@host]
#
# If no host is given, runs locally (must be x86_64 Linux with Docker).
# The script SSHes to the remote, runs an Arch container, installs from AUR,
# tests loopback, and cleans up.
# Spins up an Arch container, installs btest-rs via yay (like a real user),
# runs loopback tests, cleans up.
set -euo pipefail
REMOTE="${1:-}"
@@ -15,46 +14,41 @@ TEST_SCRIPT='
docker run --rm archlinux:latest bash -c "
set -euo pipefail
echo \"[1/5] Installing build tools...\"
pacman -Syu --noconfirm base-devel rustup git sudo >/dev/null 2>&1
echo \"[2/5] Setting up Rust...\"
rustup default stable >/dev/null 2>&1
echo \"[3/5] Creating build user...\"
echo \"[1/4] Installing yay...\"
pacman -Syu --noconfirm base-devel git sudo >/dev/null 2>&1
useradd -m builder
echo \"builder ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers
echo \"[4/5] Building btest-rs from AUR...\"
su builder -c \"
cd /tmp
git clone https://aur.archlinux.org/btest-rs.git 2>/dev/null
cd btest-rs
makepkg -si --noconfirm 2>&1 | tail -5
git clone https://aur.archlinux.org/yay-bin.git 2>/dev/null
cd yay-bin
makepkg -si --noconfirm 2>&1 | tail -3
\"
echo \"[2/4] Installing btest-rs from AUR via yay...\"
su builder -c \"yay -S btest-rs --noconfirm 2>&1 | tail -10\"
echo \"\"
echo \"[5/5] Testing...\"
echo \"--- Version ---\"
echo \"[3/4] Verify installation...\"
btest --version
which btest
man -w btest.1 2>/dev/null && echo \"Man page: installed\" || echo \"Man page: not found\"
systemctl cat btest.service 2>/dev/null | head -3 && echo \"Systemd unit: installed\" || echo \"Systemd unit: not found\"
echo \"--- Installed files ---\"
pacman -Ql btest-rs
echo \"\"
echo \"[4/4] Loopback tests...\"
echo \"--- Loopback test (TCP, 3s) ---\"
echo \"--- TCP (3s) ---\"
btest -s -P 19876 &
sleep 2
btest -c 127.0.0.1 -P 19876 -r -d 3
kill %1 2>/dev/null || true
wait 2>/dev/null || true
kill %1 2>/dev/null; wait 2>/dev/null || true
echo \"\"
echo \"--- Loopback test (UDP, 3s) ---\"
echo \"--- UDP (3s) ---\"
btest -s -P 19877 &
sleep 2
btest -c 127.0.0.1 -P 19877 -r -u -d 3
kill %1 2>/dev/null || true
wait 2>/dev/null || true
kill %1 2>/dev/null; wait 2>/dev/null || true
echo \"\"
echo \"=== ALL TESTS PASSED ===\"