about summary refs log tree commit diff
path: root/nixpkgs/pkgs/test
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-06-22 15:01:47 +0000
committerAlyssa Ross <hi@alyssa.is>2021-06-22 16:57:59 +0000
commit633cab0ecb07627706c6b523e219490f019eaab5 (patch)
tree4fb472bdfe2723037dad53dc1b8a87c939015f5e /nixpkgs/pkgs/test
parentffb691c199e7e0cbc4e45e5310779c9e3f7c2a73 (diff)
parent432fc2d9a67f92e05438dff5fdc2b39d33f77997 (diff)
downloadnixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar
nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.gz
nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.bz2
nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.lz
nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.xz
nixlib-633cab0ecb07627706c6b523e219490f019eaab5.tar.zst
nixlib-633cab0ecb07627706c6b523e219490f019eaab5.zip
Merge commit '432fc2d9a67f92e05438dff5fdc2b39d33f77997'
# Conflicts:
#	nixpkgs/pkgs/applications/editors/emacs/elisp-packages/elpa-generated.nix
#	nixpkgs/pkgs/applications/networking/mailreaders/thunderbird/default.nix
#	nixpkgs/pkgs/applications/window-managers/sway/default.nix
#	nixpkgs/pkgs/build-support/rust/default.nix
#	nixpkgs/pkgs/development/go-modules/generic/default.nix
Diffstat (limited to 'nixpkgs/pkgs/test')
-rw-r--r--nixpkgs/pkgs/test/default.nix6
-rw-r--r--nixpkgs/pkgs/test/haskell/default.nix7
-rw-r--r--nixpkgs/pkgs/test/haskell/documentationTarball/default.nix (renamed from nixpkgs/pkgs/test/haskell-documentationTarball/default.nix)0
-rw-r--r--nixpkgs/pkgs/test/haskell/setBuildTarget/Bar.hs4
-rw-r--r--nixpkgs/pkgs/test/haskell/setBuildTarget/Foo.hs4
-rw-r--r--nixpkgs/pkgs/test/haskell/setBuildTarget/Setup.hs2
-rw-r--r--nixpkgs/pkgs/test/haskell/setBuildTarget/default.nix38
-rw-r--r--nixpkgs/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal16
-rw-r--r--nixpkgs/pkgs/test/haskell/shellFor/default.nix (renamed from nixpkgs/pkgs/test/haskell-shellFor/default.nix)10
-rw-r--r--nixpkgs/pkgs/test/rust-sysroot/default.nix2
-rw-r--r--nixpkgs/pkgs/test/texlive/default.nix113
-rw-r--r--nixpkgs/pkgs/test/vim/default.nix25
12 files changed, 146 insertions, 81 deletions
diff --git a/nixpkgs/pkgs/test/default.nix b/nixpkgs/pkgs/test/default.nix
index b24fc539c93d..8c9e7b6f2813 100644
--- a/nixpkgs/pkgs/test/default.nix
+++ b/nixpkgs/pkgs/test/default.nix
@@ -22,8 +22,7 @@ with pkgs;
   cc-wrapper-libcxx-9 = callPackage ./cc-wrapper { stdenv = llvmPackages_9.libcxxStdenv; };
   stdenv-inputs = callPackage ./stdenv-inputs { };
 
-  haskell-shellFor = callPackage ./haskell-shellFor { };
-  haskell-documentationTarball = callPackage ./haskell-documentationTarball { };
+  haskell = callPackage ./haskell { };
 
   cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; };
   cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; };
@@ -40,6 +39,7 @@ with pkgs;
 
   rustCustomSysroot = callPackage ./rust-sysroot {};
   buildRustCrate = callPackage ../build-support/rust/build-rust-crate/test { };
+  importCargoLock = callPackage ../build-support/rust/test/import-cargo-lock { };
 
   vim = callPackage ./vim {};
 
@@ -51,5 +51,7 @@ with pkgs;
 
   cuda = callPackage ./cuda { };
 
+  trivial = callPackage ../build-support/trivial-builders/test.nix {};
+
   writers = callPackage ../build-support/writers/test.nix {};
 }
diff --git a/nixpkgs/pkgs/test/haskell/default.nix b/nixpkgs/pkgs/test/haskell/default.nix
new file mode 100644
index 000000000000..eb389f4051f8
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/default.nix
@@ -0,0 +1,7 @@
+{ lib, callPackage }:
+
+lib.recurseIntoAttrs {
+  shellFor = callPackage ./shellFor { };
+  documentationTarball = callPackage ./documentationTarball { };
+  setBuildTarget = callPackage ./setBuildTarget { };
+}
diff --git a/nixpkgs/pkgs/test/haskell-documentationTarball/default.nix b/nixpkgs/pkgs/test/haskell/documentationTarball/default.nix
index aec3dc41f268..aec3dc41f268 100644
--- a/nixpkgs/pkgs/test/haskell-documentationTarball/default.nix
+++ b/nixpkgs/pkgs/test/haskell/documentationTarball/default.nix
diff --git a/nixpkgs/pkgs/test/haskell/setBuildTarget/Bar.hs b/nixpkgs/pkgs/test/haskell/setBuildTarget/Bar.hs
new file mode 100644
index 000000000000..010014082c7d
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/setBuildTarget/Bar.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Bar!"
diff --git a/nixpkgs/pkgs/test/haskell/setBuildTarget/Foo.hs b/nixpkgs/pkgs/test/haskell/setBuildTarget/Foo.hs
new file mode 100644
index 000000000000..fec7bb11fe6c
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/setBuildTarget/Foo.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Foo!"
diff --git a/nixpkgs/pkgs/test/haskell/setBuildTarget/Setup.hs b/nixpkgs/pkgs/test/haskell/setBuildTarget/Setup.hs
new file mode 100644
index 000000000000..9a994af677b0
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/setBuildTarget/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/nixpkgs/pkgs/test/haskell/setBuildTarget/default.nix b/nixpkgs/pkgs/test/haskell/setBuildTarget/default.nix
new file mode 100644
index 000000000000..b1335e2a74cf
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/setBuildTarget/default.nix
@@ -0,0 +1,38 @@
+{ pkgs, haskellPackages }:
+
+let
+  # This can be regenerated by running `cabal2nix .` in the current directory.
+  pkgDef =
+    { mkDerivation, base, lib }:
+      mkDerivation {
+        pname = "haskell-setBuildTarget";
+        version = "0.1.0.0";
+        src = ./.;
+        isLibrary = false;
+        isExecutable = true;
+        executableHaskellDepends = [ base ];
+        license = lib.licenses.bsd3;
+      };
+
+  drv = haskellPackages.callPackage pkgDef {};
+
+  test  = target: excluded:
+    let only = pkgs.haskell.lib.setBuildTarget drv target;
+    in ''
+         if [[ ! -f "${only}/bin/${target}" ]]; then
+           echo "${target} was not built"
+           exit 1
+         fi
+
+         if [[ -f "${only}/bin/${excluded}" ]]; then
+           echo "${excluded} was built, when it should not have been"
+           exit 1
+         fi
+     '';
+
+in pkgs.runCommand "test haskell.lib.setBuildTarget" {} ''
+  ${test "foo" "bar"}
+  ${test "bar" "foo"}
+  touch "$out"
+''
+
diff --git a/nixpkgs/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal b/nixpkgs/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal
new file mode 100644
index 000000000000..7395e139451c
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal
@@ -0,0 +1,16 @@
+cabal-version:       >=1.10
+name:                haskell-setBuildTarget
+version:             0.1.0.0
+author:              Isaac Shapira
+maintainer:          fresheyeball@protonmail.com
+build-type:          Simple
+
+executable foo
+  main-is:             Foo.hs
+  build-depends:       base
+  default-language:    Haskell2010
+
+executable bar
+  main-is:             Bar.hs
+  build-depends:       base
+  default-language:    Haskell2010
diff --git a/nixpkgs/pkgs/test/haskell-shellFor/default.nix b/nixpkgs/pkgs/test/haskell/shellFor/default.nix
index 9d13e1112cc1..37ad2e90d89e 100644
--- a/nixpkgs/pkgs/test/haskell-shellFor/default.nix
+++ b/nixpkgs/pkgs/test/haskell/shellFor/default.nix
@@ -1,22 +1,22 @@
-{ lib, haskellPackages, cabal-install }:
+{ lib, writeText, haskellPackages, cabal-install }:
 
 (haskellPackages.shellFor {
-  packages = p: [ p.database-id-class p.constraints ];
+  packages = p: [ p.constraints p.linear ];
   nativeBuildInputs = [ cabal-install ];
   phases = [ "unpackPhase" "buildPhase" "installPhase" ];
   unpackPhase = ''
     sourceRoot=$(pwd)/scratch
     mkdir -p "$sourceRoot"
     cd "$sourceRoot"
-    tar -xf ${haskellPackages.database-id-class.src}
     tar -xf ${haskellPackages.constraints.src}
-    cp ${builtins.toFile "cabal.project" "packages: database-id-class* constraints*"} cabal.project
+    tar -xf ${haskellPackages.linear.src}
+    cp ${writeText "cabal.project" "packages: constraints* linear*"} cabal.project
   '';
   buildPhase = ''
     export HOME=$(mktemp -d)
     mkdir -p $HOME/.cabal
     touch $HOME/.cabal/config
-    cabal v2-build --offline --verbose database-id-class constraints --ghc-options="-O0 -j$NIX_BUILD_CORES"
+    cabal v2-build --offline --verbose constraints linear --ghc-options="-O0 -j$NIX_BUILD_CORES"
   '';
   installPhase = ''
     touch $out
diff --git a/nixpkgs/pkgs/test/rust-sysroot/default.nix b/nixpkgs/pkgs/test/rust-sysroot/default.nix
index 3a786ad6f00b..a5a1596504f9 100644
--- a/nixpkgs/pkgs/test/rust-sysroot/default.nix
+++ b/nixpkgs/pkgs/test/rust-sysroot/default.nix
@@ -11,7 +11,7 @@ let
         sha256 = "0k9ipm9ddm1bad7bs7368wzzp6xwrhyfzfpckdax54l4ffqwljcg";
     };
 
-    cargoSha256 = "1cbcplgz28yxshyrp2krp1jphbrcqdw6wxx3rry91p7hiqyibd30";
+    cargoSha256 = "1x8iwgy1irgfkv2yjkxm6479nwbrk82b0c80jm7y4kw0s32r01lg";
 
     inherit target;
 
diff --git a/nixpkgs/pkgs/test/texlive/default.nix b/nixpkgs/pkgs/test/texlive/default.nix
index 7a6affd6cbe0..d8420d991369 100644
--- a/nixpkgs/pkgs/test/texlive/default.nix
+++ b/nixpkgs/pkgs/test/texlive/default.nix
@@ -1,4 +1,4 @@
-{ runCommandNoCC, fetchurl, file, texlive, writeShellScript }:
+{ lib, runCommandNoCC, fetchurl, file, texlive, writeShellScript }:
 
 {
   chktex = runCommandNoCC "texlive-test-chktex" {
@@ -16,68 +16,69 @@
     grep "One warning printed" "$out"
   '';
 
-  # https://github.com/NixOS/nixpkgs/issues/75605
-  dvipng.basic = runCommandNoCC "texlive-test-dvipng-basic" {
-    nativeBuildInputs = [ file texlive.combined.scheme-medium ];
-    input = fetchurl {
-      name = "test_dvipng.tex";
-      url = "http://git.savannah.nongnu.org/cgit/dvipng.git/plain/test_dvipng.tex?id=b872753590a18605260078f56cbd6f28d39dc035";
-      sha256 = "1pjpf1jvwj2pv5crzdgcrzvbmn7kfmgxa39pcvskl4pa0c9hl88n";
-    };
-  } ''
-    cp "$input" ./document.tex
-
-    latex document.tex
-    dvipng -T tight -strict -picky document.dvi
-    for f in document*.png; do
-      file "$f" | tee output
-      grep PNG output
-    done
+  dvipng = lib.recurseIntoAttrs {
+    # https://github.com/NixOS/nixpkgs/issues/75605
+    basic = runCommandNoCC "texlive-test-dvipng-basic" {
+      nativeBuildInputs = [ file texlive.combined.scheme-medium ];
+      input = fetchurl {
+        name = "test_dvipng.tex";
+        url = "http://git.savannah.nongnu.org/cgit/dvipng.git/plain/test_dvipng.tex?id=b872753590a18605260078f56cbd6f28d39dc035";
+        sha256 = "1pjpf1jvwj2pv5crzdgcrzvbmn7kfmgxa39pcvskl4pa0c9hl88n";
+      };
+    } ''
+      cp "$input" ./document.tex
 
-    mkdir "$out"
-    mv document*.png "$out"/
-  '';
+      latex document.tex
+      dvipng -T tight -strict -picky document.dvi
+      for f in document*.png; do
+        file "$f" | tee output
+        grep PNG output
+      done
 
-  # test dvipng's limited capability to render postscript specials via GS
-  dvipng.ghostscript = runCommandNoCC "texlive-test-ghostscript" {
-    nativeBuildInputs = [ file (with texlive; combine { inherit scheme-small dvipng; }) ];
-    input = builtins.toFile "postscript-sample.tex" ''
-      \documentclass{minimal}
-      \begin{document}
-        Ni
-        \special{ps:
-          newpath
-          0 0 moveto
-          7 7 rlineto
-          0 7 moveto
-          7 -7 rlineto
-          stroke
-          showpage
-        }
-      \end{document}
-    '';
-    gs_trap = writeShellScript "gs_trap.sh" ''
-      exit 1
+      mkdir "$out"
+      mv document*.png "$out"/
     '';
-  } ''
-    cp "$gs_trap" ./gs
-    export PATH=$PWD:$PATH
-    # check that the trap works
-    gs && exit 1
 
-    cp "$input" ./document.tex
+    # test dvipng's limited capability to render postscript specials via GS
+    ghostscript = runCommandNoCC "texlive-test-ghostscript" {
+      nativeBuildInputs = [ file (with texlive; combine { inherit scheme-small dvipng; }) ];
+      input = builtins.toFile "postscript-sample.tex" ''
+        \documentclass{minimal}
+        \begin{document}
+          Ni
+          \special{ps:
+            newpath
+            0 0 moveto
+            7 7 rlineto
+            0 7 moveto
+            7 -7 rlineto
+            stroke
+            showpage
+          }
+        \end{document}
+      '';
+      gs_trap = writeShellScript "gs_trap.sh" ''
+        exit 1
+      '';
+    } ''
+      cp "$gs_trap" ./gs
+      export PATH=$PWD:$PATH
+      # check that the trap works
+      gs && exit 1
 
-    latex document.tex
-    dvipng -T 1in,1in -strict -picky document.dvi
-    for f in document*.png; do
-      file "$f" | tee output
-      grep PNG output
-    done
+      cp "$input" ./document.tex
 
-    mkdir "$out"
-    mv document*.png "$out"/
-  '';
+      latex document.tex
+      dvipng -T 1in,1in -strict -picky document.dvi
+      for f in document*.png; do
+        file "$f" | tee output
+        grep PNG output
+      done
 
+      mkdir "$out"
+      mv document*.png "$out"/
+    '';
+  };
 
   # https://github.com/NixOS/nixpkgs/issues/75070
   dvisvgm = runCommandNoCC "texlive-test-dvisvgm" {
diff --git a/nixpkgs/pkgs/test/vim/default.nix b/nixpkgs/pkgs/test/vim/default.nix
index 4ca004a60c34..cb3953a63f52 100644
--- a/nixpkgs/pkgs/test/vim/default.nix
+++ b/nixpkgs/pkgs/test/vim/default.nix
@@ -1,14 +1,18 @@
-{ vimUtils, vim_configurable, neovim, vimPlugins
-, lib, fetchFromGitHub,
+{ vimUtils, vim_configurable, writeText, vimPlugins
+, lib, fetchFromGitHub
+, pkgs
 }:
 let
   inherit (vimUtils) buildVimPluginFrom2Nix;
 
   packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
+
 in
-{
+  pkgs.recurseIntoAttrs (rec {
   vim_empty_config = vimUtils.vimrcFile { beforePlugins = ""; customRC = ""; };
 
+  ### vim tests
+  ##################
   vim_with_vim2nix = vim_configurable.customize {
     name = "vim"; vimrcConfig.vam.pluginDictionaries = [ "vim-addon-vim2nix" ];
   };
@@ -34,11 +38,6 @@ in
     vimrcConfig.packages.myVimPackage.start = with vimPlugins; [ vim-nix ];
   };
 
-  # only neovim makes use of `requiredPlugins`, test this here
-  test_nvim_with_vim_nix_using_pathogen = neovim.override {
-    configure.pathogen.pluginNames = [ "vim-nix" ];
-  };
-
   # regression test for https://github.com/NixOS/nixpkgs/issues/53112
   # The user may have specified their own plugins which may not be formatted
   # exactly as the generated ones. In particular, they may not have the `pname`
@@ -61,12 +60,4 @@ in
       });
     vimrcConfig.vam.pluginDictionaries = [ { names = [ "vim-trailing-whitespace" ]; } ];
   };
-
-  # system remote plugin manifest should be generated, deoplete should be usable
-  # without the user having to do `UpdateRemotePlugins`. To test, launch neovim
-  # and do `:call deoplete#enable()`. It will print an error if the remote
-  # plugin is not registered.
-  test_nvim_with_remote_plugin = neovim.override {
-    configure.pathogen.pluginNames = with vimPlugins; [ deoplete-nvim ];
-  };
-}
+})