From: Michael Orlitzky Date: Tue, 8 Aug 2023 14:41:04 +0000 (-0400) Subject: Makefile.am,run-tests.sh: new bare-bones test suite X-Git-Tag: 0.0.1~3 X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=385817cdfaa1514207424efd4b7b5bfb64fa4d7e;p=libsvgtiny-pixbuf.git Makefile.am,run-tests.sh: new bare-bones test suite Does it segfault? No? Ship it! --- diff --git a/Makefile.am b/Makefile.am index 7912a93..052f3d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,6 +28,10 @@ svg2png_SOURCES = $(libpixbufloader_svg_la_SOURCES) svg2png_CPPFLAGS = $(libpixbufloader_svg_la_CPPFLAGS) svg2png_LDADD = $(libpixbufloader_svg_la_LIBADD) +# Test suite +dist_check_SCRIPTS = run-tests.sh +TESTS = $(dist_check_SCRIPTS) +AM_TESTS_ENVIRONMENT = export test_cases="$(top_srcdir)/test-cases"; # Miscellaneous -EXTRA_DIST = gdk_pixbuf_get_from_surface.h +EXTRA_DIST = gdk_pixbuf_get_from_surface.h test-cases diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 0000000..cd25d0c --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Run svg2png on a few carefully chosen cases to ensure that it +# doesn't segfault. The $test_cases variable is set by automake. We +# have to override some bits of gdk-pixbuf to ensure that the +# newly-build libsvgtiny-pixbuf is used, and not the installed copy -- +# or worse, an installed copy of librsvg. +set -e + +LOADERS_CACHE=$(pwd)/loaders.cache + +# I'm not real happy about hard-coding the name ".libs", but it works +# for now (we need the directory where the just-built *.so file +# lives). +GDK_PIXBUF_MODULEDIR=.libs gdk-pixbuf-query-loaders > "${LOADERS_CACHE}" +export GDK_PIXBUF_MODULE_FILE="${LOADERS_CACHE}" + +TEST_CASES=$(find ${test_cases} -type f -name '*.svg') +for f in $TEST_CASES; do + g="$(basename "${f}").png" + echo "Converting ${f} to ${g}..." + ./svg2png "${f}" "${g}" + echo "Success." + rm "${g}" +done + +rm "${LOADERS_CACHE}"