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 ac52eff
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
31 changes: 27 additions & 4 deletions builder/comp-builder.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
{ stdenv, buildPackages, ghc, lib, pkgconfig, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs }:
{ stdenv
, buildPackages
, ghc
, lib
, pkgconfig
, gobject-introspection ? null
, writeScriptBin
, haskellLib
, makeConfigFiles
, ghcForComponent
, hsPkgs
}:

{ componentId
, component
Expand Down Expand Up @@ -104,6 +115,18 @@ let
&& (haskellLib.isLibrary componentId)
&& stdenv.hostPlatform == stdenv.buildPlatform;

wine = buildPackages.winePackages.minimal;

wineTestWrapper = writeScriptBin "test-wrapper" ''
#!${stdenv.shell}
set -euo pipefail
WINEDLLOVERRIDES="winemac.drv=d" WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag LC_ALL=en_US.UTF-8 WINEPREFIX=$TMP ${wine}/bin/wine64 $@
'';

checkCommand = if stdenv.hostPlatform.isWindows
then "${wineTestWrapper}/bin/test-wrapper dist/build/${componentId.cname}/${componentId.cname}.exe"
else "dist/build/${componentId.cname}/${componentId.cname}";

in stdenv.lib.fix (drv:

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

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

Expand Down
4 changes: 2 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

0 comments on commit ac52eff

Please sign in to comment.