#!/usr/bin/expect -f log_file -noappend "/tmp/test_debvm_expect.log" namespace eval VZ5 { variable HOSTNAME "[lindex $argv 0]" variable KVER "[lindex $argv 1]" } set DISK_IMG_PATH "[lindex $argv 2]" set KERNEL_PATH "[lindex $argv 3]" set SWAP_PATH "[lindex $argv 4]" set SWAP_UUID "[lindex $argv 5]" set where [file dirname [info script]] source [file join $where testlib.expect] proc VZ5::destroy {} { send_log "\nERROR EXIT DESTROY\n" system "kill [exp_pid]" exit 1 } proc VZ5::abort {} { send_log "\nERROR ABORT\n" set timeout 1 send "\r" expect "[prompt]" { send "shutdown -h now\r"; } timeout destroy set timeout 15 expect eof {} timeout destroy exit 1 } spawn qemu-system-x86_64 \ -name $::VZ5::HOSTNAME \ -m 1024\ -smp 8 -cpu host -machine type=q35,accel=kvm:tcg -no-user-config\ -netdev "user,id=net0,domainname=testvm"\ -device "virtio-net-pci,netdev=net0"\ -device "virtio-rng-pci,rng=rng0"\ -object "rng-random,filename=/dev/urandom,id=rng0"\ -drive "media=disk,format=raw,discard=unmap,file=$DISK_IMG_PATH,if=virtio,cache=unsafe"\ -drive "media=disk,format=raw,discard=unmap,file=$SWAP_PATH,if=virtio,cache=unsafe"\ -kernel $KERNEL_PATH -append "root=/dev/vda rw console=ttyS0,38400n8"\ -nographic -snapshot login test_base test_kernel_version $::VZ5::KVER test_swap test_ssh test_vda_rw test_apt test_reboot shutdown exit 0