Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #33603 from obsidiansystems/cross-check

stdenv: Force `doCheck` to be false when we are cross compiling

authored by John Ericson and committed by GitHub 06a8d665 17bdefd1

+47 -30
+16 -13
doc/stdenv.xml
··· 995 996 <varlistentry> 997 <term><varname>doCheck</varname></term> 998 - <listitem><para>If set to a non-empty string, the check phase is 999 - executed, otherwise it is skipped (default). Thus you should set 1000 - 1001 - <programlisting> 1002 - doCheck = true;</programlisting> 1003 - 1004 - in the derivation to enable checks.</para></listitem> 1005 </varlistentry> 1006 1007 <varlistentry> ··· 1280 1281 <varlistentry> 1282 <term><varname>doInstallCheck</varname></term> 1283 - <listitem><para>If set to a non-empty string, the installCheck phase is 1284 - executed, otherwise it is skipped (default). Thus you should set 1285 - 1286 - <programlisting>doInstallCheck = true;</programlisting> 1287 - 1288 - in the derivation to enable install checks.</para></listitem> 1289 </varlistentry> 1290 1291 <varlistentry>
··· 995 996 <varlistentry> 997 <term><varname>doCheck</varname></term> 998 + <listitem><para> 999 + Controls whether the check phase is executed. 1000 + By default it is skipped, but if <varname>doCheck</varname> is set to true, the check phase is usually executed. 1001 + Thus you should set <programlisting>doCheck = true;</programlisting> in the derivation to enable checks. 1002 + The exception is cross compilation. 1003 + Cross compiled builds never run tests, no matter how <varname>doCheck</varname> is set, 1004 + as the newly-built program won't run on the platform used to build it. 1005 + </para></listitem> 1006 </varlistentry> 1007 1008 <varlistentry> ··· 1281 1282 <varlistentry> 1283 <term><varname>doInstallCheck</varname></term> 1284 + <listitem><para> 1285 + Controls whether the installCheck phase is executed. 1286 + By default it is skipped, but if <varname>doInstallCheck</varname> is set to true, the installCheck phase is usually executed. 1287 + Thus you should set <programlisting>doInstallCheck = true;</programlisting> in the derivation to enable install checks. 1288 + The exception is cross compilation. 1289 + Cross compiled builds never run tests, no matter how <varname>doInstallCheck</varname> is set, 1290 + as the newly-built program won't run on the platform used to build it. 1291 + </para></listitem> 1292 </varlistentry> 1293 1294 <varlistentry>
+1 -1
pkgs/applications/editors/ed/default.nix
··· 13 14 nativeBuildInputs = [ lzip ]; 15 16 - doCheck = hostPlatform == buildPlatform; 17 18 meta = { 19 description = "An implementation of the standard Unix editor";
··· 13 14 nativeBuildInputs = [ lzip ]; 15 16 + doCheck = true; # not cross; 17 18 meta = { 19 description = "An implementation of the standard Unix editor";
+1 -1
pkgs/development/libraries/boehm-gc/default.nix
··· 20 [ "--enable-cplusplus" ] 21 ++ lib.optional enableLargeConfig "--enable-large-config"; 22 23 - doCheck = stdenv.buildPlatform == stdenv.hostPlatform; 24 25 # Don't run the native `strip' when cross-compiling. 26 dontStrip = hostPlatform != buildPlatform;
··· 20 [ "--enable-cplusplus" ] 21 ++ lib.optional enableLargeConfig "--enable-large-config"; 22 23 + doCheck = true; # not cross; 24 25 # Don't run the native `strip' when cross-compiling. 26 dontStrip = hostPlatform != buildPlatform;
+1 -1
pkgs/development/libraries/expat/default.nix
··· 15 16 outputMan = "dev"; # tiny page for a dev tool 17 18 - doCheck = stdenv.hostPlatform == stdenv.buildPlatform; 19 20 preCheck = '' 21 patchShebangs ./run.sh
··· 15 16 outputMan = "dev"; # tiny page for a dev tool 17 18 + doCheck = true; # not cross; 19 20 preCheck = '' 21 patchShebangs ./run.sh
+1 -1
pkgs/development/libraries/gdbm/default.nix
··· 8 sha256 = "0lx201q20dvc70f8a3c9s7s18z15inlxvbffph97ngvrgnyjq9cx"; 9 }; 10 11 - doCheck = stdenv.buildPlatform == stdenv.hostPlatform; 12 13 # Linking static stubs on cygwin requires correct ordering. 14 # Consider upstreaming this.
··· 8 sha256 = "0lx201q20dvc70f8a3c9s7s18z15inlxvbffph97ngvrgnyjq9cx"; 9 }; 10 11 + doCheck = true; # not cross; 12 13 # Linking static stubs on cygwin requires correct ordering. 14 # Consider upstreaming this.
+1 -2
pkgs/development/libraries/gmp/6.x.nix
··· 1 { stdenv, fetchurl, m4, cxx ? true 2 , buildPackages 3 - , buildPlatform, hostPlatform 4 , withStatic ? false }: 5 6 let inherit (stdenv.lib) optional optionalString; in ··· 43 configureFlagsArray+=("--build=$(./configfsf.guess)") 44 ''; 45 46 - doCheck = buildPlatform == hostPlatform; 47 48 dontDisableStatic = withStatic; 49
··· 1 { stdenv, fetchurl, m4, cxx ? true 2 , buildPackages 3 , withStatic ? false }: 4 5 let inherit (stdenv.lib) optional optionalString; in ··· 42 configureFlagsArray+=("--build=$(./configfsf.guess)") 43 ''; 44 45 + doCheck = true; # not cross; 46 47 dontDisableStatic = withStatic; 48
+1 -1
pkgs/development/libraries/libjpeg-turbo/default.nix
··· 21 22 enableParallelBuilding = true; 23 24 - doCheck = stdenv.buildPlatform == stdenv.hostPlatform; 25 checkTarget = "test"; 26 27 meta = with stdenv.lib; {
··· 21 22 enableParallelBuilding = true; 23 24 + doCheck = true; # not cross; 25 checkTarget = "test"; 26 27 meta = with stdenv.lib; {
+1 -1
pkgs/development/libraries/libmpc/default.nix
··· 18 19 CFLAGS = "-I${gmp.dev}/include"; 20 21 - doCheck = hostPlatform == buildPlatform; 22 23 meta = { 24 description = "Library for multiprecision complex arithmetic with exact rounding";
··· 18 19 CFLAGS = "-I${gmp.dev}/include"; 20 21 + doCheck = true; # not cross; 22 23 meta = { 24 description = "Library for multiprecision complex arithmetic with exact rounding";
+1 -1
pkgs/development/libraries/libpng/default.nix
··· 30 31 # it's hard to cross-run tests and some check programs didn't compile anyway 32 makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS="; 33 - doCheck = hostPlatform == buildPlatform; 34 35 passthru = { inherit zlib; }; 36
··· 30 31 # it's hard to cross-run tests and some check programs didn't compile anyway 32 makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS="; 33 + doCheck = true; # not cross; 34 35 passthru = { inherit zlib; }; 36
+1 -1
pkgs/development/libraries/libsigsegv/default.nix
··· 13 14 patches = if enableSigbusFix then [ ./sigbus_fix.patch ] else null; 15 16 - doCheck = hostPlatform == buildPlatform; 17 18 meta = { 19 homepage = http://www.gnu.org/software/libsigsegv/;
··· 13 14 patches = if enableSigbusFix then [ ./sigbus_fix.patch ] else null; 15 16 + doCheck = true; # not cross; 17 18 meta = { 19 homepage = http://www.gnu.org/software/libsigsegv/;
+1 -1
pkgs/development/libraries/libtiff/default.nix
··· 29 30 enableParallelBuilding = true; 31 32 - doCheck = stdenv.buildPlatform == stdenv.hostPlatform; 33 34 meta = with stdenv.lib; { 35 description = "Library and utilities for working with the TIFF image file format";
··· 29 30 enableParallelBuilding = true; 31 32 + doCheck = true; # not cross; 33 34 meta = with stdenv.lib; { 35 description = "Library and utilities for working with the TIFF image file format";
+1 -1
pkgs/development/libraries/lzo/default.nix
··· 12 13 enableParallelBuilding = true; 14 15 - doCheck = stdenv.hostPlatform == stdenv.buildPlatform; 16 17 meta = with stdenv.lib; { 18 description = "Real-time data (de)compression library";
··· 12 13 enableParallelBuilding = true; 14 15 + doCheck = true; # not cross; 16 17 meta = with stdenv.lib; { 18 description = "Real-time data (de)compression library";
+1 -1
pkgs/development/libraries/mpfr/default.nix
··· 21 stdenv.lib.optional hostPlatform.isSunOS "--disable-thread-safe" ++ 22 stdenv.lib.optional hostPlatform.is64bit "--with-pic"; 23 24 - doCheck = hostPlatform == buildPlatform; 25 26 enableParallelBuilding = true; 27
··· 21 stdenv.lib.optional hostPlatform.isSunOS "--disable-thread-safe" ++ 22 stdenv.lib.optional hostPlatform.is64bit "--with-pic"; 23 24 + doCheck = true; # not cross; 25 26 enableParallelBuilding = true; 27
+17 -2
pkgs/stdenv/generic/make-derivation.nix
··· 36 , depsTargetTarget ? [] # 1 -> 1 37 , depsTargetTargetPropagated ? [] # 1 -> 1 38 39 , configureFlags ? [] 40 , # Target is not included by default because most programs don't care. 41 # Including it then would cause needless mass rebuilds. ··· 44 configurePlatforms ? lib.optionals 45 (stdenv.hostPlatform != stdenv.buildPlatform) 46 [ "build" "host" ] 47 , crossConfig ? null 48 , meta ? {} 49 , passthru ? {} ··· 60 61 , hardeningEnable ? [] 62 , hardeningDisable ? [] 63 , ... } @ attrs: 64 65 # TODO(@Ericson2314): Make this more modular, and not O(n^2). ··· 178 "/bin/sh" 179 ]; 180 __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps; 181 - } // (if outputs' != [ "out" ] then { 182 outputs = outputs'; 183 - } else { })); 184 185 # The meta attribute is passed in the resulting attribute set, 186 # but it's not part of the actual derivation, i.e., it's not
··· 36 , depsTargetTarget ? [] # 1 -> 1 37 , depsTargetTargetPropagated ? [] # 1 -> 1 38 39 + # Configure Phase 40 , configureFlags ? [] 41 , # Target is not included by default because most programs don't care. 42 # Including it then would cause needless mass rebuilds. ··· 45 configurePlatforms ? lib.optionals 46 (stdenv.hostPlatform != stdenv.buildPlatform) 47 [ "build" "host" ] 48 + 49 + # Check phase 50 + , doCheck ? false 51 + 52 + # InstallCheck phase 53 + , doInstallCheck ? false 54 + 55 , crossConfig ? null 56 , meta ? {} 57 , passthru ? {} ··· 68 69 , hardeningEnable ? [] 70 , hardeningDisable ? [] 71 + 72 , ... } @ attrs: 73 74 # TODO(@Ericson2314): Make this more modular, and not O(n^2). ··· 187 "/bin/sh" 188 ]; 189 __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps; 190 + } // lib.optionalAttrs (outputs' != [ "out" ]) { 191 outputs = outputs'; 192 + } // lib.optionalAttrs (attrs ? doCheck) { 193 + # TODO(@Ericson2314): Make unconditional / resolve #33599 194 + doCheck = doCheck && (stdenv.hostPlatform == stdenv.targetPlatform); 195 + } // lib.optionalAttrs (attrs ? doInstallCheck) { 196 + # TODO(@Ericson2314): Make unconditional / resolve #33599 197 + doInstallCheck = doInstallCheck && (stdenv.hostPlatform == stdenv.targetPlatform); 198 + }); 199 200 # The meta attribute is passed in the resulting attribute set, 201 # but it's not part of the actual derivation, i.e., it's not
+1 -1
pkgs/tools/system/ddrescue/default.nix
··· 15 16 nativeBuildInputs = [ lzip ]; 17 18 - doCheck = hostPlatform == buildPlatform; 19 configureFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ]; 20 21 meta = with stdenv.lib; {
··· 15 16 nativeBuildInputs = [ lzip ]; 17 18 + doCheck = true; # not cross; 19 configureFlags = [ "CXX=${stdenv.cc.targetPrefix}c++" ]; 20 21 meta = with stdenv.lib; {
+1 -1
pkgs/tools/text/gnupatch/default.nix
··· 17 "ac_cv_func_strnlen_working=yes" 18 ]; 19 20 - doCheck = hostPlatform == buildPlatform; 21 22 meta = { 23 description = "GNU Patch, a program to apply differences to files";
··· 17 "ac_cv_func_strnlen_working=yes" 18 ]; 19 20 + doCheck = true; # not cross; 21 22 meta = { 23 description = "GNU Patch, a program to apply differences to files";