From 975b550432106d4ddee42fe0f29032e69454d569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Mon, 24 Jun 2024 13:00:08 +0200 Subject: [PATCH] ports: add vbox6 USB HID raw test This commit replaces the current vbox5 based USB HID raw test, which runs a Genode guest to test USB passthrough with a USB human interface device, with one using vbox6. Fixes #5330. --- repos/ports/run/vbox6_genode_usb_hid_raw.run | 263 ++++++++++++++++++ repos/ports/run/vbox6_genode_usb_hid_raw.vbox | 70 +++++ tool/autopilot.list | 2 +- 3 files changed, 334 insertions(+), 1 deletion(-) create mode 100644 repos/ports/run/vbox6_genode_usb_hid_raw.run create mode 100644 repos/ports/run/vbox6_genode_usb_hid_raw.vbox diff --git a/repos/ports/run/vbox6_genode_usb_hid_raw.run b/repos/ports/run/vbox6_genode_usb_hid_raw.run new file mode 100644 index 0000000000..a91223290b --- /dev/null +++ b/repos/ports/run/vbox6_genode_usb_hid_raw.run @@ -0,0 +1,263 @@ +# +# 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 +} + +create_boot_directory +import_from_depot [depot_user]/src/[base_src] \ + [depot_user]/src/acpi \ + [depot_user]/src/black_hole \ + [depot_user]/src/expat \ + [depot_user]/src/fs_rom \ + [depot_user]/src/init \ + [depot_user]/src/jpeg \ + [depot_user]/src/libc \ + [depot_user]/src/libdrm \ + [depot_user]/src/libiconv \ + [depot_user]/src/libyuv \ + [depot_user]/src/log_terminal \ + [depot_user]/src/mesa \ + [depot_user]/src/nitpicker \ + [depot_user]/src/pc_usb_host \ + [depot_user]/src/pci_decode \ + [depot_user]/src/platform \ + [depot_user]/src/posix \ + [depot_user]/src/ps2 \ + [depot_user]/src/report_rom \ + [depot_user]/src/stdcxx \ + [depot_user]/src/vbox6 \ + [depot_user]/src/vesa_fb \ + [depot_user]/src/vfs \ + [depot_user]/src/vfs_gpu \ + [depot_user]/src/vfs_import \ + [depot_user]/src/vfs_pipe \ + [depot_user]/src/zlib + +install_config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2022-08-10 00:01 + + + + + + + + + + + + + + + + + + + + + +} + +puts "--- executing the 'usb_hid_raw' run script to generate the 'usb_hid_raw.iso' image ---" + +global specs +global repositories + +set depot_auto_update "" +if {[get_cmd_switch --depot-auto-update]} { + set depot_auto_update "--depot-auto-update" +} + +exec -ignorestderr \ + $::argv0 \ + --genode-dir [genode_dir] \ + --name usb_hid_raw \ + --specs "$specs" \ + --board "$board_var" \ + --repositories "$repositories" \ + --depot-dir [depot_dir] \ + --depot-user [depot_user] \ + $depot_auto_update \ + --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/vbox6_genode_usb_hid_raw.vbox bin/ +exec ln -sf ../../usb_hid_raw.iso bin/ + +set boot_components [build_artifacts] + +append boot_components { usb_hid_raw.iso vbox6_genode_usb_hid_raw.vbox } + +build_boot_image $boot_components + +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] + +# pay only attention to the output of init and its children +grep_output {^\[init } + +unify_output {(?n)^\[init -\> log_terminal\] \[init -\> usb_hid\] usb usb-[0-9]-[0-9]: input irq status -19 received} "" +unify_output {(?n) on usb-usbbus.*$} "" +unify_output {(?n) at usb-usbbus.*\)} ")" +unify_output {(?n)hid-generic.*input:} "hid-generic: input:" +unify_output {(?n)usb-[0-9]-[0-9]: USB disconnect, device number [0-9]} "usb-X-X: USB disconnect, device number X" +unify_output {(?n)device number [0-9]+} "device number X" +unify_output {(?n)input[0-9]} "inputX" +unify_output {(?n) as /devices/.*} "" +unify_output {(?n)^\[init -\> usb.*} "" +unify_output {(?n)^\[init -\> log_terminal\] \[init -\> usb.*} "" +unify_output {(?n)^.*dangling allocation.*$} "" +unify_output {(?n)^.*usbfs: process .* did not claim interface.*$} "" +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 REL_MOTION -1+1 key count: 0 +[init -> log_terminal] [init -> event_dump] Input event #3 PRESS BTN_LEFT 65534 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #4 RELEASE BTN_LEFT key count: 0 +[init -> log_terminal] [init -> event_dump] Input event #5 PRESS KEY_X 65534 key count: 1 +[init -> log_terminal] [init -> event_dump] Input event #6 RELEASE KEY_X key count: 0 +[init -> log_terminal] [init -> event_dump] Input event #7 REL_MOTION -1+1 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 RELEASE BTN_LEFT key count: 0 +} diff --git a/repos/ports/run/vbox6_genode_usb_hid_raw.vbox b/repos/ports/run/vbox6_genode_usb_hid_raw.vbox new file mode 100644 index 0000000000..6f575ac33b --- /dev/null +++ b/repos/ports/run/vbox6_genode_usb_hid_raw.vbox @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tool/autopilot.list b/tool/autopilot.list index 406e3471d1..a5da125d99 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -86,7 +86,6 @@ tz_vmm usb_block usb_hid_raw usb_hid_reconnect -vbox5_genode_usb_hid_raw vbox5_ubuntu_16_04_32 vbox5_ubuntu_16_04_64 vbox5_win10_64 @@ -95,6 +94,7 @@ vbox5_win7_64 vbox5_win7_64_multiple vbox5_win7_64_raw vbox5_win7_64_share +vbox6_genode_usb_hid_raw verify vfs_cfg vfs_import