Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update comp-builder to run tests directly #168

Merged
merged 1 commit into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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