Merge pull request #33603 from obsidiansystems/cross-check

stdenv: Force `doCheck` to be false when we are cross compiling
This commit is contained in:
John Ericson 2018-01-09 15:09:54 -05:00 committed by GitHub
commit 06a8d66528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 47 additions and 30 deletions

View File

@ -995,13 +995,14 @@ but only if the <varname>doCheck</varname> variable is enabled.</para>
<varlistentry>
<term><varname>doCheck</varname></term>
<listitem><para>If set to a non-empty string, the check phase is
executed, otherwise it is skipped (default). Thus you should set
<programlisting>
doCheck = true;</programlisting>
in the derivation to enable checks.</para></listitem>
<listitem><para>
Controls whether the check phase is executed.
By default it is skipped, but if <varname>doCheck</varname> is set to true, the check phase is usually executed.
Thus you should set <programlisting>doCheck = true;</programlisting> in the derivation to enable checks.
The exception is cross compilation.
Cross compiled builds never run tests, no matter how <varname>doCheck</varname> is set,
as the newly-built program won't run on the platform used to build it.
</para></listitem>
</varlistentry>
<varlistentry>
@ -1280,12 +1281,14 @@ installcheck</command>.</para>
<varlistentry>
<term><varname>doInstallCheck</varname></term>
<listitem><para>If set to a non-empty string, the installCheck phase is
executed, otherwise it is skipped (default). Thus you should set
<programlisting>doInstallCheck = true;</programlisting>
in the derivation to enable install checks.</para></listitem>
<listitem><para>
Controls whether the installCheck phase is executed.
By default it is skipped, but if <varname>doInstallCheck</varname> is set to true, the installCheck phase is usually executed.
Thus you should set <programlisting>doInstallCheck = true;</programlisting> in the derivation to enable install checks.
The exception is cross compilation.
Cross compiled builds never run tests, no matter how <varname>doInstallCheck</varname> is set,
as the newly-built program won't run on the platform used to build it.
</para></listitem>
</varlistentry>
<varlistentry>

View File

@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ lzip ];
doCheck = hostPlatform == buildPlatform;
doCheck = true; # not cross;
meta = {
description = "An implementation of the standard Unix editor";

View File

@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
[ "--enable-cplusplus" ]
++ lib.optional enableLargeConfig "--enable-large-config";
doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
doCheck = true; # not cross;
# Don't run the native `strip' when cross-compiling.
dontStrip = hostPlatform != buildPlatform;

View File

@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
outputMan = "dev"; # tiny page for a dev tool
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
doCheck = true; # not cross;
preCheck = ''
patchShebangs ./run.sh

View File

@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
sha256 = "0lx201q20dvc70f8a3c9s7s18z15inlxvbffph97ngvrgnyjq9cx";
};
doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
doCheck = true; # not cross;
# Linking static stubs on cygwin requires correct ordering.
# Consider upstreaming this.

View File

@ -1,6 +1,5 @@
{ stdenv, fetchurl, m4, cxx ? true
, buildPackages
, buildPlatform, hostPlatform
, withStatic ? false }:
let inherit (stdenv.lib) optional optionalString; in
@ -43,7 +42,7 @@ let self = stdenv.mkDerivation rec {
configureFlagsArray+=("--build=$(./configfsf.guess)")
'';
doCheck = buildPlatform == hostPlatform;
doCheck = true; # not cross;
dontDisableStatic = withStatic;

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
doCheck = true; # not cross;
checkTarget = "test";
meta = with stdenv.lib; {

View File

@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
CFLAGS = "-I${gmp.dev}/include";
doCheck = hostPlatform == buildPlatform;
doCheck = true; # not cross;
meta = {
description = "Library for multiprecision complex arithmetic with exact rounding";

View File

@ -30,7 +30,7 @@ in stdenv.mkDerivation rec {
# it's hard to cross-run tests and some check programs didn't compile anyway
makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS=";
doCheck = hostPlatform == buildPlatform;
doCheck = true; # not cross;
passthru = { inherit zlib; };

View File

@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
patches = if enableSigbusFix then [ ./sigbus_fix.patch ] else null;
doCheck = hostPlatform == buildPlatform;
doCheck = true; # not cross;
meta = {
homepage = http://www.gnu.org/software/libsigsegv/;

View File

@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
doCheck = true; # not cross;
meta = with stdenv.lib; {
description = "Library and utilities for working with the TIFF image file format";

View File

@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
doCheck = true; # not cross;
meta = with stdenv.lib; {
description = "Real-time data (de)compression library";

View File

@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
stdenv.lib.optional hostPlatform.isSunOS "--disable-thread-safe" ++
stdenv.lib.optional hostPlatform.is64bit "--with-pic";
doCheck = hostPlatform == buildPlatform;
doCheck = true; # not cross;
enableParallelBuilding = true;

View File

@ -36,6 +36,7 @@ rec {
, depsTargetTarget ? [] # 1 -> 1
, depsTargetTargetPropagated ? [] # 1 -> 1
# Configure Phase
, configureFlags ? []
, # Target is not included by default because most programs don't care.
# Including it then would cause needless mass rebuilds.
@ -44,6 +45,13 @@ rec {
configurePlatforms ? lib.optionals
(stdenv.hostPlatform != stdenv.buildPlatform)
[ "build" "host" ]
# Check phase
, doCheck ? false
# InstallCheck phase
, doInstallCheck ? false
, crossConfig ? null
, meta ? {}
, passthru ? {}
@ -60,6 +68,7 @@ rec {
, hardeningEnable ? []
, hardeningDisable ? []
, ... } @ attrs:
# TODO(@Ericson2314): Make this more modular, and not O(n^2).
@ -178,9 +187,15 @@ rec {
"/bin/sh"
];
__propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
} // (if outputs' != [ "out" ] then {
} // lib.optionalAttrs (outputs' != [ "out" ]) {
outputs = outputs';
} else { }));
} // lib.optionalAttrs (attrs ? doCheck) {
# TODO(@Ericson2314): Make unconditional / resolve #33599
doCheck = doCheck && (stdenv.hostPlatform == stdenv.targetPlatform);
} // lib.optionalAttrs (attrs ? doInstallCheck) {
# TODO(@Ericson2314): Make unconditional / resolve #33599
doInstallCheck = doInstallCheck && (stdenv.hostPlatform == stdenv.targetPlatform);
});
# The meta attribute is passed in the resulting attribute set,
# but it's not part of the actual derivation, i.e., it's not

View File

@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ lzip ];
doCheck = hostPlatform == buildPlatform;
doCheck = true; # not cross;
configureFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ];
meta = with stdenv.lib; {

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
"ac_cv_func_strnlen_working=yes"
];
doCheck = hostPlatform == buildPlatform;
doCheck = true; # not cross;
meta = {
description = "GNU Patch, a program to apply differences to files";