liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

script.expect (1376B)


      1 set timeout 10
      2 
      3 spawn socat unix-connect:vm/monitor -
      4 set monitor_id $spawn_id
      5 
      6 expect "(qemu)"
      7 send "set_link virtio-net-pci.1 off\n"
      8 expect "(qemu)"
      9 send "set_link virtio-net-pci.0 off\n"
     10 expect "(qemu)"
     11 send "c\r\n"
     12 spawn socat unix-connect:vm/console -
     13 set console_id $spawn_id
     14 
     15 expect "BusyBox" 
     16 expect "#" { send "PS1=RE\\ADY_\\ ; stty -echo \r" }
     17 expect "READY_" { send "s6-rc -b -a list\r"  } ; # -b waits for s6-rc lock
     18 expect "READY_" { send "ls /sys/class/net/lan/master\r" }
     19 expect {
     20   "No such file or directory" { }
     21   timeout { exit 1 }
     22 }
     23 
     24 expect "READY_" { send "cat /sys/class/net/lan/operstate\r" }
     25 expect {
     26   "down" { }
     27   "up" { exit 1 }
     28 }
     29 expect "READY_" { send "s6-rc -a -u change\r"  }
     30 expect {
     31   "unable to take locks" { exit 1 }
     32   "READY_" { send "\r" }
     33 }
     34 
     35 set spawn_id $monitor_id
     36 send "\r"
     37 expect "(qemu)"
     38 send "set_link virtio-net-pci.1 on\n"
     39 expect "(qemu)"
     40 send "set_link virtio-net-pci.0 on\n"
     41 expect "(qemu)"
     42 set spawn_id $console_id
     43 
     44 expect "entered forwarding state"
     45 send "\r"
     46 expect "READY_" { send "cat /sys/class/net/lan/operstate\r" }
     47 expect {
     48   "down" {  exit 1 }
     49   "up" { }
     50 }
     51 
     52 expect "READY_" { send "cat /sys/class/net/lan/master/uevent\r" }
     53 expect {
     54   "INTERFACE=int" { }
     55   timeout { exit 1 }
     56 }
     57 
     58 expect "READY_" { send "s6-rc listall int.link.a.10.8.0.1.member.lan.link ; hostname\r"  }
     59 
     60 expect {
     61   "updown"  {}
     62   timeout { exit 1 }
     63 }
     64