From 5b0e8a39563e54b763d510f533afcbfb53033a2e Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Mon, 2 Nov 2020 16:01:40 +0100 Subject: [PATCH] WiP! rom-names patch --- nixos-modules/genode-init.nix | 16 +- nixos-modules/store-wrapper.dhall | 3 +- packages/genodelabs/default.nix | 2 +- .../{rom-names.patch => init.patch} | 218 +++++++++++-- packages/genodelabs/sandbox.patch | 228 ------------- packages/genodelabs/targets.nix | 18 +- tests/hello.dhall | 51 --- tests/hello.nix | 53 ++- tests/log.dhall | 15 - tests/log.nix | 17 +- tests/solo5/blk.dhall | 54 ---- tests/solo5/multi.nix | 25 +- tests/solo5/net.dhall | 73 ----- tests/solo5/net_2if.dhall | 86 ----- tests/solo5/solo5.dhall | 304 ++++++++++++++++-- tests/solo5/time.dhall | 15 - tests/test-wrapper.dhall | 168 ---------- tests/x86.dhall | 143 ++++---- tests/x86.nix | 14 +- 19 files changed, 652 insertions(+), 851 deletions(-) rename packages/genodelabs/{rom-names.patch => init.patch} (69%) delete mode 100644 packages/genodelabs/sandbox.patch delete mode 100644 tests/hello.dhall delete mode 100644 tests/log.dhall delete mode 100644 tests/solo5/blk.dhall delete mode 100644 tests/solo5/net.dhall delete mode 100644 tests/solo5/net_2if.dhall delete mode 100644 tests/solo5/time.dhall delete mode 100644 tests/test-wrapper.dhall diff --git a/nixos-modules/genode-init.nix b/nixos-modules/genode-init.nix index c6c97a0..502152a 100644 --- a/nixos-modules/genode-init.nix +++ b/nixos-modules/genode-init.nix @@ -6,6 +6,7 @@ let inputs = mkOption { description = "List of packages to build a ROM store with."; type = types.listOf types.package; + default = [ ]; }; in { @@ -89,19 +90,20 @@ in { let baseConfig = ${config.genode.init.baseConfig} in baseConfig with children = baseConfig.children # toMap {${ - concatMapStrings (name: - ", `${name}` = (${ + concatMapStrings (name: '' + , `${name}` = (${ config.genode.init.children.${name}.configFile - } : Genode.Init.Child.Type)") - (builtins.attrNames config.genode.init.children) + } : Genode.Init.Child.Type) + '') (builtins.attrNames config.genode.init.children) } ${ concatMapStrings (name: '' , `${name}` = - Genode.Init.toChild + Genode.Init.toChild ( (${ config.genode.init.subinits.${name}.configFile - } : Genode.Init.Type) - Genode.Init.Attributes.default + } with reportRomBinary = "${pkgs.genodePackages.report_rom}/bin/report_rom") + : Genode.Init.Type) + Genode.Init.Attributes::{ binary = "${pkgs.genodePackages.init}/bin/init" } '') (builtins.attrNames config.genode.init.subinits) } } ''; diff --git a/nixos-modules/store-wrapper.dhall b/nixos-modules/store-wrapper.dhall index 1922540..c60206e 100644 --- a/nixos-modules/store-wrapper.dhall +++ b/nixos-modules/store-wrapper.dhall @@ -1,5 +1,4 @@ -let Genode = - env:DHALL_GENODE sha256:e90438be23b5100003cf018b783986df67bc6d0e3d35e800677d0d9109ff6aa9 +let Genode = env:DHALL_GENODE let Prelude = Genode.Prelude diff --git a/packages/genodelabs/default.nix b/packages/genodelabs/default.nix index ccbb664..0118ec5 100644 --- a/packages/genodelabs/default.nix +++ b/packages/genodelabs/default.nix @@ -30,7 +30,7 @@ let version = upstreamSources.lastModifiedDate; src = upstreamSources; nativeBuildInputs = [ expect gnumake tcl ]; - patches = [ ./binary-labels.patch ./rom-names.patch ]; + patches = [ ./binary-labels.patch ./init.patch ]; configurePhase = '' patchShebangs ./tool substituteInPlace repos/base/etc/tools.conf \ diff --git a/packages/genodelabs/rom-names.patch b/packages/genodelabs/init.patch similarity index 69% rename from packages/genodelabs/rom-names.patch rename to packages/genodelabs/init.patch index 474d35a..e2d3f7d 100644 --- a/packages/genodelabs/rom-names.patch +++ b/packages/genodelabs/init.patch @@ -1,15 +1,3 @@ -commit adba5891acc724320c61743a6ec8694d2dc92d99 -Author: Emery Hemingway -Date: Sun Nov 1 23:14:11 2020 +0100 - - Pass explicit ROM name in session requests - - When name of a ROM in a session request is passed only as the last - element of the request label then it can be destroyed if the label - exceedes the size of the Genode::Session_label string type. This can - happen if the initial ROM name is too large or after a sufficient number - of prefixes are prepended to the label. - diff --git a/repos/base-linux/src/core/spec/linux/dataspace_component.cc b/repos/base-linux/src/core/spec/linux/dataspace_component.cc index ad5c5c2929..45ce45333c 100644 --- a/repos/base-linux/src/core/spec/linux/dataspace_component.cc @@ -199,7 +187,7 @@ index 544b0730c9..d614fddce1 100644 }; diff --git a/repos/os/src/lib/sandbox/child.cc b/repos/os/src/lib/sandbox/child.cc -index e321df61fd..cd7a971abb 100644 +index e321df61fd..a2a538a002 100644 --- a/repos/os/src/lib/sandbox/child.cc +++ b/repos/os/src/lib/sandbox/child.cc @@ -11,6 +11,7 @@ @@ -210,11 +198,19 @@ index e321df61fd..cd7a971abb 100644 #include /* local includes */ -@@ -463,23 +464,6 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, - */ +@@ -448,6 +449,8 @@ Sandbox::Child::Route + Sandbox::Child::resolve_session_request(Service::Name const &service_name, + Session_label const &label) + { ++ auto no_filter = [] (Service &) -> bool { return false; }; ++ + /* check for "config" ROM request */ + if (service_name == Rom_session::service_name() && + label.last_element() == "config") { +@@ -464,21 +467,19 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, } -- /* + /* - * Check for the binary's ROM request - * - * The binary is requested as a ROM with the child's unique @@ -222,7 +218,8 @@ index e321df61fd..cd7a971abb 100644 - * If the binary name differs from the child's unique name, - * we resolve the session request with the binary name as label. - * Otherwise the regular routing is applied. -- */ ++ * Check for the "ld.lib.so" ROM request + */ - if (service_name == Rom_session::service_name() && - label == _unique_name && _unique_name != _binary_name) - return resolve_session_request(service_name, _binary_name); @@ -230,11 +227,53 @@ index e321df61fd..cd7a971abb 100644 - /* supply binary as dynamic linker if '' */ - if (!_use_ld && service_name == Rom_session::service_name() && label == "ld.lib.so") - return resolve_session_request(service_name, _binary_name); -- ++ if (service_name == Rom_session::service_name() && label == "ld.lib.so") { ++ if (_use_ld) { ++ /* forward request to parent */ ++ return Route { ++ find_service(_parent_services, Rom_session::service_name(), no_filter), ++ Session_label("ld.lib.so"), Session::Diag { false} }; ++ } else { ++ /* supply binary as dynamic linker if '' */ ++ return resolve_session_request(service_name, _binary_name); ++ } ++ } + /* check for "session_requests" ROM request */ if (service_name == Rom_session::service_name() - && label.last_element() == Session_requester::rom_name()) -@@ -641,6 +625,31 @@ void Sandbox::Child::filter_session_args(Service::Name const &service, +@@ -488,16 +489,21 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, + + try { + Xml_node route_node = _default_route_accessor.default_route(); ++ route_node = _routes_accessor.routes(route_node); + try { + route_node = _start_node->xml().sub_node("route"); } + catch (...) { } ++ + Xml_node service_node = route_node.sub_node(); + ++ /* is processed with the "«child» -> " prefix */ ++ bool skip_prefix = route_node.type() != "routes"; ++ + for (; ; service_node = service_node.next()) { + + bool service_wildcard = service_node.has_type("any-service"); + +- if (!service_node_matches(service_node, label, name(), service_name)) ++ if (!service_node_matches(service_node, label, name(), service_name, skip_prefix)) + continue; + + Xml_node target = service_node.sub_node(); +@@ -519,8 +525,6 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, + Session::Diag const + target_diag { target.attribute_value("diag", false) }; + +- auto no_filter = [] (Service &) -> bool { return false; }; +- + if (target.has_type("parent")) { + + try { +@@ -641,6 +645,26 @@ void Sandbox::Child::filter_session_args(Service::Name const &service, Arg_string::remove_arg(args, "managing_system"); } } @@ -252,20 +291,145 @@ index e321df61fd..cd7a971abb 100644 + * Otherwise the regular routing is applied. + */ + if (rom_name == _unique_name && _unique_name != _binary_name) -+ Arg_string::set_arg(args, args_len, "name", _binary_name.string()); ++ Arg_string::set_arg_string(args, args_len, "name", _binary_name.string()); + + /* supply binary as dynamic linker if '' */ + else if (!_use_ld && rom_name == "ld.lib.so") -+ Arg_string::set_arg(args, args_len, "name", _binary_name.string()); -+ -+ /* set the ROM name before something breaks */ -+ else if (rom_name == "") -+ Arg_string::set_arg(args, args_len, "name", -+ rom_name_from_args(args).last_element().string()); ++ Arg_string::set_arg_string(args, args_len, "name", _binary_name.string()); + } } +@@ -705,6 +729,7 @@ Sandbox::Child::Child(Env &env, + Report_update_trigger &report_update_trigger, + Xml_node start_node, + Default_route_accessor &default_route_accessor, ++ Routes_accessor &routes_accessor, + Default_caps_accessor &default_caps_accessor, + Name_registry &name_registry, + Ram_quota ram_limit, +@@ -722,6 +747,7 @@ Sandbox::Child::Child(Env &env, + _list_element(this), + _start_node(_alloc, start_node), + _default_route_accessor(default_route_accessor), ++ _routes_accessor(routes_accessor), + _default_caps_accessor(default_caps_accessor), + _ram_limit_accessor(ram_limit_accessor), + _cap_limit_accessor(cap_limit_accessor), +diff --git a/repos/os/src/lib/sandbox/child.h b/repos/os/src/lib/sandbox/child.h +index ae5f981435..f7b41ddd5b 100644 +--- a/repos/os/src/lib/sandbox/child.h ++++ b/repos/os/src/lib/sandbox/child.h +@@ -52,6 +52,14 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup + struct Default_route_accessor : Interface { virtual Xml_node default_route() = 0; }; + struct Default_caps_accessor : Interface { virtual Cap_quota default_caps() = 0; }; + ++ struct Routes_accessor : Interface ++ { ++ virtual Xml_node routes(Xml_node _default) ++ { ++ return _default; ++ } ++ }; ++ + template + struct Resource_limit_accessor : Interface + { +@@ -98,6 +106,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup + bool const _use_ld = _start_node->xml().attribute_value("ld", true); + + Default_route_accessor &_default_route_accessor; ++ Routes_accessor &_routes_accessor; + Default_caps_accessor &_default_caps_accessor; + Ram_limit_accessor &_ram_limit_accessor; + Cap_limit_accessor &_cap_limit_accessor; +@@ -472,6 +481,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup + Report_update_trigger &report_update_trigger, + Xml_node start_node, + Default_route_accessor &default_route_accessor, ++ Routes_accessor &route_accessor, + Default_caps_accessor &default_caps_accessor, + Name_registry &name_registry, + Ram_quota ram_limit, +diff --git a/repos/os/src/lib/sandbox/library.cc b/repos/os/src/lib/sandbox/library.cc +index 28b60c491f..30d0f2dfc1 100644 +--- a/repos/os/src/lib/sandbox/library.cc ++++ b/repos/os/src/lib/sandbox/library.cc +@@ -23,6 +23,7 @@ + + struct Genode::Sandbox::Library : ::Sandbox::State_reporter::Producer, + ::Sandbox::Child::Default_route_accessor, ++ ::Sandbox::Child::Routes_accessor, + ::Sandbox::Child::Default_caps_accessor, + ::Sandbox::Child::Ram_limit_accessor, + ::Sandbox::Child::Cap_limit_accessor +@@ -52,6 +53,8 @@ struct Genode::Sandbox::Library : ::Sandbox::State_reporter::Producer, + + Constructible _default_route { }; + ++ Constructible _routes { }; ++ + Cap_quota _default_caps { 0 }; + + unsigned _child_cnt = 0; +@@ -140,6 +143,12 @@ struct Genode::Sandbox::Library : ::Sandbox::State_reporter::Producer, + : Xml_node(""); + } + ++ /** ++ * Routes_accessor interface ++ */ ++ Xml_node routes(Xml_node _default) override { ++ return _routes.constructed() ? _routes->xml() : _default; } ++ + /** + * Default_caps_accessor interface + */ +@@ -314,6 +323,9 @@ void Genode::Sandbox::Library::apply_config(Xml_node const &config) + _default_route.construct(_heap, config.sub_node("default-route")); } + catch (...) { } + ++ try { _routes.construct(_heap, config.sub_node("routes")); } ++ catch (...) { } ++ + _default_caps = Cap_quota { 0 }; + try { + _default_caps = Cap_quota { config.sub_node("default") +@@ -404,7 +416,7 @@ void Genode::Sandbox::Library::apply_config(Xml_node const &config) + Child &child = *new (_heap) + Child(_env, _heap, *_verbose, + Child::Id { ++_child_cnt }, _state_reporter, +- start_node, *this, *this, _children, ++ start_node, *this, *this, *this, _children, + Ram_quota { avail_ram.value - used_ram.value }, + Cap_quota { avail_caps.value - used_caps.value }, + *this, *this, prio_levels, affinity_space, +diff --git a/repos/os/src/lib/sandbox/utils.h b/repos/os/src/lib/sandbox/utils.h +index 7afcaebf00..36aab737f2 100644 +--- a/repos/os/src/lib/sandbox/utils.h ++++ b/repos/os/src/lib/sandbox/utils.h +@@ -59,7 +59,8 @@ namespace Sandbox { + inline bool service_node_matches(Xml_node const service_node, + Session_label const &label, + Child_policy::Name const &child_name, +- Service::Name const &service_name) ++ Service::Name const &service_name, ++ bool skip_child_prefix = true) + { + bool const service_matches = + service_node.has_type("any-service") || +@@ -98,8 +99,9 @@ namespace Sandbox { + if (!route_depends_on_child_provided_label) + return true; + +- char const * const scoped_label = skip_label_prefix( +- child_name.string(), label.string()); ++ char const * const scoped_label = skip_child_prefix ++ ? skip_label_prefix(child_name.string(), label.string()) ++ : label.string(); + + if (!scoped_label) + return false; diff --git a/repos/os/src/server/cached_fs_rom/main.cc b/repos/os/src/server/cached_fs_rom/main.cc index 9e4e4d0eee..8dfcb58d1e 100755 --- a/repos/os/src/server/cached_fs_rom/main.cc diff --git a/packages/genodelabs/sandbox.patch b/packages/genodelabs/sandbox.patch deleted file mode 100644 index 050dd42..0000000 --- a/packages/genodelabs/sandbox.patch +++ /dev/null @@ -1,228 +0,0 @@ -commit 20abcefd185d72ecc55e87ff78f8f784d927653d -Author: Emery Hemingway -Date: Sat Apr 25 16:08:45 2020 +0530 - - Init/sandbox: always route "ld.lib.so" ROM to parent - - A livelock may occur if init router the "ld.lib.so" ROM request of a - child to another child, and the child providing the ROM interacts with - Init during the creation of the session. - -diff --git a/repos/os/src/lib/sandbox/child.cc b/repos/os/src/lib/sandbox/child.cc -index 5361665eac..fa09cca31a 100644 ---- a/repos/os/src/lib/sandbox/child.cc -+++ b/repos/os/src/lib/sandbox/child.cc -@@ -448,6 +448,8 @@ Sandbox::Child::Route - Sandbox::Child::resolve_session_request(Service::Name const &service_name, - Session_label const &label) - { -+ auto no_filter = [] (Service &) -> bool { return false; }; -+ - /* check for "config" ROM request */ - if (service_name == Rom_session::service_name() && - label.last_element() == "config") { -@@ -498,9 +500,20 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, - label == _unique_name && _unique_name != _binary_name) - return resolve_session_request(service_name, _binary_name); - -- /* supply binary as dynamic linker if '' */ -- if (!_use_ld && service_name == Rom_session::service_name() && label == "ld.lib.so") -- return resolve_session_request(service_name, _binary_name); -+ /* -+ * Check for the "ld.lib.so" ROM request -+ */ -+ if (service_name == Rom_session::service_name() && label == "ld.lib.so") { -+ if (_use_ld) { -+ /* forward request to parent */ -+ return Route { -+ find_service(_parent_services, Rom_session::service_name(), no_filter), -+ Session_label("ld.lib.so"), Session::Diag { false} }; -+ } else { -+ /* supply binary as dynamic linker if '' */ -+ return resolve_session_request(service_name, _binary_name); -+ } -+ } - - /* check for "session_requests" ROM request */ - if (service_name == Rom_session::service_name() -@@ -541,8 +554,6 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, - Session::Diag const - target_diag { target.attribute_value("diag", false) }; - -- auto no_filter = [] (Service &) -> bool { return false; }; -- - if (target.has_type("parent")) { - - try { -commit ce74d9bb7740f14b362e72adcf8ac42e36693468 -Author: Emery Hemingway -Date: Sat Apr 25 17:10:03 2020 +0530 - - init/sandbox: support - - Apply routing rules to a child from a node at the top-level of - a sandbox config, unless the corresponding start node has as - node. If neither are present routes are taken from as a - fallback. - - Unlike the and the rules are checked by - labels prefixed by child name, so may contain child-specific - rules. - -diff --git a/repos/os/src/lib/sandbox/child.cc b/repos/os/src/lib/sandbox/child.cc -index fa09cca31a..85389474ef 100644 ---- a/repos/os/src/lib/sandbox/child.cc -+++ b/repos/os/src/lib/sandbox/child.cc -@@ -523,16 +523,21 @@ Sandbox::Child::resolve_session_request(Service::Name const &service_name, - - try { - Xml_node route_node = _default_route_accessor.default_route(); -+ route_node = _routes_accessor.routes(route_node); - try { - route_node = _start_node->xml().sub_node("route"); } - catch (...) { } -+ - Xml_node service_node = route_node.sub_node(); - -+ /* is processed with the "«child» -> " prefix */ -+ bool skip_prefix = route_node.type() != "routes"; -+ - for (; ; service_node = service_node.next()) { - - bool service_wildcard = service_node.has_type("any-service"); - -- if (!service_node_matches(service_node, label, name(), service_name)) -+ if (!service_node_matches(service_node, label, name(), service_name, skip_prefix)) - continue; - - Xml_node target = service_node.sub_node(); -@@ -736,6 +741,7 @@ Sandbox::Child::Child(Env &env, - Report_update_trigger &report_update_trigger, - Xml_node start_node, - Default_route_accessor &default_route_accessor, -+ Routes_accessor &routes_accessor, - Default_caps_accessor &default_caps_accessor, - Name_registry &name_registry, - Ram_quota ram_limit, -@@ -753,6 +759,7 @@ Sandbox::Child::Child(Env &env, - _list_element(this), - _start_node(_alloc, start_node), - _default_route_accessor(default_route_accessor), -+ _routes_accessor(routes_accessor), - _default_caps_accessor(default_caps_accessor), - _ram_limit_accessor(ram_limit_accessor), - _cap_limit_accessor(cap_limit_accessor), -diff --git a/repos/os/src/lib/sandbox/child.h b/repos/os/src/lib/sandbox/child.h -index 4dd2803417..8e84e9bf75 100644 ---- a/repos/os/src/lib/sandbox/child.h -+++ b/repos/os/src/lib/sandbox/child.h -@@ -52,6 +52,14 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup - struct Default_route_accessor : Interface { virtual Xml_node default_route() = 0; }; - struct Default_caps_accessor : Interface { virtual Cap_quota default_caps() = 0; }; - -+ struct Routes_accessor : Interface -+ { -+ virtual Xml_node routes(Xml_node _default) -+ { -+ return _default; -+ } -+ }; -+ - template - struct Resource_limit_accessor : Interface - { -@@ -98,6 +106,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup - bool const _use_ld = _start_node->xml().attribute_value("ld", true); - - Default_route_accessor &_default_route_accessor; -+ Routes_accessor &_routes_accessor; - Default_caps_accessor &_default_caps_accessor; - Ram_limit_accessor &_ram_limit_accessor; - Cap_limit_accessor &_cap_limit_accessor; -@@ -475,6 +484,7 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup - Report_update_trigger &report_update_trigger, - Xml_node start_node, - Default_route_accessor &default_route_accessor, -+ Routes_accessor &route_accessor, - Default_caps_accessor &default_caps_accessor, - Name_registry &name_registry, - Ram_quota ram_limit, -diff --git a/repos/os/src/lib/sandbox/library.cc b/repos/os/src/lib/sandbox/library.cc -index 28b60c491f..30d0f2dfc1 100644 ---- a/repos/os/src/lib/sandbox/library.cc -+++ b/repos/os/src/lib/sandbox/library.cc -@@ -23,6 +23,7 @@ - - struct Genode::Sandbox::Library : ::Sandbox::State_reporter::Producer, - ::Sandbox::Child::Default_route_accessor, -+ ::Sandbox::Child::Routes_accessor, - ::Sandbox::Child::Default_caps_accessor, - ::Sandbox::Child::Ram_limit_accessor, - ::Sandbox::Child::Cap_limit_accessor -@@ -52,6 +53,8 @@ struct Genode::Sandbox::Library : ::Sandbox::State_reporter::Producer, - - Constructible _default_route { }; - -+ Constructible _routes { }; -+ - Cap_quota _default_caps { 0 }; - - unsigned _child_cnt = 0; -@@ -140,6 +143,12 @@ struct Genode::Sandbox::Library : ::Sandbox::State_reporter::Producer, - : Xml_node(""); - } - -+ /** -+ * Routes_accessor interface -+ */ -+ Xml_node routes(Xml_node _default) override { -+ return _routes.constructed() ? _routes->xml() : _default; } -+ - /** - * Default_caps_accessor interface - */ -@@ -314,6 +323,9 @@ void Genode::Sandbox::Library::apply_config(Xml_node const &config) - _default_route.construct(_heap, config.sub_node("default-route")); } - catch (...) { } - -+ try { _routes.construct(_heap, config.sub_node("routes")); } -+ catch (...) { } -+ - _default_caps = Cap_quota { 0 }; - try { - _default_caps = Cap_quota { config.sub_node("default") -@@ -404,7 +416,7 @@ void Genode::Sandbox::Library::apply_config(Xml_node const &config) - Child &child = *new (_heap) - Child(_env, _heap, *_verbose, - Child::Id { ++_child_cnt }, _state_reporter, -- start_node, *this, *this, _children, -+ start_node, *this, *this, *this, _children, - Ram_quota { avail_ram.value - used_ram.value }, - Cap_quota { avail_caps.value - used_caps.value }, - *this, *this, prio_levels, affinity_space, -diff --git a/repos/os/src/lib/sandbox/utils.h b/repos/os/src/lib/sandbox/utils.h -index 7afcaebf00..36aab737f2 100644 ---- a/repos/os/src/lib/sandbox/utils.h -+++ b/repos/os/src/lib/sandbox/utils.h -@@ -59,7 +59,8 @@ namespace Sandbox { - inline bool service_node_matches(Xml_node const service_node, - Session_label const &label, - Child_policy::Name const &child_name, -- Service::Name const &service_name) -+ Service::Name const &service_name, -+ bool skip_child_prefix = true) - { - bool const service_matches = - service_node.has_type("any-service") || -@@ -98,8 +99,9 @@ namespace Sandbox { - if (!route_depends_on_child_provided_label) - return true; - -- char const * const scoped_label = skip_label_prefix( -- child_name.string(), label.string()); -+ char const * const scoped_label = skip_child_prefix -+ ? skip_label_prefix(child_name.string(), label.string()) -+ : label.string(); - - if (!scoped_label) - return false; diff --git a/packages/genodelabs/targets.nix b/packages/genodelabs/targets.nix index 10bb479..2350524 100644 --- a/packages/genodelabs/targets.nix +++ b/packages/genodelabs/targets.nix @@ -29,7 +29,7 @@ in { gpt_write.portInputs = [ jitterentropy ]; - init.patches = [ ./sandbox.patch ]; + init = { }; event_filter.patches = [ ./event_filter.patch ]; @@ -76,15 +76,11 @@ in { stdcxx.portInputs = [ libc stdcxx ]; - # The following are tests are patched to exit at completion - - "test-log".patches = [ ./test-log.patch ]; - - "test-pci".patches = [ ./test-pci.patch ]; - - "test-signal".patches = [ ./test-signal.patch ]; - - "test-vmm_x86".patches = [ ./test-vmm_x86.patch ]; + test-log.patches = [ ./test-log.patch ]; + test-pci.patches = [ ./test-pci.patch ]; + test-rtc = { }; + test-signal.patches = [ ./test-signal.patch ]; + test-vmm_x86.patches = [ ./test-vmm_x86.patch ]; usb_drv.portInputs = [ dde_linux ]; @@ -95,7 +91,7 @@ in { vesa_drv.portInputs = [ libc x86emu ]; vfs.outputs = [ "out" "lib" ]; - vfs_audit = {}; + vfs_audit = { }; vfs_block = { }; vfs_import.patches = [ ./vfs_import.patch ]; vfs_jitterentropy.portInputs = [ jitterentropy libc ]; diff --git a/tests/hello.dhall b/tests/hello.dhall deleted file mode 100644 index 34a6ad6..0000000 --- a/tests/hello.dhall +++ /dev/null @@ -1,51 +0,0 @@ -let Genode = - env:DHALL_GENODE - ? https://git.sr.ht/~ehmry/dhall-genode/blob/master/package.dhall - -let Init = Genode.Init - -let Child = Init.Child - -in Child.flat - Child.Attributes::{ - , binary = "hello" - , exitPropagate = True - , resources = Genode.Init.Resources::{ - , caps = 500 - , ram = Genode.units.MiB 10 - } - , config = Init.Config::{ - , content = - let XML = Genode.Prelude.XML - - in [ XML.leaf - { name = "libc" - , attributes = toMap - { stdin = "/dev/null" - , stdout = "/dev/log" - , stderr = "/dev/log" - } - } - , XML.element - { name = "vfs" - , attributes = XML.emptyAttributes - , content = - let dir = - λ(name : Text) → - λ(content : List XML.Type) → - XML.element - { name = "dir" - , content - , attributes = toMap { name } - } - - let leaf = - λ(name : Text) → - XML.leaf - { name, attributes = XML.emptyAttributes } - - in [ dir "dev" [ leaf "log", leaf "null" ] ] - } - ] - } - } diff --git a/tests/hello.nix b/tests/hello.nix index 5293880..8390f85 100644 --- a/tests/hello.nix +++ b/tests/hello.nix @@ -17,8 +17,57 @@ }; in { genode.init.children.hello = { - configFile = ./hello.dhall; - inputs = [ hello ]; + configFile = pkgs.writeText "hello.dhall" '' + let Genode = env:DHALL_GENODE + + let Init = Genode.Init + + let Child = Init.Child + + in Child.flat + Child.Attributes::{ + , binary = "${hello}/bin/hello" + , exitPropagate = True + , resources = Genode.Init.Resources::{ + , caps = 500 + , ram = Genode.units.MiB 10 + } + , config = Init.Config::{ + , content = + let XML = Genode.Prelude.XML + + in [ XML.leaf + { name = "libc" + , attributes = toMap + { stdin = "/dev/null" + , stdout = "/dev/log" + , stderr = "/dev/log" + } + } + , XML.element + { name = "vfs" + , attributes = XML.emptyAttributes + , content = + let dir = + λ(name : Text) → + λ(content : List XML.Type) → + XML.element + { name = "dir" + , content + , attributes = toMap { name } + } + + let leaf = + λ(name : Text) → + XML.leaf + { name, attributes = XML.emptyAttributes } + + in [ dir "dev" [ leaf "log", leaf "null" ] ] + } + ] + } + } + ''; }; }; testScript = '' diff --git a/tests/log.dhall b/tests/log.dhall deleted file mode 100644 index 26c2989..0000000 --- a/tests/log.dhall +++ /dev/null @@ -1,15 +0,0 @@ -let Genode = - env:DHALL_GENODE - ? https://git.sr.ht/~ehmry/dhall-genode/blob/master/package.dhall - -let Child = Genode.Init.Child - -in Child.flat - Child.Attributes::{ - , binary = "test-log" - , exitPropagate = True - , resources = Genode.Init.Resources::{ - , caps = 500 - , ram = Genode.units.MiB 10 - } - } diff --git a/tests/log.nix b/tests/log.nix index 932a344..96311b4 100644 --- a/tests/log.nix +++ b/tests/log.nix @@ -2,8 +2,21 @@ name = "log"; machine = { pkgs, ... }: { genode.init.children.log = { - configFile = ./log.dhall; - inputs = [ pkgs.genodePackages.test-log ]; + configFile = pkgs.writeText "log.dhall" '' + let Genode = env:DHALL_GENODE + + let Child = Genode.Init.Child + + in Child.flat + Child.Attributes::{ + , binary = "${pkgs.genodePackages.test-log}/bin/test-log" + , exitPropagate = True + , resources = Genode.Init.Resources::{ + , caps = 500 + , ram = Genode.units.MiB 10 + } + } + ''; }; }; testScript = '' diff --git a/tests/solo5/blk.dhall b/tests/solo5/blk.dhall deleted file mode 100644 index 485339a..0000000 --- a/tests/solo5/blk.dhall +++ /dev/null @@ -1,54 +0,0 @@ -let Genode = env:DHALL_GENODE - -let Init = Genode.Init - -let Child = Init.Child - -let init = - Init::{ - , children = toMap - { solo5 = - Child.flat - Child.Attributes::{ - , binary = "solo5-test_blk" - , exitPropagate = True - , resources = Init.Resources::{ - , caps = 256 - , ram = Genode.units.MiB 3 - } - , routes = [ Init.ServiceRoute.parent "Timer" ] - } - , block = - Child.flat - Child.Attributes::{ - , binary = "vfs_block" - , provides = [ "Block" ] - , resources = Init.Resources::{ ram = Genode.units.MiB 12 } - , config = Init.Config::{ - , content = - [ Genode.Prelude.XML.text - '' - - - - - - - '' - ] - , policies = - [ Init.Config.Policy::{ - , service = "Block" - , attributes = toMap - { file = "block.raw", writeable = "yes" } - , label = - Init.LabelSelector.Type.Partial - { prefix = Some "solo5", suffix = None Text } - } - ] - } - } - } - } - -in Init.toChild init Init.Attributes.default diff --git a/tests/solo5/multi.nix b/tests/solo5/multi.nix index f4c4220..8e727b9 100644 --- a/tests/solo5/multi.nix +++ b/tests/solo5/multi.nix @@ -1,20 +1,19 @@ { name = "solo5-multi"; machine = { pkgs, ... }: { - genode.init.children.tests = { - configFile = "${./.}/solo5.dhall { isAarch64 = ${ + genode.init.children.tests = with pkgs.genodePackages; { + configFile = '' + ${./.}/solo5.dhall { isAarch64 = ${ if pkgs.stdenv.hostPlatform.isAarch64 then "True" else "False" - } }"; - inputs = with pkgs.genodePackages; [ - solo5 - solo5.tests - nic_bridge - nic_loopback - sequence - vfs_block - vfs_import - (genodeSources.make "app/ping") - ]; + } + , nic_bridge = "${nic_bridge}" + , nic_loopback = "${nic_loopback}" + , ping = "${genodeSources.make "app/ping"}" + , sequence = "${sequence}" + , solo5Tests = "${solo5.tests}" + , vfs_block = "${vfs_block}" + } + ''; }; }; testScript = '' diff --git a/tests/solo5/net.dhall b/tests/solo5/net.dhall deleted file mode 100644 index 3fc89a4..0000000 --- a/tests/solo5/net.dhall +++ /dev/null @@ -1,73 +0,0 @@ -let Genode = env:DHALL_GENODE - -let Init = Genode.Init - -let Child = Init.Child - -let Res = Init.Resources - -let ServiceRoute = Init.ServiceRoute - -let init = - Init::{ - , routes = - [ Genode.Init.ServiceRoute.parent "Timer" - , Genode.Init.ServiceRoute.child "Nic" "bridge" - ] - , children = toMap - { nic = - Child.flat - Child.Attributes::{ - , binary = "nic_loopback" - , provides = [ "Nic" ] - } - , bridge = - Child.flat - Child.Attributes::{ - , binary = "nic_bridge" - , resources = Res::{ caps = 200, ram = Genode.units.MiB 6 } - , provides = [ "Nic" ] - , routes = [ ServiceRoute.child "Nic" "nic" ] - , config = Init.Config::{ - , attributes = toMap { mac = "02:02:02:02:03:00" } - , policies = - [ Init.Config.Policy::{ - , service = "Nic" - , attributes = toMap { ip_addr = "10.0.0.2" } - , label = - Init.LabelSelector.Type.Partial - { prefix = Some "solo5", suffix = None Text } - } - ] - , defaultPolicy = Some Init.Config.DefaultPolicy::{=} - } - } - , solo5 = - Child.flat - Child.Attributes::{ - , binary = "solo5-test_net" - , resources = Res::{ caps = 256, ram = Genode.units.MiB 3 } - , config = Init.Config::{ - , content = - [ Genode.Prelude.XML.text "limit" ] - } - } - , ping = - Child.flat - Child.Attributes::{ - , binary = "ping" - , exitPropagate = True - , resources = Res::{ caps = 128, ram = Genode.units.MiB 6 } - , config = Init.Config::{ - , attributes = toMap - { interface = "10.0.0.72/24" - , dst_ip = "10.0.0.2" - , period_sec = "1" - , verbose = "no" - } - } - } - } - } - -in Init.toChild init Init.Attributes.default diff --git a/tests/solo5/net_2if.dhall b/tests/solo5/net_2if.dhall deleted file mode 100644 index ff5f713..0000000 --- a/tests/solo5/net_2if.dhall +++ /dev/null @@ -1,86 +0,0 @@ -let Genode = env:DHALL_GENODE - -let Init = Genode.Init - -let Child = Init.Child - -let Res = Init.Resources - -let init = - Init::{ - , routes = - [ Genode.Init.ServiceRoute.parent "Timer" - , Genode.Init.ServiceRoute.child "Nic" "bridge" - ] - , children = toMap - { nic = - Child.flat - Child.Attributes::{ - , binary = "nic_loopback" - , provides = [ "Nic" ] - } - , bridge = - Child.flat - Child.Attributes::{ - , binary = "nic_bridge" - , resources = Res::{ caps = 200, ram = Genode.units.MiB 8 } - , provides = [ "Nic" ] - , routes = [ Genode.Init.ServiceRoute.child "Nic" "nic" ] - , config = Init.Config::{ - , defaultPolicy = Some Init.Config.DefaultPolicy::{=} - , policies = - [ Init.Config.Policy::{ - , service = "Nic" - , attributes = toMap { ip_addr = "10.0.0.2" } - , label = - Init.LabelSelector.Type.Scoped "solo5 -> service0" - } - , Init.Config.Policy::{ - , service = "Nic" - , attributes = toMap { ip_addr = "10.1.0.2" } - , label = - Init.LabelSelector.Type.Scoped "solo5 -> service1" - } - ] - } - } - , solo5 = - Child.flat - Child.Attributes::{ - , binary = "solo5-test_net_2if" - , resources = Res::{ caps = 256, ram = Genode.units.MiB 5 } - , config = Init.Config::{ - , content = - [ Genode.Prelude.XML.text - '' - "limit" - '' - ] - } - } - , clients = - Child.flat - Child.Attributes::{ - , binary = "sequence" - , exitPropagate = True - , resources = Res::{ caps = 256, ram = Genode.units.MiB 8 } - , config = Init.Config::{ - , content = - [ Genode.Prelude.XML.text - '' - - - - - - - - - '' - ] - } - } - } - } - -in Init.toChild init Init.Attributes.default diff --git a/tests/solo5/solo5.dhall b/tests/solo5/solo5.dhall index a90ca21..7224b4a 100644 --- a/tests/solo5/solo5.dhall +++ b/tests/solo5/solo5.dhall @@ -8,33 +8,289 @@ let Child = Init.Child let Config = Init.Config -let toSimple = - λ(testName : Text) → - Child.flat - Child.Attributes::{ - , binary = "solo5-test_${testName}" - , resources = Init.Resources::{ caps = 256, ram = Genode.units.MiB 3 } - , config = Config::{ - , content = - [ Prelude.XML.element - { name = "cmdline" - , attributes = Prelude.XML.emptyAttributes - , content = [ Prelude.XML.text "Hello_Solo5" ] - } - ] - } - } +let ServiceRoute = Init.ServiceRoute + +in λ ( params + : { isAarch64 : Bool + , nic_bridge : Text + , nic_loopback : Text + , ping : Text + , sequence : Text + , solo5Tests : Text + , vfs_block : Text + } + ) → + let toSimple = + λ(testName : Text) → + Child.flat + Child.Attributes::{ + , binary = "${params.solo5Tests}/bin/solo5-test_${testName}" + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 3 + } + , config = Config::{ + , content = + [ Prelude.XML.element + { name = "cmdline" + , attributes = Prelude.XML.emptyAttributes + , content = [ Prelude.XML.text "Hello_Solo5" ] + } + ] + } + } -in λ(params : { isAarch64 : Bool }) → let children = toMap { quiet = toSimple "quiet" , hello = toSimple "hello" , globals = toSimple "globals" - , time = ./time.dhall - , blk = ./blk.dhall - , net = ./net.dhall - , net_2if = ./net_2if.dhall + , time = + Child.flat + Child.Attributes::{ + , binary = "${params.solo5Tests}/bin/solo5-test_time" + , exitPropagate = True + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 3 + } + } + , blk = + let init = + Init::{ + , children = toMap + { solo5 = + Child.flat + Child.Attributes::{ + , binary = + "${params.solo5Tests}/bin/solo5-test_blk" + , exitPropagate = True + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 3 + } + , routes = [ ServiceRoute.parent "Timer" ] + } + , block = + Child.flat + Child.Attributes::{ + , binary = + "${params.vfs_block}/bin/vfs_block" + , provides = [ "Block" ] + , resources = Init.Resources::{ + , ram = Genode.units.MiB 12 + } + , config = Init.Config::{ + , content = + [ Genode.Prelude.XML.text + '' + + + + + + + '' + ] + , policies = + [ Init.Config.Policy::{ + , service = "Block" + , attributes = toMap + { file = "block.raw" + , writeable = "yes" + } + , label = + Init.LabelSelector.Type.Partial + { prefix = Some "solo5" + , suffix = None Text + } + } + ] + } + } + } + } + + in Init.toChild init Init.Attributes.default + , net = + let init = + Init::{ + , routes = + [ ServiceRoute.parent "Timer" + , ServiceRoute.child "Nic" "bridge" + ] + , children = toMap + { nic = + Child.flat + Child.Attributes::{ + , binary = + "${params.nic_loopback}/bin/nic_loopback" + , provides = [ "Nic" ] + } + , bridge = + Child.flat + Child.Attributes::{ + , binary = + "${params.nic_bridge}/bin/nic_bridge" + , resources = Init.Resources::{ + , caps = 200 + , ram = Genode.units.MiB 6 + } + , provides = [ "Nic" ] + , routes = + [ ServiceRoute.child "Nic" "nic" ] + , config = Init.Config::{ + , attributes = toMap + { mac = "02:02:02:02:03:00" } + , policies = + [ Init.Config.Policy::{ + , service = "Nic" + , attributes = toMap + { ip_addr = "10.0.0.2" } + , label = + Init.LabelSelector.Type.Partial + { prefix = Some "solo5" + , suffix = None Text + } + } + ] + , defaultPolicy = Some Init.Config.DefaultPolicy::{=} + } + } + , solo5 = + Child.flat + Child.Attributes::{ + , binary = + "${params.solo5Tests}/bin/solo5-test_net" + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 3 + } + , config = Init.Config::{ + , content = + [ Genode.Prelude.XML.text + "limit" + ] + } + } + , ping = + Child.flat + Child.Attributes::{ + , binary = "${params.ping}/bin/ping" + , exitPropagate = True + , resources = Init.Resources::{ + , caps = 128 + , ram = Genode.units.MiB 6 + } + , config = Init.Config::{ + , attributes = toMap + { interface = "10.0.0.72/24" + , dst_ip = "10.0.0.2" + , period_sec = "1" + , verbose = "no" + } + } + } + } + } + + in Init.toChild init Init.Attributes.default + , net_2if = + let init = + Init::{ + , routes = + [ ServiceRoute.parent "Timer" + , ServiceRoute.child "Nic" "bridge" + ] + , children = toMap + { nic = + Child.flat + Child.Attributes::{ + , binary = + "${params.nic_loopback}/bin/nic_loopback" + , provides = [ "Nic" ] + } + , bridge = + Child.flat + Child.Attributes::{ + , binary = + "${params.nic_bridge}/bin/nic_bridge" + , resources = Init.Resources::{ + , caps = 200 + , ram = Genode.units.MiB 8 + } + , provides = [ "Nic" ] + , routes = + [ ServiceRoute.child "Nic" "nic" ] + , config = Init.Config::{ + , defaultPolicy = Some Init.Config.DefaultPolicy::{=} + , policies = + [ Init.Config.Policy::{ + , service = "Nic" + , attributes = toMap + { ip_addr = "10.0.0.2" } + , label = + Init.LabelSelector.Type.Scoped + "solo5 -> service0" + } + , Init.Config.Policy::{ + , service = "Nic" + , attributes = toMap + { ip_addr = "10.1.0.2" } + , label = + Init.LabelSelector.Type.Scoped + "solo5 -> service1" + } + ] + } + } + , solo5 = + Child.flat + Child.Attributes::{ + , binary = + "${params.solo5Tests}/bin/solo5-test_net_2if" + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 5 + } + , config = Init.Config::{ + , content = + [ Genode.Prelude.XML.text + '' + "limit" + '' + ] + } + } + , clients = + Child.flat + Child.Attributes::{ + , binary = "${params.sequence}/bin/sequence" + , exitPropagate = True + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 8 + } + , config = Init.Config::{ + , content = + [ Genode.Prelude.XML.text + '' + + + + + + + + + '' + ] + } + } + } + } + + in Init.toChild init Init.Attributes.default } # ( if params.isAarch64 then Prelude.Map.empty Text Child.Type @@ -44,9 +300,7 @@ in λ(params : { isAarch64 : Bool }) → in Init.Child.nested children Init.Child.Attributes::{ - , binary = "sequence" + , binary = "${params.sequence}/bin/sequence" , routes = - [ Init.ServiceRoute.parent "Timer" - , Init.ServiceRoute.parent "Rtc" - ] + [ ServiceRoute.parent "Timer", ServiceRoute.parent "Rtc" ] } diff --git a/tests/solo5/time.dhall b/tests/solo5/time.dhall deleted file mode 100644 index dd7e21e..0000000 --- a/tests/solo5/time.dhall +++ /dev/null @@ -1,15 +0,0 @@ -let Genode = env:DHALL_GENODE - -let Init = Genode.Init - -let Child = Init.Child - -let solo5 = - Child.flat - Child.Attributes::{ - , binary = "solo5-test_time" - , exitPropagate = True - , resources = Init.Resources::{ caps = 256, ram = Genode.units.MiB 3 } - } - -in solo5 diff --git a/tests/test-wrapper.dhall b/tests/test-wrapper.dhall deleted file mode 100644 index f464f8c..0000000 --- a/tests/test-wrapper.dhall +++ /dev/null @@ -1,168 +0,0 @@ -let Test = ./test.dhall ? env:DHALL_GENODE_TEST - -let Genode = Test.Genode - -let Prelude = Genode.Prelude - -let XML = Prelude.XML - -let Init = Genode.Init - -let Child = Init.Child - -let TextMapType = Prelude.Map.Type Text - -let Children = TextMapType Child.Type - -let Manifest/Type = TextMapType (TextMapType Text) - -let Manifest/toRoutes = - λ(manifest : Manifest/Type) → - Prelude.List.map - (Prelude.Map.Entry Text Text) - Init.ServiceRoute.Type - ( λ(entry : Prelude.Map.Entry Text Text) → - { service = - { name = "ROM" - , label = Init.LabelSelector.Type.Last entry.mapKey - } - , route = - Init.Route.Type.Child - { name = "store_rom" - , label = Some entry.mapValue - , diag = None Bool - } - } - ) - ( Prelude.List.concat - (Prelude.Map.Entry Text Text) - (Prelude.Map.values Text (Prelude.Map.Type Text Text) manifest) - ) - -let parentROMs = - Prelude.List.map - Text - Init.ServiceRoute.Type - ( λ(label : Text) → - { service = - { name = "ROM", label = Init.LabelSelector.Type.Last label } - , route = - Init.Route.Type.Parent { label = Some label, diag = None Bool } - } - ) - -let wrapHarness - : Children → Manifest/Type → Child.Type - = λ(children : Children) → - λ(manifest : Manifest/Type) → - Child.nested - children - Child.Attributes::{ - , binary = "sotest-harness" - , exitPropagate = True - , resources = Init.Resources::{ ram = Genode.units.MiB 4 } - , routes = - [ Init.ServiceRoute.parentLabel - "LOG" - (Some "SOTEST") - (Some "unlabeled") - , Init.ServiceRoute.parent "IO_MEM" - , Init.ServiceRoute.parent "IO_PORT" - , Init.ServiceRoute.parent "IRQ" - , Init.ServiceRoute.parent "VM" - , Init.ServiceRoute.child "Timer" "timer" - , Init.ServiceRoute.child "Rtc" "rtc" - , Init.ServiceRoute.child "File_system" "store_fs" - ] - # parentROMs - [ "ld.lib.so" - , "init" - , "platform_info" - , "core_log" - , "kernel_log" - , "vfs" - , "libvfs.so" - , "cached_fs_rom" - ] - # Manifest/toRoutes manifest - } - -in λ(test : Test.Type) → - λ(storeSize : Natural) → - λ(storeManifest : Manifest/Type) → - λ(bootManifest : Manifest/Type) → - Genode.Boot::{ - , config = Init::{ - , children = - [ { mapKey = "timer" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "timer_drv" - , provides = [ "Timer" ] - } - } - , { mapKey = "rtc" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "rtc_drv" - , provides = [ "Rtc" ] - , routes = [ Init.ServiceRoute.parent "IO_PORT" ] - } - } - , { mapKey = "store_fs" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "vfs" - , config = Init.Config::{ - , content = - [ XML.element - { name = "vfs" - , attributes = XML.emptyAttributes - , content = - [ XML.leaf - { name = "tar" - , attributes = toMap { name = "store.tar" } - } - ] - } - ] - , defaultPolicy = Some Init.Config.DefaultPolicy::{ - , attributes = toMap { root = "/", writeable = "no" } - } - } - , provides = [ "File_system" ] - } - } - , { mapKey = "store_rom" - , mapValue = - Child.flat - Child.Attributes::{ - , binary = "cached_fs_rom" - , provides = [ "ROM" ] - , resources = Init.Resources::{ - , ram = storeSize + Genode.units.MiB 1 - } - , routes = - [ Init.ServiceRoute.child "File_system" "store_fs" ] - } - } - , { mapKey = "harness" - , mapValue = wrapHarness test.children storeManifest - } - ] - } - , rom = - test.rom - # Genode.BootModules.toRomPaths - ( Prelude.List.concat - (Prelude.Map.Entry Text Text) - ( Prelude.Map.values - Text - (Prelude.Map.Type Text Text) - bootManifest - ) - ) - } diff --git a/tests/x86.dhall b/tests/x86.dhall index 868bee4..fbb63ae 100644 --- a/tests/x86.dhall +++ b/tests/x86.dhall @@ -13,76 +13,85 @@ let ServiceRoute = Init.ServiceRoute let label = λ(_ : Text) → { local = _, route = _ } : Child.Attributes.Label let pciInit = - Init::{ - , verbose = True - , routes = [ ServiceRoute.parent "Timer", ServiceRoute.parent "Rtc" ] - , children = toMap - { signal = - Child.flat - Child.Attributes::{ - , binary = "test-signal" - , exitPropagate = True - , priority = 5 - , resources = Init.Resources::{ - , caps = 500 - , ram = Genode.units.MiB 10 + λ ( binaries + : { acpi_drv : Text + , platform_drv : Text + , test-pci : Text + , test-rtc : Text + , test-signal : Text + } + ) → + Init::{ + , verbose = True + , routes = [ ServiceRoute.parent "Timer", ServiceRoute.parent "Rtc" ] + , children = toMap + { signal = + Child.flat + Child.Attributes::{ + , binary = binaries.test-signal + , exitPropagate = True + , priority = 5 + , resources = Init.Resources::{ + , caps = 500 + , ram = Genode.units.MiB 10 + } } - } - , rtc = Child.flat Child.Attributes::{ binary = "test-rtc" } - , test-pci = - Child.flat - Child.Attributes::{ - , binary = "test-pci" - , resources = Resources::{ ram = Genode.units.MiB 3 } - } - , acpi_drv = - Child.flat - Child.Attributes::{ - , binary = "acpi_drv" - , resources = Resources::{ - , caps = 400 - , ram = Genode.units.MiB 4 - , constrainPhys = True + , test-rtc = + Child.flat Child.Attributes::{ binary = binaries.test-rtc } + , test-pci = + Child.flat + Child.Attributes::{ + , binary = binaries.test-pci + , resources = Resources::{ ram = Genode.units.MiB 3 } } - , romReports = [ label "acpi", label "smbios_table" ] - , routes = - [ ServiceRoute.parent "IRQ" - , ServiceRoute.parent "IO_MEM" - , ServiceRoute.parent "IO_PORT" - ] - } - , platform_drv = - Child.flat - Child.Attributes::{ - , binary = "platform_drv" - , resources = Resources::{ - , caps = 800 - , ram = Genode.units.MiB 4 - , constrainPhys = True - } - , reportRoms = [ label "acpi" ] - , provides = [ "Platform" ] - , routes = - [ ServiceRoute.parent "IRQ" - , ServiceRoute.parent "IO_MEM" - , ServiceRoute.parent "IO_PORT" - ] - , config = Init.Config::{ - , policies = - [ Init.Config.Policy::{ - , service = "Platform" - , label = Init.LabelSelector.prefix "test-pci" - , content = - [ XML.leaf - { name = "pci" - , attributes = toMap { class = "ALL" } - } - ] - } + , acpi_drv = + Child.flat + Child.Attributes::{ + , binary = binaries.acpi_drv + , resources = Resources::{ + , caps = 400 + , ram = Genode.units.MiB 4 + , constrainPhys = True + } + , romReports = [ label "acpi", label "smbios_table" ] + , routes = + [ ServiceRoute.parent "IRQ" + , ServiceRoute.parent "IO_MEM" + , ServiceRoute.parent "IO_PORT" ] } - } - } - } + , platform_drv = + Child.flat + Child.Attributes::{ + , binary = binaries.platform_drv + , resources = Resources::{ + , caps = 800 + , ram = Genode.units.MiB 4 + , constrainPhys = True + } + , reportRoms = [ label "acpi" ] + , provides = [ "Platform" ] + , routes = + [ ServiceRoute.parent "IRQ" + , ServiceRoute.parent "IO_MEM" + , ServiceRoute.parent "IO_PORT" + ] + , config = Init.Config::{ + , policies = + [ Init.Config.Policy::{ + , service = "Platform" + , label = Init.LabelSelector.prefix "test-pci" + , content = + [ XML.leaf + { name = "pci" + , attributes = toMap { class = "ALL" } + } + ] + } + ] + } + } + } + } in pciInit diff --git a/tests/x86.nix b/tests/x86.nix index b51a431..6652fc3 100644 --- a/tests/x86.nix +++ b/tests/x86.nix @@ -3,10 +3,16 @@ constraints = builtins.any (spec: spec == "x86"); machine = { pkgs, ... }: { genode.init.subinits.test = { - configFile = ./x86.dhall; - inputs = with pkgs.genodePackages; - [ acpi_drv platform_drv report_rom test-signal ] - ++ (map genodeSources.make [ "test/pci" "test/rtc" ]); + configFile = with pkgs.genodePackages; + pkgs.writeText "x86.dhall" '' + ${./x86.dhall} + { acpi_drv = "${acpi_drv}/bin/acpi_drv" + , platform_drv = "${platform_drv}/bin/platform_drv" + , test-pci = "${genodeSources.make "test/pci"}/bin/test-pci" + , test-rtc = "${test-rtc}/bin/test-rtc" + , test-signal = "${test-signal}/bin/test-signal" + } + ''; }; }; testScript = ''