diff --git a/repos/ports/run/lighttpd_fetchurl.run b/repos/ports/run/lighttpd_fetchurl.run new file mode 100644 index 0000000000..8066319a48 --- /dev/null +++ b/repos/ports/run/lighttpd_fetchurl.run @@ -0,0 +1,184 @@ +# +# \brief Download data via fetchurl from lighttpd over a virtual network +# \author Norman Feske +# \date 2022-12-03 +# + +if {[have_board virt_qemu_riscv]} { + puts "Run script is not supported on this platform (missing curl and libssh)." + exit 0 +} + +proc ip_stack { } { return lwip } +proc download_size { } { return "1M" } +proc audit { } { return 1 } + +build "lib/vfs_[ip_stack] lib/libc app/fetchurl lib/curl" + +create_boot_directory + +import_from_depot [depot_user]/src/[base_src] \ + [depot_user]/src/init \ + [depot_user]/src/nic_router \ + [depot_user]/src/report_rom \ + [depot_user]/src/libc \ + [depot_user]/src/libssh \ + [depot_user]/src/lighttpd \ + [depot_user]/src/fetchurl \ + [depot_user]/src/curl \ + [depot_user]/src/openssl \ + [depot_user]/src/posix \ + [depot_user]/src/vfs \ + [depot_user]/src/vfs_[ip_stack] \ + [depot_user]/src/vfs_audit \ + [depot_user]/src/zlib + +proc lighttpd_config { } { + return { + server.port = 80 + server.document-root = "/website" + server.event-handler = "select" + server.network-backend = "write" + server.upload-dirs = ( "/tmp" ) + } +} + +proc socket_fs_plugin { } { return "<[ip_stack] dhcp=\"yes\"/>" } + +proc socket_path { } { if {[audit]} { return "/audit" } else { return "/socket" } } + +install_config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2000-01-01 00:00 + 0123456789012345678901234567890123456789 + + } [socket_fs_plugin] { + + + + } [lighttpd_config] { + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2000-01-01 00:00 + 01234567890123456789 + + } [socket_fs_plugin] { + + + + + + + +} + +build_boot_image [build_artifacts] + +append qemu_args " -nographic " + +run_genode_until {.*server started.*} 10 + +set download_start_time [clock milliseconds] + +run_genode_until {.*"fetchurl" exited with exit value 0.*\n.*} 60 [output_spawn_id] + +set download_end_time [clock milliseconds] + +set download_duration_ms [expr ($download_end_time - $download_start_time)] + +puts "\ntransferred [download_size] in $download_duration_ms ms" + +if {[audit]} { + + # count switches between fetchurl and lighttpd based on the output of 'audit' + set previous_label "" + set audit_messages 0 + set context_switches 0 + foreach line [split [strip_whitespace $output] "\n"] { + if {[regexp -- {(\[.*-> audit\]).*} $line match label]} { + incr audit_messages + if {$label != $previous_label} { + incr context_switches + set previous_label $label + } + } + } + + puts "\n$audit_messages audit messages" + puts "\n$context_switches context switches between fetchurl and lighttpd" +} diff --git a/tool/autopilot.list b/tool/autopilot.list index 559e9d6954..565b93c1e6 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -23,6 +23,7 @@ intel_fb libc_integration libc_vfs_fs_ext2 libc_vfs_fs_fat +lighttpd_fetchurl log_core lwip lx_fs_import