tests: convert posix test to nixos-modules
parent
5b715b2d7d
commit
8c2fbe6dc5
|
@ -10,6 +10,7 @@ let
|
|||
testSpecs = map (p: import p) [
|
||||
./hello.nix
|
||||
./log.nix
|
||||
./posix.nix
|
||||
./solo5/multi.nix
|
||||
./vmm_x86.nix
|
||||
./x86.nix
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
let Test = ./test.dhall ? env:DHALL_GENODE_TEST
|
||||
|
||||
let Genode = Test.Genode
|
||||
let Genode = env:DHALL_GENODE
|
||||
|
||||
let Prelude = Genode.Prelude
|
||||
|
||||
|
@ -31,19 +29,22 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) →
|
|||
<dir name="dev"> <log name="stdout" label="stdout"/> <log name="stderr" label="stderr"/> <null/> <pipe/> <rtc/> <zero/> </dir>
|
||||
<dir name="usr"><dir name="bin"><symlink name="env" target="${params.coreutils}/bin/env"/></dir></dir>
|
||||
<dir name="tmp"><ram/></dir>
|
||||
<dir name="nix"><fs label="nix" root="nix"/></dir>
|
||||
<dir name="nix"><dir name="store"><fs label="nix-store"/></dir></dir>
|
||||
</vfs>
|
||||
''
|
||||
]
|
||||
, policies =
|
||||
[ Init.Config.Policy::{
|
||||
, service = "File_system"
|
||||
, label =
|
||||
Init.LabelSelector.Type.Partial
|
||||
{ prefix = Some "shell", suffix = None Text }
|
||||
, label = Init.LabelSelector.prefix "shell"
|
||||
, attributes = toMap
|
||||
{ root = "/", writeable = "yes" }
|
||||
}
|
||||
, Init.Config.Policy::{
|
||||
, service = "File_system"
|
||||
, label = Init.LabelSelector.prefix "vfs_rom"
|
||||
, attributes = toMap { root = "/" }
|
||||
}
|
||||
]
|
||||
}
|
||||
, provides = [ "File_system" ]
|
||||
|
@ -58,7 +59,7 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) →
|
|||
Init.ServiceRoute.parent
|
||||
[ "File_system", "Rtc" ]
|
||||
}
|
||||
, store_rom =
|
||||
, vfs_rom =
|
||||
Child.flat
|
||||
Child.Attributes::{
|
||||
, binary = "cached_fs_rom"
|
||||
|
@ -67,12 +68,6 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) →
|
|||
, caps = 256
|
||||
, ram = Genode.units.MiB 4
|
||||
}
|
||||
, routes =
|
||||
[ Init.ServiceRoute.parentLabel
|
||||
"File_system"
|
||||
(None Text)
|
||||
(Some "nix")
|
||||
]
|
||||
}
|
||||
, shell =
|
||||
Child.flat
|
||||
|
@ -113,7 +108,7 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) →
|
|||
}
|
||||
, route =
|
||||
Init.Route.Type.Child
|
||||
{ name = "store_rom"
|
||||
{ name = "vfs_rom"
|
||||
, label = None Text
|
||||
, diag = None Bool
|
||||
}
|
||||
|
@ -123,4 +118,4 @@ in λ(params : { bash : Text, coreutils : Text, script : Text }) →
|
|||
}
|
||||
}
|
||||
|
||||
in Test::{ children = Test.initToChildren init }
|
||||
in Init.toChild init Init.Attributes::{=}
|
||||
|
|
|
@ -1,33 +1,30 @@
|
|||
{ pkgs, legacyPackages, ... }:
|
||||
with pkgs;
|
||||
|
||||
let
|
||||
inherit (legacyPackages) bash coreutils;
|
||||
script = with legacyPackages;
|
||||
writeTextFile {
|
||||
name = "posix.sh";
|
||||
text = ''
|
||||
export PATH=${
|
||||
lib.makeSearchPathOutput "bin" "bin"
|
||||
(with legacyPackages; [ bash hello coreutils ])
|
||||
}
|
||||
set -v
|
||||
time ls -lR /nix
|
||||
sleep 1
|
||||
hello -v
|
||||
sleep 1
|
||||
uname -a
|
||||
'';
|
||||
};
|
||||
in rec {
|
||||
{
|
||||
name = "posix";
|
||||
machine = {
|
||||
config = ''
|
||||
${
|
||||
./posix.dhall
|
||||
} { bash = \"${bash}\", coreutils = \"${coreutils}\", script = \"${script}\" }'';
|
||||
inputs = map pkgs.genodeSources.depot [ "libc" "posix" "vfs_pipe" "vfs" ]
|
||||
++ [ bash ];
|
||||
extraPaths = [ script ] ++ (with legacyPackages; [ coreutils hello ]);
|
||||
machine = { pkgs, ... }: {
|
||||
genode.init.children.posix = with pkgs;
|
||||
let
|
||||
script = writeTextFile {
|
||||
name = "posix.sh";
|
||||
text = ''
|
||||
export PATH=${
|
||||
lib.makeSearchPathOutput "bin" "bin" [ bash hello coreutils ]
|
||||
}
|
||||
set -v
|
||||
time ls -lR /nix
|
||||
sleep 1
|
||||
hello -v
|
||||
sleep 1
|
||||
uname -a
|
||||
'';
|
||||
};
|
||||
in {
|
||||
configFile = writeText "posix.child.dhall" ''
|
||||
${
|
||||
./posix.dhall
|
||||
} { bash = "${bash}", coreutils = "${coreutils}", script = "${script}" }
|
||||
'';
|
||||
inputs = [ bash hello coreutils ]
|
||||
++ (with genodePackages; [ cached_fs_rom libc posix vfs vfs_pipe ]);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue