2019-11-29 13:28:47 +03:00
|
|
|
{ stdenv, lib, haskellLib, srcOnly }:
|
|
|
|
drv:
|
|
|
|
|
|
|
|
let
|
|
|
|
component = drv.config;
|
|
|
|
|
|
|
|
# This derivation can be used to execute test component.
|
|
|
|
# The $out of the derivation is a file containing the resulting
|
|
|
|
# stdout output.
|
|
|
|
in stdenv.mkDerivation ({
|
|
|
|
name = (drv.name + "-check");
|
|
|
|
|
2021-03-20 04:25:30 +03:00
|
|
|
# Using `srcOnly` (rather than getting the `src` via a `drv.passthru`)
|
2019-11-29 13:28:47 +03:00
|
|
|
# should correctly apply the patches from `drv` (if any).
|
2019-12-13 06:43:27 +03:00
|
|
|
src = drv.source or (srcOnly drv);
|
2019-11-29 13:28:47 +03:00
|
|
|
|
|
|
|
passthru = {
|
2020-09-29 06:56:24 +03:00
|
|
|
inherit (drv) identifier config configFiles executableToolDepends cleanSrc env exeName;
|
2019-11-29 13:28:47 +03:00
|
|
|
};
|
|
|
|
|
2019-12-13 06:43:27 +03:00
|
|
|
inherit (drv) meta LANG LC_ALL buildInputs nativeBuildInputs;
|
2019-11-29 13:28:47 +03:00
|
|
|
|
|
|
|
inherit (component) doCheck doCrossCheck;
|
|
|
|
|
2019-12-13 06:43:27 +03:00
|
|
|
phases = ["unpackPhase" "buildPhase"];
|
2019-11-29 13:28:47 +03:00
|
|
|
|
|
|
|
# If doCheck or doCrossCheck are false we may still build this
|
|
|
|
# component and we want it to quietly succeed.
|
|
|
|
buildPhase = ''
|
2020-09-29 06:56:24 +03:00
|
|
|
mkdir $out
|
2021-01-19 08:28:33 +03:00
|
|
|
${
|
|
|
|
# Change to the source sub directory if there is one.
|
|
|
|
lib.optionalString (drv.srcSubDir or "" != "") ''
|
|
|
|
cd ${lib.removePrefix "/" drv.srcSubDir}
|
|
|
|
''
|
|
|
|
}
|
2019-11-29 13:28:47 +03:00
|
|
|
|
|
|
|
runHook preCheck
|
|
|
|
|
2020-09-29 06:56:24 +03:00
|
|
|
${toString component.testWrapper} ${drv}/bin/${drv.exeName} ${lib.concatStringsSep " " component.testFlags} | tee $out/test-stdout
|
|
|
|
|
|
|
|
# Copy over tix files, if they exist
|
|
|
|
find . -iname '${drv.exeName}.tix' -exec mkdir -p $out/share/hpc/vanilla/tix/${drv.exeName} \; -exec cp {} $out/share/hpc/vanilla/tix/${drv.exeName}/ \;
|
2019-11-29 13:28:47 +03:00
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
} // haskellLib.optionalHooks {
|
|
|
|
inherit (component) preCheck postCheck;
|
2019-12-03 13:02:13 +03:00
|
|
|
}
|
|
|
|
// lib.optionalAttrs (drv ? LOCALE_ARCHIVE) { inherit (drv) LOCALE_ARCHIVE; }
|
|
|
|
)
|