improve checks
This commit is contained in:
+2
-1
@@ -9,7 +9,8 @@ CONFIG_DIR="$HOME/.config/coredesktop-dev"
|
||||
CONFIG="$CONFIG_DIR/config"
|
||||
|
||||
# First line after the shebang of the pre-push hook this project installs, so it
|
||||
# never overwrites or removes a hook someone else wrote
|
||||
# never overwrites or removes a hook someone else wrote. Used by hooks.sh.
|
||||
# shellcheck disable=SC2034
|
||||
HOOK_MARKER="# Installed by coredesktop-dev; remove with: coredesktop-dev hooks remove"
|
||||
|
||||
die() {
|
||||
|
||||
+4
-2
@@ -107,7 +107,7 @@ select_scenarios() {
|
||||
}
|
||||
|
||||
smoketest_run() {
|
||||
local tier=pr ref=HEAD keep=0 names=()
|
||||
local tier="pr" ref=HEAD keep=0 names=()
|
||||
while (( $# > 0 )); do
|
||||
case "$1" in
|
||||
--tier) tier="${2:-}"; shift 2 || die "--tier needs pr or all" ;;
|
||||
@@ -338,7 +338,9 @@ smoketest_shell() {
|
||||
mkdir -p "$dir"
|
||||
qemu-img create -q -f qcow2 -b "$IMAGES/$image.qcow2" -F qcow2 "$dir/disk.qcow2"
|
||||
vm_start "$dir" "$dir/disk.qcow2"
|
||||
trap 'vm_kill; rm -rf "$dir"' EXIT
|
||||
# Expanded now: $dir is local, and gone by the time the script exits
|
||||
# shellcheck disable=SC2064
|
||||
trap "vm_kill; rm -rf $(printf '%q' "$dir")" EXIT
|
||||
echo "Starting a throwaway copy of the $image image..."
|
||||
vm_wait_up
|
||||
vm_ssh -t
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user