From 9801121578e8376a8f5a070cf9a7eceb8dc66da3 Mon Sep 17 00:00:00 2001 From: Emery Hemingway Date: Fri, 18 Sep 2020 00:58:11 +0200 Subject: [PATCH] stdcxx test --- packages/genodelabs/targets.nix | 2 + tests/default.nix | 11 +++- tests/stdcxx/config.dhall | 104 ++++++++++++++++++++++++++++++++ tests/stdcxx/default.nix | 28 +++++++++ 4 files changed, 142 insertions(+), 3 deletions(-) create mode 100644 tests/stdcxx/config.dhall create mode 100644 tests/stdcxx/default.nix diff --git a/packages/genodelabs/targets.nix b/packages/genodelabs/targets.nix index af0c69c..02b3482 100644 --- a/packages/genodelabs/targets.nix +++ b/packages/genodelabs/targets.nix @@ -66,6 +66,8 @@ in { "test-signal".patches = [ ./test-signal.patch ]; + "test-stdcxx".portInputs = [ libc stdcxx ]; + "test-vmm_x86".patches = [ ./test-vmm_x86.patch ]; usb_drv.portInputs = [ dde_linux ]; diff --git a/tests/default.nix b/tests/default.nix index 1a49ee8..658f288 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -8,9 +8,14 @@ let inherit nixpkgs localPackages legacyPackages; }; - testFiles = - map callTest [ ./log.nix ./posix.nix ./vmm_arm.nix ./vmm_x86.nix ./x86.nix ] - ++ (callTest ./solo5); + testFiles = map callTest [ + ./log.nix + ./posix.nix + ./stdcxx + ./vmm_arm.nix + ./vmm_x86.nix + ./x86.nix + ] ++ (callTest ./solo5); testPkgs = genodepkgs; diff --git a/tests/stdcxx/config.dhall b/tests/stdcxx/config.dhall new file mode 100644 index 0000000..d81f0f9 --- /dev/null +++ b/tests/stdcxx/config.dhall @@ -0,0 +1,104 @@ +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 init = + Init::{ + , verbose = True + , routes = + [ Init.ServiceRoute.parent "Timer", Init.ServiceRoute.parent "Rtc" ] + , children = toMap + { vfs = + Child.flat + Child.Attributes::{ + , binary = "vfs" + , config = Init.Config::{ + , content = + [ Prelude.XML.text + '' + + + + + + '' + ] + , defaultPolicy = Some Init.Config.DefaultPolicy::{ + , attributes = toMap { root = "/", writeable = "yes" } + } + } + , provides = [ "File_system" ] + , resources = Genode.Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 8 + } + , routes = + Prelude.List.map + Text + Init.ServiceRoute.Type + Init.ServiceRoute.parent + [ "File_system", "Rtc" ] + } + , store_rom = + Child.flat + Child.Attributes::{ + , binary = "cached_fs_rom" + , provides = [ "ROM" ] + , resources = Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 4 + } + , routes = + [ Init.ServiceRoute.parentLabel + "File_system" + (None Text) + (Some "nix") + ] + } + , cxx = + Child.flat + Child.Attributes::{ + , binary = "test-stdcxx" + , config = Genode.Init.Config::{ + , content = + [ Prelude.XML.text + '' + + + '' + ] + } + , exitPropagate = True + , resources = Genode.Init.Resources::{ + , caps = 256 + , ram = Genode.units.MiB 8 + } + , routes = + [ Init.ServiceRoute.child "File_system" "vfs" + , { service = + { name = "ROM" + , label = + Init.LabelSelector.Type.Partial + { prefix = Some "/nix/store/", suffix = None Text } + } + , route = + Init.Route.Type.Child + { name = "store_rom" + , label = None Text + , diag = None Bool + } + } + ] + } + } + } + +in Test::{ children = Test.initToChildren init } diff --git a/tests/stdcxx/default.nix b/tests/stdcxx/default.nix new file mode 100644 index 0000000..d4b2bb9 --- /dev/null +++ b/tests/stdcxx/default.nix @@ -0,0 +1,28 @@ +{ pkgs, legacyPackages, ... }: +with pkgs; + +let + testStdcxx = pkgs.stdenv.mkDerivation { + name = "test-stdcxx"; + inherit (pkgs.genodeSources) version; + src = pkgs.genodeSources; + buildPhase = '' + mkdir -p $out + $CXX -o $out/test-stdcxx \ + repos/libports/src/test/stdcxx/main.cc + ''; + }; +in { + name = "stdcxx"; + machine = { + config = ./config.dhall; + inputs = map pkgs.genodeSources.depot [ + "libc" + "posix" + "vfs" + "stdcxx" + "test-stdcxx" + ]; + # ++ [ testStdcxx ]; + }; +} -- 2.45.2