Skip to content

Commit

Permalink
tests.cc-wrapper: add supported and move tests to subsets
Browse files Browse the repository at this point in the history
filter out llvmPackages <=10 on aarch64-darwin, they're marked broken
and availableOn doesn't filter broken packages
  • Loading branch information
Artturin committed Sep 8, 2023
1 parent bcd62ff commit 2d15039
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions pkgs/test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ with pkgs;
libcxx = callPackage ./cc-wrapper { stdenv = pkgs.${name}.libcxxStdenv; };
});
in
recurseIntoAttrs tests;
tests;
gccTests = let
pkgSets = lib.pipe (attrNames pkgs) ([
(filter (lib.hasPrefix "gcc"))
Expand All @@ -32,7 +32,55 @@ with pkgs;
in lib.genAttrs pkgSets (name: callPackage ./cc-wrapper { stdenv = pkgs.${name}; });
in recurseIntoAttrs {
default = callPackage ./cc-wrapper { };
} // llvmTests // gccTests;

supported = stdenv.mkDerivation {
name = "cc-wrapper-supported";
builtGCC =
let
names = lib.pipe (attrNames gccTests) ([
(filter (n: lib.meta.availableOn stdenv.hostPlatform pkgs.${n}.cc))
# Broken
(filter (n: n != "gcc49Stdenv"))
(filter (n: n != "gccMultiStdenv"))
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
# fails with things like
# ld: warning: ld: warning: object file (trunctfsf2_s.o) was built for newer macOS version (11.0) than being linked (10.5)
# ld: warning: ld: warning: could not create compact unwind for ___fixunstfdi: register 20 saved somewhere other than in frame
(filter (n: n != "gcc11Stdenv"))
]);
in
toJSON (lib.genAttrs names (name: { name = pkgs.${name}; }));

builtLLVM =
let
names = lib.pipe (attrNames llvmTests) ([
(filter (n: lib.meta.availableOn stdenv.hostPlatform pkgs.${n}.stdenv.cc))
(filter (n: lib.meta.availableOn stdenv.hostPlatform pkgs.${n}.libcxxStdenv.cc))

# libcxxStdenv broken
# fix in https://github.com/NixOS/nixpkgs/pull/216273
(filter (n: n != "llvmPackages_15"))
] ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
# libcxx does not build for some reason on aarch64-linux
(filter (n: n != "llvmPackages_7"))
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
(filter (n: n != "llvmPackages_5"))
(filter (n: n != "llvmPackages_6"))
(filter (n: n != "llvmPackages_7"))
(filter (n: n != "llvmPackages_8"))
(filter (n: n != "llvmPackages_9"))
(filter (n: n != "llvmPackages_10"))
]);
in
toJSON (lib.genAttrs names (name: { stdenv = pkgs.${name}.stdenv; libcxx = pkgs.${name}.libcxxStdenv; }));
buildCommand = ''
touch $out
'';
};

llvmTests = recurseIntoAttrs llvmTests;
inherit gccTests;
};

stdenv-inputs = callPackage ./stdenv-inputs { };
stdenv = callPackage ./stdenv { };
Expand Down

0 comments on commit 2d15039

Please sign in to comment.