2
0
Fork 0

tests: add Bash test

Test Bash and Coretuils from the Genode Labs ports.
llvm-11
Emery Hemingway 2 years ago
parent a1f9effb3c
commit a2a152b68a
  1. 2
      packages/genodelabs/default.nix
  2. 18
      packages/genodelabs/depot-targets.nix
  3. 5
      packages/genodelabs/ports.nix
  4. 170
      tests/bash.dhall
  5. 24
      tests/bash.nix
  6. 1
      tests/default.nix

@ -301,7 +301,7 @@ let
in makePackages // depotPackages // {
genodeSources = genodeSources // {
inherit buildUpstream buildDepot genodeBase ports specs toolchain;
inherit arch buildUpstream buildDepot genodeBase ports specs toolchain;
};
base-hw-pc = buildUpstream {

@ -21,8 +21,26 @@ in {
acpi_drv = { };
bash = {
enableParallelBuilding = false;
nativeBuildInputs = with buildPackages; [ autoconf ];
portInputs = with ports; [ bash libc ];
postInstall = ''
find depot/genodelabs/bin/ -name '*.tar' -exec tar xf {} -C $out \;
rm "''${!outputBin}/bin/bashbug"
'';
};
cached_fs_rom.patches = [ ./cached_fs_rom.patch ];
coreutils = {
enableParallelBuilding = false;
portInputs = with ports; [ coreutils libc ];
postInstall = ''
find depot/genodelabs/bin/ -name '*.tar' -exec tar xf {} -C $out \;
'';
};
fb_sdl = with buildPackages; {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ SDL ];

@ -5,10 +5,15 @@
with pkgs;
{
bash.hash = "sha256-Se03Eyh8grk+QGAXLGoig7oXqmHtAwtHJX54fCVHw+8=";
binutils = {
hash = "sha256-ERzYT3TjbK3fzRVN1UE7RM6XiPPeMKzkeulKx5IQa2o=";
nativeBuildInputs = [ autoconf ];
};
coreutils.hash = "sha256-ZVlFfLghHcXxwwRsN5xw2bVdIvvXoCNj2oZniOlSXrg=";
dde_bsd.hash = "sha256-/n9aHPU6/+AgRSyFD545p3BT63n3myymez1tIRhJisA=";
dde_ipxe.hash = "sha256-NJ129+DkxFg1fFHJBABBFRRjqEVNSz6v2hEB80AuEM4=";
dde_linux.hash = "sha256-xHAgeKfArgMGKCGHi0762qkUcY97vbiAQYjM/ZRXCes=";

@ -0,0 +1,170 @@
let Genode = env:DHALL_GENODE
let Prelude = Genode.Prelude
let XML = Prelude.XML
let VFS = Genode.VFS
let Init = Genode.Init
let Child = Init.Child
in λ(params : { bash : Text, coreutils : Text }) →
let init =
Init::{
, verbose = True
, routes =
[ Init.ServiceRoute.parent "Timer"
, Init.ServiceRoute.parent "Rtc"
]
, children = toMap
{ vfs =
Child.flat
Child.Attributes::{
, binary = "vfs"
, 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" ]
, config = Init.Config::{
, content =
[ VFS.vfs
[ VFS.dir
"dev"
[ VFS.dir "pipes" [ VFS.leaf "pipe" ]
, VFS.leaf "log"
, VFS.leaf "null"
, VFS.leaf "rtc"
, VFS.leaf "zero"
]
, VFS.dir
"usr"
[ VFS.dir
"bin"
[ VFS.symlink
"env"
"${params.coreutils}/bin/env"
]
]
, VFS.dir "ram" [ VFS.leaf "ram" ]
, VFS.dir
"nix"
[ VFS.dir
"store"
[ VFS.fs VFS.FS::{ label = "nix-store" } ]
]
, VFS.inline
"script.sh"
''
bash --version
bash -c "bash --version"
''
]
]
, policies =
[ Init.Config.Policy::{
, service = "File_system"
, 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 = "/" }
}
]
}
}
, vfs_rom =
Child.flat
Child.Attributes::{
, binary = "cached_fs_rom"
, provides = [ "ROM" ]
, resources = Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 32
}
, config = Init.Config::{
, policies =
[ Init.Config.Policy::{
, service = "ROM"
, label = Init.LabelSelector.prefix "shell"
}
]
}
}
, shell =
Child.flat
Child.Attributes::{
, binary = "${params.bash}/bin/bash"
, exitPropagate = True
, resources = Genode.Init.Resources::{
, caps = 256
, ram = Genode.units.MiB 8
}
, routes =
Prelude.List.map
Text
Init.ServiceRoute.Type
( λ(label : Text) →
Init.ServiceRoute.parentLabel
"ROM"
(Some label)
(Some label)
)
[ "libc.lib.so"
, "libm.lib.so"
, "posix.lib.so"
, "vfs.lib.so"
]
, config = Genode.Init.Config::{
, attributes = toMap { ld_verbose = "true" }
, content =
let env =
λ(key : Text) →
λ(value : Text) →
XML.leaf
{ name = "env"
, attributes = toMap { key, value }
}
let arg =
λ(value : Text) →
XML.leaf
{ name = "arg"
, attributes = toMap { value }
}
in [ XML.leaf
{ name = "libc"
, attributes = toMap
{ stdin = "/dev/null"
, stdout = "/dev/log"
, stderr = "/dev/log"
, pipe = "/dev/pipe"
, rtc = "/dev/rtc"
}
}
, VFS.vfs [ VFS.fs VFS.FS::{ label = "root" } ]
, env "TERM" "screen"
, env
"PATH"
"${params.coreutils}/bin:${params.bash}/bin"
, arg "bash"
, arg "/script.sh"
]
}
}
}
}
in Init.toChild init Init.Attributes::{=}

@ -0,0 +1,24 @@
{
name = "bash";
machine = { pkgs, ... }: {
genode.init.children.bash = {
configFile = pkgs.writeText "bash.child.dhall" ''
${
./bash.dhall
} { bash = "${pkgs.genodePackages.bash}", coreutils = "${pkgs.coreutils}" }
'';
inputs = with pkgs.genodePackages; [
bash
cached_fs_rom
libc
posix
vfs
vfs_pipe
];
};
};
testScript = ''
start_all()
machine.wait_until_serial_output('child "bash" exited with exit value 0')
'';
}

@ -8,6 +8,7 @@ let
testingPython = import ./lib/testing-python.nix;
testSpecs = map (p: import p) [
./bash.nix
./hello.nix
./log.nix
./solo5/multi.nix

Loading…
Cancel
Save