# # \brief Boot test for the demo device driver manager # \author Norman Feske # \date 2012-01-17 # # This test exercises the auto-probing of the boot medium performed by d3m. # D3m support booting from both CD-ROM and USB storage. Both options are # tested via different qemu arguments. # # # Sanity checks # # The test does only work for platforms that use qemu to boot. Because the test # uses x86-specific drivers, it won't execute on other architectures. # if {[have_spec linux]} { puts "Does not run on Linux"; exit 0 } if {![have_spec x86_32]} { puts "Runs only on x86_32"; exit 0 } # # Build # build { core init drivers/timer drivers/pci drivers/framebuffer/vesa drivers/input/ps2 drivers/atapi drivers/nic drivers/usb server/d3m server/iso9660 } create_boot_directory # # Config # set config { } install_config $config # create magic tag file on iso image, which marks the boot medium exec touch [run_dir]/libc.lib.so # # Boot modules # build_boot_image { core init pci_drv fb_drv ps2_drv atapi_drv timer nic_drv usb_drv d3m iso9660 } # # Customized variant of spawn_qemu function, which lets us define all qemu # arguments via the 'qemu_args' variable. # proc spawn_qemu { wait_for_re timeout_value } { global output global qemu_args global qemu global spawn_id set qemu "qemu-system-i386" set timeout $timeout_value set pid [eval "spawn $qemu $qemu_args"] if {$wait_for_re == "forever"} { interact $pid } expect { -re $wait_for_re { } timeout { puts stderr "Error: Test execution timed out"; exit -2 } } set output $expect_out(buffer) } # # Inherit qemu arguments specified at the build configuration # set common_qemu_args "$qemu_args -serial mon:stdio -nographic -m 512 " # # First, try to use the ISO image as CD-ROM. We expect the ATAPI driver to # detect the boot image. # set qemu_args "$common_qemu_args -cdrom [run_dir].iso" run_genode_until {.*"iso9660" announces service "ROM".*\n} 30 close $spawn_id puts "\nBooting from CD-ROM succeeded\n" # # Second, try to use the ISO image as USB stick. We expect the USB driver to # detect the boot image. # # The timeout is a bit larger because using isolinux takes a while. # set qemu_args "$common_qemu_args -usbdevice disk::[run_dir].iso" run_genode_until {.*"iso9660" announces service "ROM".*\n} 60 close $spawn_id puts "\nBooting from USB storage device succeeded\n" puts "Test succeeded"