diff --git a/builder/comp-builder.nix b/builder/comp-builder.nix index 23489c47ad..11d9769935 100644 --- a/builder/comp-builder.nix +++ b/builder/comp-builder.nix @@ -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 ({ @@ -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 ''; diff --git a/modules/plan.nix b/modules/plan.nix index e8a692f1e9..3452de72df 100644 --- a/modules/plan.nix +++ b/modules/plan.nix @@ -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; @@ -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);