From 8e25da0beb7d5c1af2d8de053044ab7b2588a0bd Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 25 Feb 2019 22:54:40 -0500 Subject: [PATCH] cross/tests: add llvm-based tests --- lib/systems/default.nix | 2 +- pkgs/test/cross/default.nix | 46 ++++++++++++++++++++----------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/lib/systems/default.nix b/lib/systems/default.nix index e4629fc9bf80..b3f7363fe612 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -101,7 +101,7 @@ rec { in if final.parsed.kernel.name == pkgs.stdenv.hostPlatform.parsed.kernel.name && pkgs.stdenv.hostPlatform.isCompatible final - then pkgs.runtimeShell + then "${pkgs.runtimeShell} -c" else if final.isWindows then "${wine}/bin/${wine-name}" else if final.isLinux && pkgs.stdenv.hostPlatform.isLinux diff --git a/pkgs/test/cross/default.nix b/pkgs/test/cross/default.nix index a907b9e2d45b..5d9c120c501a 100644 --- a/pkgs/test/cross/default.nix +++ b/pkgs/test/cross/default.nix @@ -53,10 +53,10 @@ let fi ''; - mapMultiPlatformTest = test: lib.mapAttrs (name: system: test rec { + mapMultiPlatformTest = crossSystemFun: test: lib.mapAttrs (name: system: test rec { crossPkgs = import pkgs.path { localSystem = { inherit (pkgs.hostPlatform) config; }; - crossSystem = system; + crossSystem = crossSystemFun system; }; emulator = crossPkgs.hostPlatform.emulator pkgs; @@ -71,26 +71,30 @@ let } else pkg; }) testedSystems; -in + tests = { -lib.mapAttrs (_: mapMultiPlatformTest) { + file = {platformFun, crossPkgs, emulator}: compareTest { + inherit emulator crossPkgs; + hostPkgs = pkgs; + exec = "/bin/file"; + args = [ + "${pkgs.file}/share/man/man1/file.1.gz" + "${pkgs.dejavu_fonts}/share/fonts/truetype/DejaVuMathTeXGyre.ttf" + ]; + pkgFun = pkgs: platformFun pkgs.file; + }; + + hello = {platformFun, crossPkgs, emulator}: compareTest { + inherit emulator crossPkgs; + hostPkgs = pkgs; + exec = "/bin/hello"; + pkgFun = pkgs: pkgs.hello; + }; - file = {platformFun, crossPkgs, emulator}: compareTest { - inherit emulator crossPkgs; - hostPkgs = pkgs; - exec = "/bin/file"; - args = [ - "${pkgs.file}/share/man/man1/file.1.gz" - "${pkgs.dejavu_fonts}/share/fonts/truetype/DejaVuMathTeXGyre.ttf" - ]; - pkgFun = pkgs: platformFun pkgs.file; }; - hello = {platformFun, crossPkgs, emulator}: compareTest { - inherit emulator crossPkgs; - hostPkgs = pkgs; - exec = "/bin/hello"; - pkgFun = pkgs: pkgs.hello; - }; - -} +in (lib.mapAttrs (_: mapMultiPlatformTest builtins.id) tests) +// (lib.mapAttrs' (name: test: { + name = "${name}-llvm"; + value = mapMultiPlatformTest (system: system // {useLLVM = true;}) test; + }) tests)