diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-04-09 18:28:16 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-04-12 18:46:15 +0000 |
commit | fd2e737e0678ee7d8081baef05b305146a2c0034 (patch) | |
tree | ac3e9b27576a0382335532d126f9a66d486bc638 /nixpkgs/pkgs/test | |
parent | cc207d720b6aa836e256c1ee9842bc739e630a8a (diff) | |
parent | 9e377a6ce42dccd9b624ae4ce8f978dc892ba0e2 (diff) | |
download | nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.gz nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.bz2 nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.lz nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.xz nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.zst nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.zip |
Merge remote-tracking branch 'nixpkgs/nixos-unstable'
Diffstat (limited to 'nixpkgs/pkgs/test')
-rw-r--r-- | nixpkgs/pkgs/test/cuda/cuda-library-samples/default.nix | 42 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix | 70 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/cuda/cuda-samples/default.nix | 52 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix | 51 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/cuda/default.nix | 26 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/default.nix | 2 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/patch-shebangs/default.nix | 76 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/texlive/default.nix | 45 |
8 files changed, 346 insertions, 18 deletions
diff --git a/nixpkgs/pkgs/test/cuda/cuda-library-samples/default.nix b/nixpkgs/pkgs/test/cuda/cuda-library-samples/default.nix new file mode 100644 index 000000000000..91095fbd3ac4 --- /dev/null +++ b/nixpkgs/pkgs/test/cuda/cuda-library-samples/default.nix @@ -0,0 +1,42 @@ +{ callPackage +, cudatoolkit_10_1, cudatoolkit_10_2 +, cudatoolkit_11_0, cudatoolkit_11_1, cudatoolkit_11_2 +, cutensor_cudatoolkit_10_1, cutensor_cudatoolkit_10_2 +, cutensor_cudatoolkit_11_0, cutensor_cudatoolkit_11_1, cutensor_cudatoolkit_11_2 +}: + +rec { + + cuda-library-samples_cudatoolkit_10_1 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_10_1; + cutensor_cudatoolkit = cutensor_cudatoolkit_10_1; + }; + + cuda-library-samples_cudatoolkit_10_2 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_10_2; + cutensor_cudatoolkit = cutensor_cudatoolkit_10_2; + }; + + cuda-library-samples_cudatoolkit_10 = + cuda-library-samples_cudatoolkit_10_2; + + ## + + cuda-library-samples_cudatoolkit_11_0 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_11_0; + cutensor_cudatoolkit = cutensor_cudatoolkit_11_0; + }; + + cuda-library-samples_cudatoolkit_11_1 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_11_1; + cutensor_cudatoolkit = cutensor_cudatoolkit_11_1; + }; + + cuda-library-samples_cudatoolkit_11_2 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_11_2; + cutensor_cudatoolkit = cutensor_cudatoolkit_11_2; + }; + + cuda-library-samples_cudatoolkit_11 = + cuda-library-samples_cudatoolkit_11_2; +} diff --git a/nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix b/nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix new file mode 100644 index 000000000000..f1ce243bfa6a --- /dev/null +++ b/nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix @@ -0,0 +1,70 @@ +{ lib, stdenv, fetchFromGitHub +, cmake, addOpenGLRunpath +, cudatoolkit +, cutensor_cudatoolkit +}: + +let + rev = "5aab680905d853bce0dbad4c488e4f7e9f7b2302"; + src = fetchFromGitHub { + owner = "NVIDIA"; + repo = "CUDALibrarySamples"; + inherit rev; + sha256 = "0gwgbkq05ygrfgg5hk07lmap7n7ampxv0ha1axrv8qb748ph81xs"; + }; + commonAttrs = { + version = lib.strings.substring 0 7 rev + "-" + lib.versions.majorMinor cudatoolkit.version; + nativeBuildInputs = [ cmake addOpenGLRunpath ]; + buildInputs = [ cudatoolkit ]; + enableParallelBuilding = true; + postFixup = '' + for exe in $out/bin/*; do + addOpenGLRunpath $exe + done + ''; + meta = { + description = "examples of using libraries using CUDA"; + longDescription = '' + CUDA Library Samples contains examples demonstrating the use of + features in the math and image processing libraries cuBLAS, cuTENSOR, + cuSPARSE, cuSOLVER, cuFFT, cuRAND, NPP and nvJPEG. + ''; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ obsidian-systems-maintenance ]; + }; + }; +in + +{ + cublas = stdenv.mkDerivation (commonAttrs // { + pname = "cuda-library-samples-cublas"; + + src = "${src}/cuBLASLt"; + }); + + cusolver = stdenv.mkDerivation (commonAttrs // { + pname = "cuda-library-samples-cusolver"; + + src = "${src}/cuSOLVER"; + + sourceRoot = "cuSOLVER/gesv"; + }); + + cutensor = stdenv.mkDerivation (commonAttrs // { + pname = "cuda-library-samples-cutensor"; + + src = "${src}/cuTENSOR"; + + cmakeFlags = [ + "-DCUTENSOR_EXAMPLE_BINARY_INSTALL_DIR=${builtins.placeholder "out"}/bin" + ]; + + # CUTENSOR_ROOT is double escaped + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace "\''${CUTENSOR_ROOT}/include" "${cutensor_cudatoolkit.dev}/include" + ''; + + CUTENSOR_ROOT = cutensor_cudatoolkit; + }); +} diff --git a/nixpkgs/pkgs/test/cuda/cuda-samples/default.nix b/nixpkgs/pkgs/test/cuda/cuda-samples/default.nix new file mode 100644 index 000000000000..46d4d531690d --- /dev/null +++ b/nixpkgs/pkgs/test/cuda/cuda-samples/default.nix @@ -0,0 +1,52 @@ +{ callPackage +, cudatoolkit_9_2 +, cudatoolkit_10_0, cudatoolkit_10_1, cudatoolkit_10_2 +, cudatoolkit_11_0, cudatoolkit_11_1, cudatoolkit_11_2 +}: + +rec { + cuda-samples_cudatoolkit_9_2 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_9_2; + sha256 = "1ydankhyigcg99h0rqnmz1z4vc0sl6p9s1s0hbdxh5l1sx9141j6"; + }; + + cuda-samples_cudatoolkit_9 = cuda-samples_cudatoolkit_9_2; + + ## + + cuda-samples_cudatoolkit_10_0 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_10_0; + sha256 = "1zvh4xsdyc59m87brpcmssxsjlp9dkynh4asnkcmc3g94f53l0jw"; + }; + + cuda-samples_cudatoolkit_10_1 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_10_1; + sha256 = "1s8ka0hznrni36ajhzf2gqpdrl8kd8fi047qijxks5l2abc093qd"; + }; + + cuda-samples_cudatoolkit_10_2 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_10_2; + sha256 = "01p1innzgh9siacpld6nsqimj8jkg93rk4gj8q4crn62pa5vhd94"; + }; + + cuda-samples_cudatoolkit_10 = cuda-samples_cudatoolkit_10_2; + + ## + + cuda-samples_cudatoolkit_11_0 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_11_0; + sha256 = "1n3vjc8c7zdig2xgl5fppavrphqzhdiv9m9nk6smh4f99fwi0705"; + }; + + cuda-samples_cudatoolkit_11_1 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_11_1; + sha256 = "1kjixk50i8y1bkiwbdn5lkv342crvkmbvy1xl5j3lsa1ica21kwh"; + }; + + cuda-samples_cudatoolkit_11_2 = callPackage ./generic.nix { + cudatoolkit = cudatoolkit_11_2; + sha256 = "1p1qjvfbm28l933mmnln02rqrf0cy9kbpsyb488d1haiqzvrazl1"; + }; + + cuda-samples_cudatoolkit_11 = cuda-samples_cudatoolkit_11_2; +} diff --git a/nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix b/nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix new file mode 100644 index 000000000000..2e3dcc8891f4 --- /dev/null +++ b/nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix @@ -0,0 +1,51 @@ +{ lib, stdenv, fetchFromGitHub +, pkg-config, addOpenGLRunpath +, sha256, cudatoolkit +}: + +let + pname = "cuda-samples"; + version = lib.versions.majorMinor cudatoolkit.version; +in + +stdenv.mkDerivation { + inherit pname version; + + src = fetchFromGitHub { + owner = "NVIDIA"; + repo = pname; + rev = "v${version}"; + inherit sha256; + }; + + nativeBuildInputs = [ pkg-config addOpenGLRunpath ]; + + buildInputs = [ cudatoolkit ]; + + enableParallelBuilding = true; + + preConfigure = '' + export CUDA_PATH=${cudatoolkit} + ''; + + installPhase = '' + runHook preInstall + + install -Dm755 -t $out/bin bin/${stdenv.hostPlatform.parsed.cpu.name}/${stdenv.hostPlatform.parsed.kernel.name}/release/* + + runHook postInstall + ''; + + postFixup = '' + for exe in $out/bin/*; do + addOpenGLRunpath $exe + done + ''; + + meta = { + description = "Samples for CUDA Developers which demonstrates features in CUDA Toolkit"; + # CUDA itself is proprietary, but these sample apps are not. + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ obsidian-systems-maintenance ]; + }; +} diff --git a/nixpkgs/pkgs/test/cuda/default.nix b/nixpkgs/pkgs/test/cuda/default.nix new file mode 100644 index 000000000000..9e7eaf8036a7 --- /dev/null +++ b/nixpkgs/pkgs/test/cuda/default.nix @@ -0,0 +1,26 @@ +{ callPackage }: + +rec { + cuda-samplesPackages = callPackage ./cuda-samples { }; + inherit (cuda-samplesPackages) + cuda-samples_cudatoolkit_9 + cuda-samples_cudatoolkit_9_2 + cuda-samples_cudatoolkit_10 + cuda-samples_cudatoolkit_10_0 + cuda-samples_cudatoolkit_10_1 + cuda-samples_cudatoolkit_10_2 + cuda-samples_cudatoolkit_11 + cuda-samples_cudatoolkit_11_0 + cuda-samples_cudatoolkit_11_1 + cuda-samples_cudatoolkit_11_2; + + cuda-library-samplesPackages = callPackage ./cuda-library-samples { }; + inherit (cuda-library-samplesPackages) + cuda-library-samples_cudatoolkit_10 + cuda-library-samples_cudatoolkit_10_1 + cuda-library-samples_cudatoolkit_10_2 + cuda-library-samples_cudatoolkit_11 + cuda-library-samples_cudatoolkit_11_0 + cuda-library-samples_cudatoolkit_11_1 + cuda-library-samples_cudatoolkit_11_2; +} diff --git a/nixpkgs/pkgs/test/default.nix b/nixpkgs/pkgs/test/default.nix index f45e981cff07..fa93ceb0721e 100644 --- a/nixpkgs/pkgs/test/default.nix +++ b/nixpkgs/pkgs/test/default.nix @@ -47,5 +47,7 @@ with pkgs; texlive = callPackage ./texlive {}; + cuda = callPackage ./cuda { }; + writers = callPackage ../build-support/writers/test.nix {}; } diff --git a/nixpkgs/pkgs/test/patch-shebangs/default.nix b/nixpkgs/pkgs/test/patch-shebangs/default.nix index 5e1d859c1389..5c49787eee3b 100644 --- a/nixpkgs/pkgs/test/patch-shebangs/default.nix +++ b/nixpkgs/pkgs/test/patch-shebangs/default.nix @@ -1,26 +1,70 @@ { lib, stdenv, runCommand }: let - bad-shebang = stdenv.mkDerivation { - name = "bad-shebang"; - dontUnpack = true; - installPhase = '' - mkdir -p $out/bin - echo "#!/bin/sh" > $out/bin/test - echo "echo -n hello" >> $out/bin/test - chmod +x $out/bin/test - ''; + tests = { + bad-shebang = stdenv.mkDerivation { + name = "bad-shebang"; + dontUnpack = true; + installPhase = '' + mkdir -p $out/bin + echo "#!/bin/sh" > $out/bin/test + echo "echo -n hello" >> $out/bin/test + chmod +x $out/bin/test + ''; + passthru = { + assertion = "grep -v '^#!/bin/sh' $out/bin/test > /dev/null"; + }; + }; + + ignores-nix-store = stdenv.mkDerivation { + name = "ignores-nix-store"; + dontUnpack = true; + installPhase = '' + mkdir -p $out/bin + echo "#!$NIX_STORE/path/to/sh" > $out/bin/test + echo "echo -n hello" >> $out/bin/test + chmod +x $out/bin/test + ''; + passthru = { + assertion = "grep \"^#!$NIX_STORE/path/to/sh\" $out/bin/test > /dev/null"; + }; + }; }; in runCommand "patch-shebangs-test" { - passthru = { inherit bad-shebang; }; + passthru = { inherit (tests) bad-shebang ignores-nix-store; }; meta.platforms = lib.platforms.all; } '' - printf "checking whether patchShebangs works properly... ">&2 - if ! grep -q '^#!/bin/sh' ${bad-shebang}/bin/test; then - echo "yes" >&2 - touch $out - else - echo "no" >&2 + validate() { + local name=$1 + local testout=$2 + local assertion=$3 + + echo -n "... $name: " >&2 + + local rc=0 + (out=$testout eval "$assertion") || rc=1 + + if [ "$rc" -eq 0 ]; then + echo "yes" >&2 + else + echo "no" >&2 + fi + + return "$rc" + } + + echo "checking whether patchShebangs works properly... ">&2 + + fail= + ${lib.concatStringsSep "\n" (lib.mapAttrsToList (_: test: '' + validate "${test.name}" "${test}" ${lib.escapeShellArg test.assertion} || fail=1 + '') tests)} + + if [ "$fail" ]; then + echo "failed" exit 1 + else + echo "succeeded" + touch $out fi '' diff --git a/nixpkgs/pkgs/test/texlive/default.nix b/nixpkgs/pkgs/test/texlive/default.nix index 30d0026c848d..7a6affd6cbe0 100644 --- a/nixpkgs/pkgs/test/texlive/default.nix +++ b/nixpkgs/pkgs/test/texlive/default.nix @@ -1,4 +1,4 @@ -{ runCommandNoCC, fetchurl, file, texlive }: +{ runCommandNoCC, fetchurl, file, texlive, writeShellScript }: { chktex = runCommandNoCC "texlive-test-chktex" { @@ -17,7 +17,7 @@ ''; # https://github.com/NixOS/nixpkgs/issues/75605 - dvipng = runCommandNoCC "texlive-test-dvipng" { + dvipng.basic = runCommandNoCC "texlive-test-dvipng-basic" { nativeBuildInputs = [ file texlive.combined.scheme-medium ]; input = fetchurl { name = "test_dvipng.tex"; @@ -38,6 +38,47 @@ mv document*.png "$out"/ ''; + # 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 + ''; + } '' + cp "$gs_trap" ./gs + export PATH=$PWD:$PATH + # check that the trap works + gs && exit 1 + + cp "$input" ./document.tex + + 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" { nativeBuildInputs = [ file texlive.combined.scheme-medium ]; |