diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2018-01-08 01:33:35 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2018-01-09 12:37:12 -0500 |
commit | 4e907dbca19d4b1ab6b110c7e68f88a539df7c97 (patch) | |
tree | 10e75d40dfaaae0882d8bf1003c1c09d2afb566e | |
parent | b2cbffae6468c34f3c315bc40aa6df4483309f00 (diff) | |
download | nixpkgs-4e907dbca19d4b1ab6b110c7e68f88a539df7c97.tar nixpkgs-4e907dbca19d4b1ab6b110c7e68f88a539df7c97.tar.gz nixpkgs-4e907dbca19d4b1ab6b110c7e68f88a539df7c97.tar.bz2 nixpkgs-4e907dbca19d4b1ab6b110c7e68f88a539df7c97.tar.lz nixpkgs-4e907dbca19d4b1ab6b110c7e68f88a539df7c97.tar.xz nixpkgs-4e907dbca19d4b1ab6b110c7e68f88a539df7c97.tar.zst nixpkgs-4e907dbca19d4b1ab6b110c7e68f88a539df7c97.zip |
stdenv: Force `doCheck` and `doInstallCheck` to be false when we are cross compiling
I hope this will be a temporary measure. If there is consensus around issue #33599, then we can follow an explicit `dontCheck`, but default to not checking during cross builds when none is given.
-rw-r--r-- | doc/stdenv.xml | 29 | ||||
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 19 |
2 files changed, 33 insertions, 15 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/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 |