diff --git a/repos/os/run/fs_packet.run b/repos/os/run/fs_packet.run new file mode 100644 index 0000000000..96b9f3a496 --- /dev/null +++ b/repos/os/run/fs_packet.run @@ -0,0 +1,90 @@ +# +# Build +# +set build_components { + app/sequence + lib/vfs/jitterentropy + server/vfs + test/fs_packet +} + +build $build_components + +create_boot_directory + +import_from_depot \ + genodelabs/src/[base_src] \ + genodelabs/src/init \ + +# +# Generate config +# +append config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +} + +install_config $config + +# +# Boot modules +# +set boot_modules { + sequence + test-fs_packet + vfs + vfs.lib.so + vfs_jitterentropy.lib.so +} + +build_boot_image $boot_modules + +append qemu_args " -nographic" + +run_genode_until {child "short-test" exited with exit value 0} 60 diff --git a/repos/os/src/test/fs_packet/component.cc b/repos/os/src/test/fs_packet/component.cc new file mode 100644 index 0000000000..255e318b9a --- /dev/null +++ b/repos/os/src/test/fs_packet/component.cc @@ -0,0 +1,87 @@ +/* + * \brief File_system packet processing test + * \author Emery Hemingway + * \date 2018-07-03 + */ + +/* + * Copyright (C) 2018 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU Affero General Public License version 3. + */ + + +#include +#include +#include +#include +#include +#include + +namespace Fs_packet { + using namespace Genode; + using namespace File_system; + struct Main; +}; + +struct Fs_packet::Main +{ + Genode::Env &env; + + Attached_rom_dataspace config_rom { env, "config" }; + + Heap heap { env.pd(), env.rm() }; + Allocator_avl avl_alloc { &heap }; + File_system::Connection fs { env, avl_alloc, "", "/", false, 4<<10 }; + File_system::Session::Tx::Source &pkt_tx { *fs.tx() }; + + Dir_handle dir_handle { fs.dir("/", false) }; + File_handle file_handle { fs.file(dir_handle, "test", READ_ONLY, false) }; + + Signal_handler
ack_handler { env.ep(), *this, &Main::handle_ack }; + + int pkt_count = config_rom.xml().attribute_value("count", 1U << 10); + + void handle_ack() + { + while (pkt_tx.ack_avail()) { + auto pkt = pkt_tx.get_acked_packet(); + --pkt_count; + if (pkt_count < 0) { + log("--- test complete ---"); + env.parent().exit(0); + sleep_forever(); + } + + if (!(pkt_count % 10)) + Genode::log(pkt_count, " packets remain"); + + pkt_tx.submit_packet(pkt); + } + } + + Main(Genode::Env &env) : env(env) + { + fs.sigh_ack_avail(ack_handler); + + /********************** + ** Stuff the buffer ** + **********************/ + + size_t const pkt_size = + pkt_tx.bulk_buffer_size() / File_system::Session::TX_QUEUE_SIZE; + for (size_t i = 0; i < pkt_tx.bulk_buffer_size(); i += pkt_size) { + File_system::Packet_descriptor pkt( + pkt_tx.alloc_packet(pkt_size), file_handle, + File_system::Packet_descriptor::READ, pkt_size, 0); + pkt_tx.submit_packet(pkt); + } + } +}; + +void Component::construct(Genode::Env &env) +{ + static Fs_packet::Main test(env); + Genode::log("--- submiting ", test.pkt_count, " packets ---"); +} diff --git a/repos/os/src/test/fs_packet/target.mk b/repos/os/src/test/fs_packet/target.mk new file mode 100644 index 0000000000..c16cdb4d0f --- /dev/null +++ b/repos/os/src/test/fs_packet/target.mk @@ -0,0 +1,5 @@ +TARGET = test-fs_packet +LIBS = base +SRC_CC = component.cc + +CC_CXX_WARN_STRICT = diff --git a/tool/autopilot.list b/tool/autopilot.list index bf1e0dc2d9..c951647f0c 100644 --- a/tool/autopilot.list +++ b/tool/autopilot.list @@ -16,6 +16,7 @@ fb_bench fetchurl fpu fs_log +fs_packet fs_report gdb_monitor init