~ehmry/sigil

9801121578e8376a8f5a070cf9a7eceb8dc66da3 — Emery Hemingway 3 years ago 205fadc stdcxx
stdcxx test
M packages/genodelabs/targets.nix => packages/genodelabs/targets.nix +2 -0
@@ 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 ];

M tests/default.nix => tests/default.nix +8 -3
@@ 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;


A tests/stdcxx/config.dhall => tests/stdcxx/config.dhall +104 -0
@@ 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
                        ''
                        <vfs>
                        <dir name="dev"> <log name="stdout" label="stdout"/> <log name="stderr" label="stderr"/> <null/> <rtc/> <zero/> </dir>
                        <dir name="tmp"><ram/></dir>
                        <dir name="nix"><fs label="nix" root="nix"/></dir>
                        </vfs>
                        ''
                    ]
                  , 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
                        ''
                        <libc stdin="/dev/null" stdout="/dev/stdout" stderr="/dev/stderr" pipe="/dev/pipe" rtc="/dev/rtc"/>
                        <vfs> <fs/> </vfs>
                        ''
                    ]
                  }
                , 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 }

A tests/stdcxx/default.nix => tests/stdcxx/default.nix +28 -0
@@ 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 ];
  };
}