improve checks

This commit is contained in:
2026-11-04 10:11:29 -07:00
parent c33736775b
commit b41b70619d
7 changed files with 26 additions and 6 deletions
+5 -2
View File
@@ -5,10 +5,13 @@
# vm_exec, vm_put, vm_reboot, VM_GIT_SSH and VM_GIT_URL.
SMOKETEST_STATE="${XDG_CACHE_HOME:-$HOME/.cache}/coredesktop-dev/smoketest"
# IMAGES and KVM_DEVICE are used by smoketest.sh
# shellcheck disable=SC2034
IMAGES="$SMOKETEST_STATE/images"
# Shared with every VM as its /var/cache/pacman/pkg, so packages download once
PKG_CACHE="$SMOKETEST_STATE/pkg"
SSH_KEY="$SMOKETEST_STATE/id_ed25519"
# shellcheck disable=SC2034
KVM_DEVICE="${KVM_DEVICE:-/dev/kvm}"
VM_USER=tester
@@ -43,8 +46,8 @@ ensure_ssh_key() {
}
free_port() {
local port i
for i in $(seq 50); do
local port
for _ in $(seq 50); do
port=$((20000 + RANDOM % 20000))
[ -z "$(ss -Hltn "( sport = :$port )" 2> /dev/null)" ] && { echo "$port"; return 0; }
done