From 227bab4aa62be8b206ef2a80bc63fd96fa8be3a2 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 27 Jan 2012 18:08:25 +0100 Subject: [PATCH] Test d3m's auto-probing of the boot device --- gems/run/d3m_boot.run | 149 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 gems/run/d3m_boot.run diff --git a/gems/run/d3m_boot.run b/gems/run/d3m_boot.run new file mode 100644 index 000000000..61e3e9578 --- /dev/null +++ b/gems/run/d3m_boot.run @@ -0,0 +1,149 @@ +# +# \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 vesa_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" + + 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" +