From bf76456a65728feb7fec48a734f35c3c09d20522 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 12 Sep 2021 13:13:19 +0100 Subject: [PATCH] ghostscript: add passthru.tests.test-corpus-render this simply attempts rendering every ps/eps/pdf file in the ghostscript test corpus (cherry picked from commit 57692f6d3e48766a7c50fa00f6157ece953595ca) --- pkgs/misc/ghostscript/default.nix | 4 ++- pkgs/misc/ghostscript/test-corpus-render.nix | 38 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 pkgs/misc/ghostscript/test-corpus-render.nix diff --git a/pkgs/misc/ghostscript/default.nix b/pkgs/misc/ghostscript/default.nix index 760ec2bc053..512b0cf9ede 100644 --- a/pkgs/misc/ghostscript/default.nix +++ b/pkgs/misc/ghostscript/default.nix @@ -1,6 +1,6 @@ { config, stdenv, lib, fetchurl, pkg-config, zlib, expat, openssl, autoconf , libjpeg, libpng, libtiff, freetype, fontconfig, libpaper, jbig2dec -, libiconv, ijs, lcms2, fetchpatch +, libiconv, ijs, lcms2, fetchpatch, callPackage , cupsSupport ? config.ghostscript.cups or (!stdenv.isDarwin), cups ? null , x11Support ? cupsSupport, xlibsWrapper ? null # with CUPS, X11 only adds very little }: @@ -119,6 +119,8 @@ stdenv.mkDerivation rec { runHook postInstallCheck ''; + passthru.tests.test-corpus-render = callPackage ./test-corpus-render.nix {}; + meta = { homepage = "https://www.ghostscript.com/"; description = "PostScript interpreter (mainline version)"; diff --git a/pkgs/misc/ghostscript/test-corpus-render.nix b/pkgs/misc/ghostscript/test-corpus-render.nix new file mode 100644 index 00000000000..544392090ff --- /dev/null +++ b/pkgs/misc/ghostscript/test-corpus-render.nix @@ -0,0 +1,38 @@ +{ lib +, stdenv +, fetchgit +, ghostscript +}: + +stdenv.mkDerivation { + pname = "ghostscript-test-corpus-render"; + version = "unstable-2020-02-19"; + + src = fetchgit { + url = "git://git.ghostscript.com/tests.git"; + rev = "efdd224340d9a407ed3ec22afa1cb127c8fee73c"; + sha256 = "1v1iqz897zzrwa8ng22zcf3y61ab5798jdwidgv10w1r9mjrl7ax"; + }; + + dontConfigure = true; + dontBuild = true; + + doCheck = true; + checkPhase = '' + find . -iregex '.*\.\(ps\|eps\|pdf\)' | while read f; do + echo "Rendering $f" + ${ghostscript}/bin/gs \ + -dNOPAUSE \ + -dBATCH \ + -sDEVICE=bitcmyk \ + -sOutputFile=/dev/null \ + -r600 \ + -dBufferSpace=100000 \ + $f + done + ''; + + installPhase = '' + touch $out + ''; +}