commit e5b468d82fbecacbd4e3fbc8a3ba2826fb02e2147149f97554ea528e4612dcd6 Author: Johannes Meixner Date: Mon Apr 24 12:50:29 2017 +0000 Accepting request 490291 from home:jsmeix New package ghostscript-testing that does basic testing of Ghostscript drivers during build-time of ghostscript-testing OBS-URL: https://build.opensuse.org/request/show/490291 OBS-URL: https://build.opensuse.org/package/show/Printing/ghostscript-testing?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/README.SUSE b/README.SUSE new file mode 100644 index 0000000..02dd027 --- /dev/null +++ b/README.SUSE @@ -0,0 +1,22 @@ + +Testing the Ghostscript drivers (so called Ghostscript 'devices') +by running them with the Ghostscript example files +and other test files. + +Basically what happens is (bash-like syntax): + +gs_options="-q -r50 -dNOPAUSE -dBATCH -dSAFER -sOutputFile=/dev/null" +gs_devices=$( gs -h | sed -n -e '/alc1900/,/xes/p' | tr -s '[:space:]' ' ' ) +example_files=$( ls -1 /usr/share/ghostscript/*/examples/*.p* ) +for gs_device in $gs_devices +do for example_file in $example_files + do echo "Testing $gs_device with $example_file" + if gs $gs_options -sDEVICE=$gs_device $example_file + then echo "Seems OK for $gs_device with $example_file" + else echo "Failure for $gs_device with $example_file" + fi + done +done + +See "gs -h" and "man gs". + diff --git a/ghostscript-testing.changes b/ghostscript-testing.changes new file mode 100644 index 0000000..d41b8b8 --- /dev/null +++ b/ghostscript-testing.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Mon Apr 24 13:39:27 CEST 2017 - jsmeix@suse.de + +- Initial version 1.0 + diff --git a/ghostscript-testing.spec b/ghostscript-testing.spec new file mode 100644 index 0000000..71e0252 --- /dev/null +++ b/ghostscript-testing.spec @@ -0,0 +1,117 @@ +# +# spec file for package ghostscript-testing +# +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +Name: ghostscript-testing +Version: 1.0 +Release: 0 +Summary: Testing Ghostscript drivers, so called Ghostscript 'devices' +# It is an openSUSE specific package (there is no real upstream project): +Url: https://build.opensuse.org/package/show/home:jsmeix/ghostscript-testing +# Use the fallback license (see the header of this spec file): +License: MIT +# Same RPM gropup as Ghostscript (cf. coreutils-testsuite glibc-testsuite qemu-testsuite): +Group: System/Libraries +# Source1: README.SUSE +Source1: README.SUSE +# The tests of the Ghostscript drivers happen during build of the ghostscript-testing package: +BuildRequires: ghostscript +BuildRequires: ghostscript-fonts-std +BuildRequires: ghostscript-fonts-other +# Install into this non-root directory (required when it is built as non-root user): +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Testing Ghostscript drivers, so called Ghostscript 'devices' +by running them with the Ghostscript example files +and other test files. + +%prep +# Nothing to do here. + +%build +# Testing Ghostscript drivers, so called Ghostscript 'devices' +# by running them with the Ghostscript example files +# and other test files, +# (see Source1 README.SUSE). +# Do not let the build fail when one particular gs call fails +# to ensure that during one build always all drivers are tested +# but in case of failures report gs stdout and stderr in the buildlog. +# At the end after all drivers had been tested let the bulid fail +# when at least one particular gs call had failed. +# When gs fails it usually means a driver fails +# but it does not mean it fails when there is wrong output +# i.e. the build succeeds for any output +# cf. "How to test a printer driver package" at +# https://en.opensuse.org/openSUSE:How_to_contribute_to_the_Printing_project +gs_stdout_and_stderr="/tmp/gs.out" +gs_options="-q -r50 -dNOPAUSE -dBATCH -dSAFER -sOutputFile=/dev/null" +# All Ghostscript drivers would be gs_devices=$( gs -h | sed -n -e '/alc1900/,/xes/p' | tr -s '[:space:]' ' ' ) +# but many Ghostscript drivers do not work with /dev/null as OutputFile +# so that at least for now only some in practice important example drivers are tested +# that work with /dev/null as OutputFile: +gs_devices="nullpage cups epson deskjet ljet4 pxlmono pxlcolor pdfwrite ps2write jpeg pngalpha pnggray pngmono" +example_files=$( ls -1 /usr/share/ghostscript/*/examples/*.p* ) +failed_tests=() +results_file="/tmp/ghostscript.test.results" +cat /dev/null >$results_file +# Avoid tons of bash debug messages in the build log: +set +x +# Do the actual work: +echo "Start testing $gs_devices" | tee -a $results_file +for gs_device in $gs_devices +do echo "BEGIN testing $gs_device" | tee -a $results_file + for example_file in $example_files + do echo "Testing $gs_device with $example_file" | tee -a $results_file + if gs $gs_options -sDEVICE=$gs_device $example_file &>$gs_stdout_and_stderr + then echo "OK for $gs_device with $example_file" | tee -a $results_file + else echo "FAILURE for $gs_device with $example_file with this gs stdout and stderr output:" | tee -a $results_file + cat $gs_stdout_and_stderr | tee -a $results_file + echo "End of gs stdout and stderr output for $gs_device with $example_file failure" | tee -a $results_file + failed_tests=( "${failed_tests[@]}" "FAILURE for $gs_device with $example_file" ) + fi + done + echo "END testing $gs_device" | tee -a $results_file +done +echo "Finished testing $gs_devices" | tee -a $results_file +if test "${failed_tests[*]}" +then echo "Build FAILURE because gs failed for those drivers and example_files:" | tee -a $results_file + for failed_test in "${failed_tests[@]}" + do echo "$failed_test" | fold -s -w 78 | tee -a $results_file + done + set -x + exit 99 +fi +echo "Build SUCCESS: Nothing really failed but there could have been ERROR or WARNING messages" | tee -a $results_file +set -x + +%install +# Source1: README.SUSE +mkdir -p %{buildroot}%{_datadir}/doc/packages/ghostscript-testing/ +install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/doc/packages/ghostscript-testing/README.SUSE +# Provide the test results in the built RPM for later evaluation (without buildlog): +results_file="/tmp/ghostscript.test.results" +mkdir -p %{buildroot}%{_datadir}/ghostscript-testing/ +install -m 644 $results_file %{buildroot}%{_datadir}/ghostscript-testing/results + +%files +%defattr(-,root,root,-) +%dir %{_datadir}/doc/packages/ghostscript-testing +%{_datadir}/doc/packages/ghostscript-testing/README.SUSE +%dir %{_datadir}/ghostscript-testing/ +%{_datadir}/ghostscript-testing/results + +%changelog