summaryrefslogtreecommitdiff
path: root/pkgs/test
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2021-05-24 09:55:24 -0500
committerRobin Gloster <mail@glob.in>2021-05-24 09:55:24 -0500
commit4bc5fbef9d159e143fb7e2c3231932e6e76f667c (patch)
treee2198f5c552e0667d838b8ec764ddb3a4d8f6dec /pkgs/test
parentjq: fix build with structured-attrs on darwin (diff)
parentMerge pull request #123802 from superherointj/package-virtmanager-bugfix (diff)
downloadnixpkgs-origin/structured-attrs.tar.gz
Merge remote-tracking branch 'upstream/master' into structured-attrsorigin/structured-attrs
Diffstat (limited to 'pkgs/test')
-rw-r--r--pkgs/test/default.nix5
-rw-r--r--pkgs/test/haskell/default.nix7
-rw-r--r--pkgs/test/haskell/documentationTarball/default.nix (renamed from pkgs/test/haskell-documentationTarball/default.nix)0
-rw-r--r--pkgs/test/haskell/setBuildTarget/Bar.hs4
-rw-r--r--pkgs/test/haskell/setBuildTarget/Foo.hs4
-rw-r--r--pkgs/test/haskell/setBuildTarget/Setup.hs2
-rw-r--r--pkgs/test/haskell/setBuildTarget/default.nix38
-rw-r--r--pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal16
-rw-r--r--pkgs/test/haskell/shellFor/default.nix (renamed from pkgs/test/haskell-shellFor/default.nix)10
-rw-r--r--pkgs/test/texlive/default.nix113
10 files changed, 136 insertions, 63 deletions
diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix
index b24fc539c93d..b9f05bdff8d0 100644
--- a/pkgs/test/default.nix
+++ b/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; };
@@ -51,5 +50,7 @@ with pkgs;
cuda = callPackage ./cuda { };
+ trivial = callPackage ../build-support/trivial-builders/test.nix {};
+
writers = callPackage ../build-support/writers/test.nix {};
}
diff --git a/pkgs/test/haskell/default.nix b/pkgs/test/haskell/default.nix
new file mode 100644
index 000000000000..eb389f4051f8
--- /dev/null
+++ b/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/pkgs/test/haskell-documentationTarball/default.nix b/pkgs/test/haskell/documentationTarball/default.nix
index aec3dc41f268..aec3dc41f268 100644
--- a/pkgs/test/haskell-documentationTarball/default.nix
+++ b/pkgs/test/haskell/documentationTarball/default.nix
diff --git a/pkgs/test/haskell/setBuildTarget/Bar.hs b/pkgs/test/haskell/setBuildTarget/Bar.hs
new file mode 100644
index 000000000000..010014082c7d
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/Bar.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Bar!"
diff --git a/pkgs/test/haskell/setBuildTarget/Foo.hs b/pkgs/test/haskell/setBuildTarget/Foo.hs
new file mode 100644
index 000000000000..fec7bb11fe6c
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/Foo.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = putStrLn "Hello, Foo!"
diff --git a/pkgs/test/haskell/setBuildTarget/Setup.hs b/pkgs/test/haskell/setBuildTarget/Setup.hs
new file mode 100644
index 000000000000..9a994af677b0
--- /dev/null
+++ b/pkgs/test/haskell/setBuildTarget/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/pkgs/test/haskell/setBuildTarget/default.nix b/pkgs/test/haskell/setBuildTarget/default.nix
new file mode 100644
index 000000000000..b1335e2a74cf
--- /dev/null
+++ b/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/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal b/pkgs/test/haskell/setBuildTarget/haskell-setBuildTarget.cabal
new file mode 100644
index 000000000000..7395e139451c
--- /dev/null
+++ b/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/pkgs/test/haskell-shellFor/default.nix b/pkgs/test/haskell/shellFor/default.nix
index 9d13e1112cc1..37ad2e90d89e 100644
--- a/pkgs/test/haskell-shellFor/default.nix
+++ b/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/pkgs/test/texlive/default.nix b/pkgs/test/texlive/default.nix
index 7a6affd6cbe0..d8420d991369 100644
--- a/pkgs/test/texlive/default.nix
+++ b/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" {