summaryrefslogtreecommitdiff
path: root/scripts/testing/setup-testing-env.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/testing/setup-testing-env.sh')
-rwxr-xr-xscripts/testing/setup-testing-env.sh104
1 files changed, 20 insertions, 84 deletions
diff --git a/scripts/testing/setup-testing-env.sh b/scripts/testing/setup-testing-env.sh
index e682553..f0e63aa 100755
--- a/scripts/testing/setup-testing-env.sh
+++ b/scripts/testing/setup-testing-env.sh
@@ -4,9 +4,7 @@
# License: GNU GPLv3
#
# This script performs one-time setup of the testing infrastructure:
-# - Installs QEMU/KVM and libvirt
-# - Configures libvirt networking
-# - Adds user to libvirt group
+# - Installs QEMU/KVM, sshpass, OVMF firmware, and socat
# - Verifies KVM support
# - Creates directories for test artifacts
@@ -20,6 +18,7 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
source "$SCRIPT_DIR/lib/logging.sh"
# Initialize logging
+mkdir -p "$PROJECT_ROOT/test-results"
LOGFILE="$PROJECT_ROOT/test-results/setup-$(date +'%Y%m%d-%H%M%S').log"
init_logging "$LOGFILE"
@@ -41,13 +40,9 @@ section "Installing Required Packages"
PACKAGES=(
qemu-full
- libvirt
- virt-manager
- dnsmasq
- bridge-utils
- iptables
- virt-install
- libguestfs
+ sshpass
+ edk2-ovmf
+ socat
)
for pkg in "${PACKAGES[@]}"; do
@@ -64,46 +59,6 @@ for pkg in "${PACKAGES[@]}"; do
fi
done
-# Enable and start libvirt service
-section "Configuring libvirt Service"
-
-step "Enabling libvirtd service"
-if sudo systemctl enable libvirtd.service >> "$LOGFILE" 2>&1; then
- success "libvirtd service enabled"
-else
- warn "Failed to enable libvirtd service (may already be enabled)"
-fi
-
-step "Starting libvirtd service"
-if sudo systemctl start libvirtd.service >> "$LOGFILE" 2>&1; then
- success "libvirtd service started"
-else
- if sudo systemctl is-active --quiet libvirtd.service; then
- info "libvirtd service is already running"
- else
- error "Failed to start libvirtd service"
- fatal "Service startup failed"
- fi
-fi
-
-# Add user to libvirt group
-section "Configuring User Permissions"
-
-if groups | grep -q libvirt; then
- success "User $USER is already in libvirt group"
-else
- step "Adding user $USER to libvirt group"
- if sudo usermod -a -G libvirt "$USER" >> "$LOGFILE" 2>&1; then
- success "User added to libvirt group"
- warn "You must log out and back in for group membership to take effect"
- warn "After logging back in, re-run this script to continue"
- exit 0
- else
- error "Failed to add user to libvirt group"
- fatal "User configuration failed"
- fi
-fi
-
# Verify KVM support
section "Verifying KVM Support"
@@ -126,6 +81,18 @@ else
info "Load with: sudo modprobe kvm-intel (or kvm-amd)"
fi
+# Verify OVMF firmware
+section "Verifying OVMF Firmware"
+
+OVMF_CODE="/usr/share/edk2/x64/OVMF_CODE.4m.fd"
+OVMF_VARS="/usr/share/edk2/x64/OVMF_VARS.4m.fd"
+
+if [ -f "$OVMF_CODE" ] && [ -f "$OVMF_VARS" ]; then
+ success "OVMF firmware files present"
+else
+ fatal "OVMF firmware files not found (expected at $OVMF_CODE)"
+fi
+
# Create directory structure
section "Creating Directory Structure"
@@ -147,45 +114,14 @@ for dir in "${DIRS[@]}"; do
fi
done
-# Configure default libvirt network
-section "Configuring libvirt Network"
-
-if virsh net-info default &>/dev/null; then
- info "Default network exists"
-
- if virsh net-info default | grep -q "Active:.*yes"; then
- success "Default network is active"
- else
- step "Starting default network"
- if virsh net-start default >> "$LOGFILE" 2>&1; then
- success "Default network started"
- else
- error "Failed to start default network"
- fi
- fi
-
- if virsh net-info default | grep -q "Autostart:.*yes"; then
- info "Default network autostart is enabled"
- else
- step "Enabling default network autostart"
- if virsh net-autostart default >> "$LOGFILE" 2>&1; then
- success "Default network autostart enabled"
- else
- warn "Failed to enable default network autostart"
- fi
- fi
-else
- error "Default network not found"
- info "This is unusual - libvirt should create it automatically"
-fi
-
# Summary
section "Setup Complete"
success "Testing environment is ready"
info ""
info "Next steps:"
-info " 1. Create base VM: ./scripts/testing/create-base-vm.sh"
-info " 2. Run a test: ./scripts/testing/run-test.sh"
+info " 1. Copy an archangel ISO to: $PROJECT_ROOT/vm-images/"
+info " 2. Create base VM: ./scripts/testing/create-base-vm.sh"
+info " 3. Run a test: ./scripts/testing/run-test.sh"
info ""
info "Log file: $LOGFILE"