88 lines
2.4 KiB
Plaintext
Executable File
88 lines
2.4 KiB
Plaintext
Executable File
#!/usr/bin/expect -f
|
|
|
|
source ../config.exp
|
|
|
|
set timeout 120
|
|
set mode [lindex $argv 0]
|
|
|
|
if {$test_mode == "QEMU"} {
|
|
spawn -noecho rm [exec sh -c {echo "/tmp/nvm-file-$USER"}]
|
|
spawn $basedir/build/simulate.sh
|
|
expect "Welcome to ChCore shell!"
|
|
} elseif {$test_mode == "IPMI"} {
|
|
while {1} {
|
|
spawn ipmitool -H $ipmi_ip -U $username -P $passwd -I lanplus sol activate
|
|
expect {
|
|
"SOL Session operational" {
|
|
puts "ipmi connected"
|
|
send -- "shutdown.bin \r"
|
|
expect {
|
|
"Welcome to ChCore shell!" { break }
|
|
"No such binary" { continue }
|
|
timeout {
|
|
spawn ipmitool -H $ipmi_ip -U $username -P $passwd -I lanplus sol deactivate
|
|
continue
|
|
}
|
|
}
|
|
}
|
|
"SOL payload already active on another session" {
|
|
spawn ipmitool -H $ipmi_ip -U $username -P $passwd -I lanplus sol deactivate
|
|
continue
|
|
}
|
|
timeout {
|
|
puts "ipmitool failed"
|
|
exit
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
puts "Currently, we only support IPMI and QEMU mode!"
|
|
}
|
|
|
|
set timeout 300
|
|
|
|
# raw mode: just running default application
|
|
if {$mode == "raw"} {
|
|
puts "test raw kmeans"
|
|
}
|
|
|
|
# ckpt mode: taking checkpoint while running
|
|
if {$mode == "ckpt"} {
|
|
set freq [lindex $argv 1]
|
|
set log [lindex $argv 2]
|
|
puts "test kmeans with 1ms checkpoint"
|
|
|
|
send -- "checkpoint.bin -i %$freq -l 0 -a 9 &\r"
|
|
expect "Launching /checkpoint.bin"
|
|
sleep 5
|
|
}
|
|
|
|
# Launch kmeans with $kmeans_num points
|
|
send -- "kmeans.bin -p $kmeans_num &\r"
|
|
|
|
# ckpt-log mode: taking $ckptlogtimes times of checkpoint with log
|
|
if {$mode == "ckpt-log"} {
|
|
set freq [lindex $argv 1]
|
|
set log [lindex $argv 2]
|
|
|
|
send -- "checkpoint.bin -i %$freq -l $log -a 9 -t $ckptlogtimes &\r"
|
|
expect "Launching /checkpoint.bin"
|
|
expect "Checkpoint finished"
|
|
}
|
|
|
|
# restore mode: take a checkpoint and call shutdown to restore
|
|
if {$mode == "restore-log" || $mode == "restore-test"} {
|
|
set freq [lindex $argv 1]
|
|
set log [lindex $argv 2]
|
|
|
|
send -- "checkpoint.bin -i %$freq -l $log -a 9 -t 4 &\r"
|
|
expect "Checkpoint finished"
|
|
send -- "shutdown.bin 0 & \r"
|
|
expect "restore from ckpt"
|
|
}
|
|
|
|
if {$mode != "ckpt-log" && $mode != "restore-log"} {
|
|
expect "Final means"
|
|
expect "finalize"
|
|
}
|