From a4e5e1edd1325c30992f3478696af86eb62c419d Mon Sep 17 00:00:00 2001 From: cwyc <16950437+cwyc@users.noreply.github.com> Date: Wed, 25 May 2022 13:37:46 +0000 Subject: [PATCH] added package test for gdk-pixbuf multiple file functionality will be squashed before merging --- .../libraries/gdk-pixbuf/default.nix | 2 + .../multiple-module-files-test/default.nix | 34 ++++++++ .../multiple-module-files-test/sample.svg | 79 +++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/default.nix create mode 100644 pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/sample.svg diff --git a/pkgs/development/libraries/gdk-pixbuf/default.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix index 24c8558c186e9..6f058718ab942 100644 --- a/pkgs/development/libraries/gdk-pixbuf/default.nix +++ b/pkgs/development/libraries/gdk-pixbuf/default.nix @@ -19,6 +19,7 @@ , doCheck ? false , makeWrapper , lib +, callPackage , withIntrospection ? (stdenv.buildPlatform == stdenv.hostPlatform) , gobject-introspection }: @@ -140,6 +141,7 @@ stdenv.mkDerivation rec { tests = { installedTests = nixosTests.installed-tests.gdk-pixbuf; + multiple-module-files = callPackage ./multiple-module-files-test {}; }; # gdk_pixbuf_moduledir variable from gdk-pixbuf-2.0.pc diff --git a/pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/default.nix b/pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/default.nix new file mode 100644 index 0000000000000..f56c0e509f228 --- /dev/null +++ b/pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/default.nix @@ -0,0 +1,34 @@ +# Simple tests for multiple module files functionality. +# In the future, would like to test precedence, more than two files, unexpected inputs/fuzzing. +{ runCommand, gdk-pixbuf, librsvg}: +runCommand "pixbuf-mmf-test" {} '' + mkdir -p $out + set +e + + function test { + modulepath=$1 + testfile=$2 + GDK_PIXBUF_MODULE_FILE=$modulepath ${gdk-pixbuf}/bin/gdk-pixbuf-thumbnailer $testfile $out/$(basename $testfile) > /dev/null + } + + test ${gdk-pixbuf}/${gdk-pixbuf.cacheFile} ${./sample.svg} + if ! (($?)); then + >&2 echo "This shouldn't happen? SVG parsing succeeded even though librsvg wasn't supplied." + exit 1 + fi + + test ${gdk-pixbuf}/${gdk-pixbuf.cacheFile}:${librsvg}/${gdk-pixbuf.cacheFile} ${./sample.svg} + if (($?)); then + >&2 echo "Test failed." + exit 1 + fi + + test ${librsvg}/${gdk-pixbuf.cacheFile}:${gdk-pixbuf}/${gdk-pixbuf.cacheFile} ${./sample.svg} + if (($?)); then + >&2 echo "Test failed." + exit 1 + fi + + set -e + exit 0 +'' diff --git a/pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/sample.svg b/pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/sample.svg new file mode 100644 index 0000000000000..22bd85d520bc4 --- /dev/null +++ b/pkgs/development/libraries/gdk-pixbuf/multiple-module-files-test/sample.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + +