diff --git a/repos/ports/run/vbox_auto_genode_usb_hid.run b/repos/ports/run/vbox_auto_genode_usb_hid.run new file mode 100644 index 0000000000..4f9ce74eec --- /dev/null +++ b/repos/ports/run/vbox_auto_genode_usb_hid.run @@ -0,0 +1,278 @@ +# +# This run script tests the VirtualBox USB device pass-through feature +# by running the 'usb_hid' test in a VM. +# +# See 'usb_hid.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] } { + puts "Run script is only supported on NOVA on real hardware" + exit 0 +} + +set build_components { + core init + drivers/framebuffer + drivers/input + drivers/timer + drivers/usb + server/log_terminal + server/fs_rom + server/ram_fs + server/report_rom + app/usb_report_filter + virtualbox +} + +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 + +set config { + + + + + + + + + + + + + + + +} + +append_platform_drv_config + +append config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +install_config $config + +puts "--- executing the 'usb_hid' run script to generate the 'usb_hid.iso' image ---" + +global specs +global repositories + +exec -ignorestderr \ + $::argv0 \ + --genode-dir [genode_dir] \ + --name usb_hid \ + --specs "$specs" \ + --repositories "$repositories" \ + --cross-dev-prefix "[cross_dev_prefix]" \ + --include boot_dir/nova \ + --include image/iso \ + --include [repository_contains /run/usb_hid.run]/run/usb_hid.run + +exec ln -sf ${genode_dir}/repos/ports/run/vm_genode_usb_hid.vbox bin/ +exec ln -sf ../var/run/usb_hid.iso bin/ + +set boot_modules { + core + init + timer + fb_drv + ps2_drv + log_terminal + usb_drv + usb_report_filter + fs_rom + ram_fs + report_rom + virtualbox + usb_hid.iso + vm_genode_usb_hid.vbox + ld.lib.so libc.lib.so libm.lib.so pthread.lib.so libc_pipe.lib.so + libc_terminal.lib.so libiconv.lib.so stdcxx.lib.so + qemu-usb.lib.so +} + +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 -\> test-input\] Input event #1\t} 90 + +# remove everything before the first interesting line +regexp {(\[init -\> log_terminal\] \[init -\> test-input\] Input event #1\t.*)} $output all output + +run_genode_until {.*\[init -\> test-input\] Input event #12.*\n} 60 [output_spawn_id] + +unify_output { number [0-9]+} "" +unify_output {(?n)on usb-dummy.*$} "" +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 { [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 -> test-input] Input event #1 type=PRESS code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=1 KEY_X +[init -> log_terminal] [init -> test-input] Input event #2 type=RELEASE code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 KEY_X +[init -> log_terminal] [init -> test-input] Input event #3 type=PRESS code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=1 BTN_LEFT +[init -> log_terminal] [init -> test-input] Input event #4 type=MOTION code=0 rx=-1 ry=0 ax=0 ay=0 key_cnt=1 +[init -> log_terminal] [init -> test-input] Input event #5 type=MOTION code=0 rx=0 ry=1 ax=0 ay=0 key_cnt=1 +[init -> log_terminal] [init -> test-input] Input event #6 type=RELEASE code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 BTN_LEFT +[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_drv] dev_info: D L +[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Keyboard [D L] +[init -> log_terminal] [init -> usb_drv] dev_info: D L +[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Mouse [D L] +[init -> log_terminal] [init -> test-input] Input event #7 type=PRESS code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=1 KEY_X +[init -> log_terminal] [init -> test-input] Input event #8 type=RELEASE code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 KEY_X +[init -> log_terminal] [init -> test-input] Input event #9 type=PRESS code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=1 BTN_LEFT +[init -> log_terminal] [init -> test-input] Input event #10 type=MOTION code=0 rx=-1 ry=0 ax=0 ay=0 key_cnt=1 +[init -> log_terminal] [init -> test-input] Input event #11 type=MOTION code=0 rx=0 ry=1 ax=0 ay=0 key_cnt=1 +[init -> log_terminal] [init -> test-input] Input event #12 type=RELEASE code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 BTN_LEFT +} diff --git a/repos/ports/run/vm_genode_usb_hid.vbox b/repos/ports/run/vm_genode_usb_hid.vbox new file mode 100644 index 0000000000..0315420b55 --- /dev/null +++ b/repos/ports/run/vm_genode_usb_hid.vbox @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +