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