Без опису
Ви не можете вибрати більше 25 тем Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/expect -f
  2. log_file -noappend "/tmp/test_debvm_expect.log"
  3. namespace eval VZ5 {
  4. variable HOSTNAME "[lindex $argv 0]"
  5. variable KVER "[lindex $argv 1]"
  6. }
  7. set DISK_IMG_PATH "[lindex $argv 2]"
  8. set KERNEL_PATH "[lindex $argv 3]"
  9. set SWAP_PATH "[lindex $argv 4]"
  10. set SWAP_UUID "[lindex $argv 5]"
  11. set where [file dirname [info script]]
  12. source [file join $where testlib.expect]
  13. proc VZ5::destroy {} {
  14. send_log "\nERROR EXIT DESTROY\n"
  15. system "kill [exp_pid]"
  16. exit 1
  17. }
  18. proc VZ5::abort {} {
  19. send_log "\nERROR ABORT\n"
  20. set timeout 1
  21. send "\r"
  22. expect "[prompt]" { send "shutdown -h now\r"; } timeout destroy
  23. set timeout 15
  24. expect eof {} timeout destroy
  25. exit 1
  26. }
  27. spawn qemu-system-x86_64 \
  28. -name $::VZ5::HOSTNAME \
  29. -m 1024\
  30. -smp 8 -cpu host -machine type=q35,accel=kvm:tcg -no-user-config\
  31. -netdev "user,id=net0,domainname=testvm"\
  32. -device "virtio-net-pci,netdev=net0"\
  33. -device "virtio-rng-pci,rng=rng0"\
  34. -object "rng-random,filename=/dev/urandom,id=rng0"\
  35. -drive "media=disk,format=raw,discard=unmap,file=$DISK_IMG_PATH,if=virtio,cache=unsafe"\
  36. -drive "media=disk,format=raw,discard=unmap,file=$SWAP_PATH,if=virtio,cache=unsafe"\
  37. -kernel $KERNEL_PATH -append "root=/dev/vda rw console=ttyS0,38400n8"\
  38. -nographic -snapshot
  39. login
  40. test_base
  41. test_kernel_version $::VZ5::KVER
  42. test_swap
  43. test_ssh
  44. test_vda_rw
  45. test_apt
  46. test_reboot
  47. shutdown
  48. exit 0