From 5c5d16f524d797e40c1cf13edefd04120bc66a26 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Tue, 2 Feb 2021 01:58:33 +0100 Subject: [PATCH] ports: add 'vbox5_genode_usb_hid_raw' run script Fixes #4009 --- repos/ports/run/vbox5_genode_usb_hid_raw.run | 320 +++++++++++++++++++ repos/ports/run/vm_genode_usb_hid_raw.vbox | 163 ++++++++++ tool/autopilot.list | 1 + 3 files changed, 484 insertions(+) create mode 100644 repos/ports/run/vbox5_genode_usb_hid_raw.run create mode 100644 repos/ports/run/vm_genode_usb_hid_raw.vbox diff --git a/repos/ports/run/vbox5_genode_usb_hid_raw.run b/repos/ports/run/vbox5_genode_usb_hid_raw.run new file mode 100644 index 0000000000..1a20df020f --- /dev/null +++ b/repos/ports/run/vbox5_genode_usb_hid_raw.run @@ -0,0 +1,320 @@ +# +# This run script tests the VirtualBox USB device pass-through feature +# by running the 'usb_hid_raw' test in a VM. +# +# See 'usb_hid_raw.run' for more information about the setup of the 'Pro Micro' USB +# device for automated testing. +# +# Note: the USB device(s) to be passed through must be included in the whitelist. +# + +if { [have_include "power_on/qemu"] || ![have_spec nova] || ![have_spec x86_64]} { + puts "Run script is only supported on 64-bit NOVA on real hardware" + exit 0 +} + +set build_components { + drivers/framebuffer + drivers/ps2 + drivers/usb_host + server/log_terminal + server/fs_rom + server/vfs lib/vfs/import + server/report_rom + app/usb_report_filter + virtualbox5 +} + +source ${genode_dir}/repos/base/run/platform_drv.inc + +# override defaults of platform_drv.inc +proc platform_drv_priority {} { return { priority="-1"} } + +append_platform_drv_build_components + +build $build_components + +create_boot_directory + +import_from_depot [depot_user]/src/[base_src] \ + [depot_user]/src/init \ + [depot_user]/src/nitpicker \ + [depot_user]/src/vfs_pipe + + +set config { + + + + + + + + + + + + + + + } + +append_platform_drv_config + +append config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } +append config "" +append config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +install_config $config + +puts "--- executing the 'usb_hid_raw' run script to generate the 'usb_hid_raw.iso' image ---" + +global specs +global repositories + +exec -ignorestderr \ + $::argv0 \ + --genode-dir [genode_dir] \ + --name usb_hid_raw \ + --specs "$specs" \ + --board "$board_var" \ + --repositories "$repositories" \ + --cross-dev-prefix "[cross_dev_prefix]" \ + --include boot_dir/nova \ + --include image/iso \ + --include [repository_contains /run/usb_hid_raw.run]/run/usb_hid_raw.run + +exec ln -sf ${genode_dir}/repos/ports/run/vm_genode_usb_hid_raw.vbox bin/ +exec ln -sf ../../usb_hid_raw.iso bin/ + +set boot_modules { + core + init + timer + vesa_fb_drv + ps2_drv + log_terminal + usb_report_filter + fs_rom + vfs vfs.lib.so vfs_import.lib.so + report_rom + virtualbox5-nova + usb_hid_raw.iso + vm_genode_usb_hid_raw.vbox + ld.lib.so libc.lib.so libm.lib.so + libiconv.lib.so stdcxx.lib.so + qemu-usb.lib.so +} + +append boot_modules " [usb_host_drv_binary] " + +append_platform_drv_boot_modules + + +build_boot_image $boot_modules + +if { ![get_cmd_switch --autopilot] } { run_genode_until forever } + +# autopilot test + +run_genode_until {\[init -\> log_terminal\] \[init -\> event_dump\] Input event #0\t} 90 + +# remove everything before the first interesting line +regexp {(\[init -\> log_terminal\] \[init -\> event_dump\] Input event #0\t.*)} $output all output + +run_genode_until {.*\[init -\> event_dump\] Input event #11.*\n} 60 [output_spawn_id] + +unify_output { number [0-9]+} "" +unify_output {(?n)on usb-usbbus.*$} "" +unify_output {(?n)using .*$} "" +unify_output {(?n)^.*__wait_event.*$} "" +unify_output {(?n)^.*Failed to submit URB.*$} "" +unify_output {(?n)^.*dev_warn.*$} "" +unify_output {(?n)^.*dangling allocation.*$} "" +unify_output {(?n)^.*Warning:.*$} "" +unify_output { [0-9][0-9][0-9][0-9]:[0-9][0-9][0-9][0-9] } " " +filter_out_color_escape_sequences +trim_lines + +compare_output_to { +[init -> log_terminal] [init -> event_dump] Input event #0 PRESS KEY_X 65534 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #1 RELEASE KEY_X key count: 0 +[init -> log_terminal] [init -> event_dump] Input event #2 PRESS BTN_LEFT 65534 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #3 REL_MOTION -1+0 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #4 REL_MOTION +0+1 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #5 RELEASE BTN_LEFT key count: 0 +[init -> usb_drv] dev_info: USB disconnect, device +[init -> log_terminal] [init -> usb_drv] dev_info: USB disconnect, device +[init -> usb_drv] dev_info: new full-speed USB device +[init -> virtualbox] Attach USB device (vendor=3eb, product=204d) +[init -> log_terminal] [init -> usb_drv] dev_info: new full-speed USB device +[init -> log_terminal] [init -> usb_hid_drv] dev_info: input: USB HID v1.11 Keyboard [HID 03eb:204d] +[init -> log_terminal] [init -> usb_hid_drv] dev_info: input: USB HID v1.11 Mouse [HID 03eb:204d] +[init -> log_terminal] [init -> event_dump] Input event #6 PRESS KEY_X 65534 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #7 RELEASE KEY_X key count: 0 +[init -> log_terminal] [init -> event_dump] Input event #8 PRESS BTN_LEFT 65534 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #9 REL_MOTION -1+0 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #10 REL_MOTION +0+1 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #11 RELEASE BTN_LEFT key count: 0 +} diff --git a/repos/ports/run/vm_genode_usb_hid_raw.vbox b/repos/ports/run/vm_genode_usb_hid_raw.vbox new file mode 100644 index 0000000000..0ee4948ccc --- /dev/null +++ b/repos/ports/run/vm_genode_usb_hid_raw.vbox @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tool/autopilot.list b/tool/autopilot.list index 06dd086249..b5730113ee 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -69,6 +69,7 @@ tz_vmm usb_hid usb_hid_raw vbox5_genode_usb_hid +vbox5_genode_usb_hid_raw vbox5_ubuntu_16_04_32 vbox5_ubuntu_16_04_64 vbox5_vm_ubuntu_16_04_32