#!/usr/bin/expect -f log_file -noappend "/tmp/test_libvirt_expect.log" namespace eval VZ5 { variable HOSTNAME "[lindex $argv 0]" variable KVER "[lindex $argv 1]" } variable VMNAME "[lindex $argv 2]" set where [file dirname [info script]] source [file join $where testlib.expect] proc VZ5::destroy {} { system virsh destroy $::VMNAME send_log "ERROR EXIT DESTROY\n" system reset exit 1 } proc VZ5::abort {} { set timeout 5 send_log "\nERROR ABORT\n" send "\r" expect "root@test:~#" {} timeout VZ5::destroy send "shutdown -h now\r" expect eof {} timeout VZ5::destroy send_log "ERROR EXIT" system reset exit 1 } spawn virsh start --console $VMNAME login test_base test_kernel_version $::VZ5::KVER test_swap test_ssh test_vz5_netconfig test_ping test_vda_rw test_apt test_reboot test_virsh_reboot shutdown exit 0