From 66be99bef0c67777b2f6931cb08a70525f9c4304 Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Wed, 1 Apr 2026 13:48:16 +0400 Subject: [PATCH] Add remote AUR test script scripts/test-aur-remote.sh: SSHes to a remote x86_64 server, spins up an Arch Docker container, installs btest-rs from AUR, runs TCP + UDP loopback tests, and cleans up. Usage: ./scripts/test-aur-remote.sh root@myserver Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/test-aur-remote.sh | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 scripts/test-aur-remote.sh diff --git a/scripts/test-aur-remote.sh b/scripts/test-aur-remote.sh new file mode 100755 index 0000000..fd39dda --- /dev/null +++ b/scripts/test-aur-remote.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# Test the AUR package on a remote x86_64 Linux server using Docker. +# +# 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. +set -euo pipefail + +REMOTE="${1:-}" + +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...\" +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 +\" + +echo \"\" +echo \"[5/5] Testing...\" +echo \"--- Version ---\" +btest --version + +echo \"--- Installed files ---\" +pacman -Ql btest-rs + +echo \"--- Loopback test (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 + +echo \"\" +echo \"--- Loopback test (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 + +echo \"\" +echo \"=== ALL TESTS PASSED ===\" +" +' + +if [ -n "$REMOTE" ]; then + echo "=== Testing AUR package on $REMOTE ===" + ssh "$REMOTE" "$TEST_SCRIPT" +else + echo "=== Testing AUR package locally ===" + eval "$TEST_SCRIPT" +fi