on iko/ghcjs-patch-master help sign in
Update comp-builder to run tests directly (#168)
commit83e4c75957ffac247c55636da449aeb4d12f561a authorRupert Horlick <rupert.horlick@iohk.io> dateFri 7 Jun 2019, 16:47 (7 years ago) parent3747f54
2 files changed+13−5
builder/comp-builder.nix+6−3 modules/plan.nix+7−2
builder/comp-builder.nix+6−3
@@ -104,6 +104,9 @@ let
104104 && (haskellLib.isLibrary componentId)
105105 && stdenv.hostPlatform == stdenv.buildPlatform;
106106
107+ testExecutable = "dist/build/${componentId.cname}/${componentId.cname}"
108+ + lib.optionalString stdenv.hostPlatform.isWindows ".exe";
109+
107110in stdenv.lib.fix (drv:
108111
109112stdenv.mkDerivation ({
@@ -179,9 +182,9 @@ stdenv.mkDerivation ({
179182
180183 checkPhase = ''
181184 runHook preCheck
182− $SETUP_HS test ${lib.concatStringsSep " " component.setupTestFlags}
183− mkdir -p $out/${name}
184− cp dist/test/*.log $out/${name}/
185+
186+ ${component.testWrapper} ${testExecutable} ${lib.concatStringsSep " " component.testFlags}
187+
185188 runHook postCheck
186189 '';
187190
modules/plan.nix+7−2
@@ -43,9 +43,9 @@ let
4343 type = listOfFilteringNulls str;
4444 default = (def.setupBuildFlags or []);
4545 };
46− setupTestFlags = mkOption {
46+ testFlags = mkOption {
4747 type = listOfFilteringNulls str;
48− default = (def.setupTestFlags or []);
48+ default = (def.testFlags or []);
4949 };
5050 setupInstallFlags = mkOption {
5151 type = listOfFilteringNulls str;
@@ -123,6 +123,11 @@ let
123123 type = nullOr string;
124124 default = (def.preCheck or null);
125125 };
126+ # Wrapper for test executable run in checkPhase
127+ testWrapper = mkOption {
128+ type = string;
129+ default = (def.testWrapper or "");
130+ };
126131 postCheck = mkOption {
127132 type = nullOr string;
128133 default = (def.postCheck or null);