2
0
Fork 0
Browse Source

Add package manifests at testing site

The manifests can be generated at late as possible. Also, in the future
a list of binaries in use by an init expression can be extracted and
selected from a list of input packages.
llvm-10
Emery Hemingway 2 years ago
parent
commit
db7d458b5e
  1. 24
      packages/default.nix
  2. 74
      packages/genodelabs/default.nix
  3. 16
      tests/default.nix
  4. 6
      tests/driver-hw.nix
  5. 6
      tests/driver-linux.nix
  6. 6
      tests/driver-nova.nix

24
packages/default.nix

@ -3,21 +3,10 @@
{ system, legacyPackages, localPackages, depot, apps }:
let
dhallPackages = import ./dhall { inherit (localPackages) callPackage; };
inherit (legacyPackages) callPackage;
dhallPackages = localPackages.callPackage ./dhall { };
mkDhallManifest = drv:
legacyPackages.runCommand "${drv.name}.dhall" { inherit drv; }
"${apps.generate-manifest.program} $drv > $out";
addManifest = drv: { manifest = mkDhallManifest drv; } // drv;
callPackage' = path: attrs:
addManifest (legacyPackages.callPackage path attrs);
genodeLabs = import ./genodelabs {
nixpkgs = legacyPackages;
inherit addManifest;
};
genodeLabs = import ./genodelabs { nixpkgs = legacyPackages; };
inherit (genodeLabs) buildUpstream;
buildWorld = let
@ -105,10 +94,9 @@ in rec {
NOVA = legacyPackages.callPackage ./NOVA { };
solo5 = let drv = callPackage' ./solo5 { };
in drv // { tests = addManifest drv.tests // { pname = "solo5-tests"; }; };
sotest-producer = callPackage' ./sotest-producer { };
solo5 = let drv = callPackage ./solo5 { };
in drv // { tests = drv.tests // { pname = "solo5-tests"; }; };
stdcxx = callPackage' ./stdcxx { };
sotest-producer = callPackage ./sotest-producer { };
}

74
packages/genodelabs/default.nix

@ -1,4 +1,4 @@
{ nixpkgs, addManifest }:
{ nixpkgs }:
let
genodeSources = let
@ -94,43 +94,41 @@ let
buildUpstream = { name, targets, portInputs ? [ ], nativeBuildInputs ? [ ]
, ... }@extraAttrs:
let
drv = stdenv'.mkDerivation (extraAttrs // {
pname = name;
inherit (genodeSources) version;
inherit targets;
dontUnpack = true;
nativeBuildInputs = with nixpkgs.buildPackages;
[ binutils bison flex stdenv.cc tcl which ] ++ nativeBuildInputs;
enableParallelBuilding = true;
configurePhase = let
linkPorts = toString
(builtins.map (drv: " ln -sv ${drv}/* contrib/;") portInputs);
in ''
runHook preConfigure
export CONTRIB_DIR=$NIX_BUILD_TOP/contrib
export BUILD_DIR=$NIX_BUILD_TOP/build
${genodeSources}/tool/create_builddir ${arch}
substituteInPlace build/etc/build.conf \
--replace "#REPOSITORIES" "REPOSITORIES"
mkdir $CONTRIB_DIR; ${linkPorts}
runHook postConfigure
'';
makeFlags = [ "-C build" ] ++ targets;
installPhase = ''
runHook preInstall
find build/bin -name '*.xsd' -delete
find build/bin -follow -type f -exec install -Dt $out '{}' \;
runHook postInstall
'';
});
in addManifest drv;
stdenv'.mkDerivation (extraAttrs // {
pname = name;
inherit (genodeSources) version;
inherit targets;
dontUnpack = true;
nativeBuildInputs = with nixpkgs.buildPackages;
[ binutils bison flex stdenv.cc tcl which ] ++ nativeBuildInputs;
enableParallelBuilding = true;
configurePhase = let
linkPorts = toString
(builtins.map (drv: " ln -sv ${drv}/* contrib/;") portInputs);
in ''
runHook preConfigure
export CONTRIB_DIR=$NIX_BUILD_TOP/contrib
export BUILD_DIR=$NIX_BUILD_TOP/build
${genodeSources}/tool/create_builddir ${arch}
substituteInPlace build/etc/build.conf \
--replace "#REPOSITORIES" "REPOSITORIES"
mkdir $CONTRIB_DIR; ${linkPorts}
runHook postConfigure
'';
makeFlags = [ "-C build" ] ++ targets;
installPhase = ''
runHook preInstall
find build/bin -name '*.xsd' -delete
find build/bin -follow -type f -exec install -Dt $out '{}' \;
runHook postInstall
'';
});
buildOverrides = import ./targets.nix {
inherit (nixpkgs) buildPackages;

16
tests/default.nix

@ -15,10 +15,20 @@ let
depot = genode-depot.packages.${system};
testPkgs = genodepkgs;
addManifest = drv:
drv // {
manifest = hostPkgs.runCommand "${drv.name}.dhall" { inherit drv; } ''
set -eu
echo -n '[' >> $out
find $drv/ -type f -printf ',{mapKey= "%f",mapValue="%p"}' >> $out
echo -n ']' >> $out
'';
};
linux =
(call: ((tests call) // { block_router = call ./block_router.nix { }; }))
(import ./driver-linux.nix {
inherit apps testPkgs hostPkgs lib depot;
inherit apps testPkgs hostPkgs lib depot addManifest;
}).callTest;
nova = (call:
@ -28,7 +38,7 @@ let
pci = call ./pci.nix { };
rtc = call ./rtc.nix { };
})) (import ./driver-nova.nix {
inherit apps system testPkgs hostPkgs lib depot;
inherit apps system testPkgs hostPkgs lib depot addManifest;
}).callTest;
hw = (call:
@ -37,7 +47,7 @@ let
pci = call ./pci.nix { };
rtc = call ./rtc.nix { };
})) (import ./driver-hw.nix {
inherit apps system testPkgs hostPkgs lib depot;
inherit apps system testPkgs hostPkgs lib depot addManifest;
}).callTest;
testsToList = tests:

6
tests/driver-hw.nix

@ -1,6 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
{ system, apps, testPkgs, hostPkgs, lib, depot }:
{ system, apps, testPkgs, hostPkgs, lib, depot, addManifest }:
let
testDriver = with hostPkgs;
@ -40,9 +40,9 @@ let
mkTest = { name ? "unamed", testScript ? defaultScript, testConfig
, testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], ... }@t:
let
manifest = lib.mergeManifests (with testPkgs;
manifest = lib.mergeManifests (map addManifest (with testPkgs;
[ base-hw-pc (genodeSources.make "init") sotest-producer ]
++ testInputs);
++ testInputs));
testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
testEnv' = {
DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";

6
tests/driver-linux.nix

@ -1,6 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
{ apps, testPkgs, hostPkgs, lib, depot }:
{ apps, testPkgs, hostPkgs, lib, depot, addManifest }:
let
testDriver = with hostPkgs;
@ -38,8 +38,8 @@ let
, env ? { }, ... }:
with testPkgs;
let
manifest = lib.mergeManifests
(with testPkgs; [ base-linux init sotest-producer ] ++ testInputs);
manifest = lib.mergeManifests (map addManifest
((with testPkgs; [ base-linux init sotest-producer ] ++ testInputs)));
testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
env' = {
DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";

6
tests/driver-nova.nix

@ -1,6 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
{ system, apps, testPkgs, hostPkgs, lib, depot }:
{ system, apps, testPkgs, hostPkgs, lib, depot, addManifest }:
let
testDriver = with hostPkgs;
@ -40,9 +40,9 @@ let
mkTest = { name ? "unamed", testScript ? defaultScript, testConfig
, testInputs ? [ ], testEnv ? { }, qemuArgs ? [ ], ... }@t:
let
manifest = lib.mergeManifests (with testPkgs;
manifest = lib.mergeManifests (map addManifest (with testPkgs;
[ base-nova (genodeSources.make "init") sotest-producer ]
++ testInputs);
++ testInputs));
testConfig' = "${./test-wrapper.dhall} ${testConfig} (toMap ${manifest})";
testEnv' = {
DHALL_GENODE = "${testPkgs.dhallGenode}/source.dhall";

Loading…
Cancel
Save