Skip to content

Commit

Permalink
Update comp-builder to run tests directly
Browse files Browse the repository at this point in the history
  • Loading branch information
ruhatch committed Jun 7, 2019
1 parent 3747f54 commit d320d44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ let
&& (haskellLib.isLibrary componentId)
&& stdenv.hostPlatform == stdenv.buildPlatform;

testExecutable = "dist/build/${componentId.cname}/${componentId.cname}"
+ lib.optionalString stdenv.hostPlatform.isWindows ".exe";

in stdenv.lib.fix (drv:

stdenv.mkDerivation ({
Expand Down Expand Up @@ -179,9 +182,9 @@ stdenv.mkDerivation ({

checkPhase = ''
runHook preCheck
$SETUP_HS test ${lib.concatStringsSep " " component.setupTestFlags}
mkdir -p $out/${name}
cp dist/test/*.log $out/${name}/
${component.testWrapper} ${testExecutable} ${lib.concatStringsSep " " component.testFlags}
runHook postCheck
'';

Expand Down
9 changes: 7 additions & 2 deletions modules/plan.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ let
type = listOfFilteringNulls str;
default = (def.setupBuildFlags or []);
};
setupTestFlags = mkOption {
testFlags = mkOption {
type = listOfFilteringNulls str;
default = (def.setupTestFlags or []);
default = (def.testFlags or []);
};
setupInstallFlags = mkOption {
type = listOfFilteringNulls str;
Expand Down Expand Up @@ -123,6 +123,11 @@ let
type = nullOr string;
default = (def.preCheck or null);
};
# Wrapper for test executable run in checkPhase
testWrapper = mkOption {
type = string;
default = (def.testWrapper or "");
};
postCheck = mkOption {
type = nullOr string;
default = (def.postCheck or null);
Expand Down

0 comments on commit d320d44

Please sign in to comment.