summary refs log tree commit diff
path: root/pkgs/test/stdenv/gcc-stageCompare.nix
blob: e5c2ed5921b307d7bd7cf9848e6fb01257bf0d05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# This test *must* be run prior to releasing any build of either stdenv or the
# gcc that it exports!  This check should also be part of CI for any PR that
# causes a rebuild of `stdenv.cc`.
#
# When we used gcc's internal bootstrap it did this check as part of (and
# serially with) the gcc derivation.  Now that we bootstrap externally this
# check can be done in parallel with any/all of stdenv's referrers.  But we
# must remember to do the check.
#

{ stdenv
, pkgs
, lib
}:

assert stdenv.cc.isGNU;
with pkgs;
# rebuild gcc using the "final" stdenv
let gcc-stageCompare = (gcc-unwrapped.override {
      reproducibleBuild = true;
      profiledCompiler = false;
      stdenv = overrideCC stdenv (wrapCCWith {
        cc = stdenv.cc;
      });
    }).overrideAttrs(_: {
      NIX_OUTPATH_USED_AS_RANDOM_SEED = stdenv.cc.cc.out;
    });
in (runCommand "gcc-stageCompare" {} ''
  diff -sr ${pkgs.gcc-unwrapped.checksum}/checksums ${gcc-stageCompare.checksum}/checksums && touch $out
'').overrideAttrs (a: {
  meta = (a.meta or { }) // { platforms = lib.platforms.linux; };
})