#
# Debian 64bit VM cloning Genode git sources, preparing and building pieces
#

assert_spec x86
assert_spec nova

set flavor   "stress_64"
set vm_ram   "1280M"

set use_vbox5 1

set use_rumpfs 1
set use_ram_fs 1
set use_overlay_from_disk 1

set use_serial 1

set use_usb 0
set use_ps2 [expr [have_board pbxa9] || [have_board pc]]

set use_vms 1
set use_cpu_load 0

set output_host ""
set output_host_extra ""
set results_expected { }
set boottime_expected { }

set match_guest_log "\[init -\> log_terminal\]"
set match_boot_string "\[init -\> vbox.*\].*Using VMX virtualization extension"
#set match_guest_down

	set vmm_name "vbox5_nova"

	set use_vcpus 1
	lappend results_expected 1 2 23 76
	lappend boottime_expected 29
	source ${genode_dir}/repos/ports/run/vbox_win.inc
	source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
	kill_spawned [output_spawn_id]

	set use_vcpus 2
	lappend results_expected 2 2 23 46
	lappend boottime_expected 29
	source ${genode_dir}/repos/ports/run/vbox_win.inc
	source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
	kill_spawned [output_spawn_id]

	set use_vcpus 3
	lappend results_expected 3 2 23 38
	lappend boottime_expected 29
	source ${genode_dir}/repos/ports/run/vbox_win.inc
	source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
	kill_spawned [output_spawn_id]

	set use_vcpus 4
	lappend results_expected 4 2 23 35
	lappend boottime_expected 29
	source ${genode_dir}/repos/ports/run/vbox_win.inc
	source ${genode_dir}/repos/ports/run/vmm_vm_stress.inc
	kill_spawned [output_spawn_id]

#
# Dump aggregated output of the several runs above
#
grep_output "$match_guest_log.*cpus="

puts $output

set merge_host_output [split $output_host "\n"]
set merge_host_extra  [split $output_host_extra "\n"]
for { set i 0 } { $i < [llength $merge_host_output] } { incr i} {
	puts "[lindex $merge_host_output $i] [lindex $merge_host_extra $i]"
}

evaluate_stress