summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2018-01-09 15:09:54 -0500
committerGitHub <noreply@github.com>2018-01-09 15:09:54 -0500
commit06a8d665286b3afa854a357a7fda63b2d875feb0 (patch)
treea9f29030f4dfb4c1e50f3518eb4b90d1c91e86d3
parent17bdefd1425dc91f77b4645e858992d944917bb2 (diff)
parent133b4658dfa1da5ae5e56f36ab39e5b12cfdb751 (diff)
downloadnixpkgs-06a8d665286b3afa854a357a7fda63b2d875feb0.tar
nixpkgs-06a8d665286b3afa854a357a7fda63b2d875feb0.tar.gz
nixpkgs-06a8d665286b3afa854a357a7fda63b2d875feb0.tar.bz2
nixpkgs-06a8d665286b3afa854a357a7fda63b2d875feb0.tar.lz
nixpkgs-06a8d665286b3afa854a357a7fda63b2d875feb0.tar.xz
nixpkgs-06a8d665286b3afa854a357a7fda63b2d875feb0.tar.zst
nixpkgs-06a8d665286b3afa854a357a7fda63b2d875feb0.zip
Merge pull request #33603 from obsidiansystems/cross-check
stdenv: Force `doCheck` to be false when we are cross compiling
-rw-r--r--doc/stdenv.xml29
-rw-r--r--pkgs/applications/editors/ed/default.nix2
-rw-r--r--pkgs/development/libraries/boehm-gc/default.nix2
-rw-r--r--pkgs/development/libraries/expat/default.nix2
-rw-r--r--pkgs/development/libraries/gdbm/default.nix2
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix3
-rw-r--r--pkgs/development/libraries/libjpeg-turbo/default.nix2
-rw-r--r--pkgs/development/libraries/libmpc/default.nix2
-rw-r--r--pkgs/development/libraries/libpng/default.nix2
-rw-r--r--pkgs/development/libraries/libsigsegv/default.nix2
-rw-r--r--pkgs/development/libraries/libtiff/default.nix2
-rw-r--r--pkgs/development/libraries/lzo/default.nix2
-rw-r--r--pkgs/development/libraries/mpfr/default.nix2
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix19
-rw-r--r--pkgs/tools/system/ddrescue/default.nix2
-rw-r--r--pkgs/tools/text/gnupatch/default.nix2
16 files changed, 47 insertions, 30 deletions
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 7154a576def..3a7b23baaa7 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -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>
diff --git a/pkgs/applications/editors/ed/default.nix b/pkgs/applications/editors/ed/default.nix
index 6c2f1ea2003..d8af0c6888e 100644
--- a/pkgs/applications/editors/ed/default.nix
+++ b/pkgs/applications/editors/ed/default.nix
@@ -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";
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index 421d7072397..9a01cdfe874 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -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;
diff --git a/pkgs/development/libraries/expat/default.nix b/pkgs/development/libraries/expat/default.nix
index 01f3c11ac73..e341ce842eb 100644
--- a/pkgs/development/libraries/expat/default.nix
+++ b/pkgs/development/libraries/expat/default.nix
@@ -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
diff --git a/pkgs/development/libraries/gdbm/default.nix b/pkgs/development/libraries/gdbm/default.nix
index 3b78225a447..7a602f5430e 100644
--- a/pkgs/development/libraries/gdbm/default.nix
+++ b/pkgs/development/libraries/gdbm/default.nix
@@ -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.
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index dce052f8baa..5973c89cef7 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -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;
 
diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index bf626df28ea..4ec0e5ebd9f 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
+  doCheck = true; # not cross;
   checkTarget = "test";
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libmpc/default.nix b/pkgs/development/libraries/libmpc/default.nix
index 4be59af6f0c..d292dd1e536 100644
--- a/pkgs/development/libraries/libmpc/default.nix
+++ b/pkgs/development/libraries/libmpc/default.nix
@@ -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";
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index c4a6a246b90..5ad9cf1e7b7 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -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; };
 
diff --git a/pkgs/development/libraries/libsigsegv/default.nix b/pkgs/development/libraries/libsigsegv/default.nix
index 8e1079bfbc8..4a13bfd9994 100644
--- a/pkgs/development/libraries/libsigsegv/default.nix
+++ b/pkgs/development/libraries/libsigsegv/default.nix
@@ -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/;
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index ee21f3df7ac..0f95b6d34c7 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -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";
diff --git a/pkgs/development/libraries/lzo/default.nix b/pkgs/development/libraries/lzo/default.nix
index e8f8a6ab9bb..df5cb7c67f3 100644
--- a/pkgs/development/libraries/lzo/default.nix
+++ b/pkgs/development/libraries/lzo/default.nix
@@ -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";
diff --git a/pkgs/development/libraries/mpfr/default.nix b/pkgs/development/libraries/mpfr/default.nix
index 6be199af193..fe364f22f9a 100644
--- a/pkgs/development/libraries/mpfr/default.nix
+++ b/pkgs/development/libraries/mpfr/default.nix
@@ -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;
 
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index 2d702ab389e..3ffa7cfe35f 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -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
diff --git a/pkgs/tools/system/ddrescue/default.nix b/pkgs/tools/system/ddrescue/default.nix
index bf2ff5a6206..e6af7abeda2 100644
--- a/pkgs/tools/system/ddrescue/default.nix
+++ b/pkgs/tools/system/ddrescue/default.nix
@@ -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; {
diff --git a/pkgs/tools/text/gnupatch/default.nix b/pkgs/tools/text/gnupatch/default.nix
index 13579b57e79..dfdb25438cf 100644
--- a/pkgs/tools/text/gnupatch/default.nix
+++ b/pkgs/tools/text/gnupatch/default.nix
@@ -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";