From f2c4fda6515a7eb455301cfdbab74ee10ffaa210 Mon Sep 17 00:00:00 2001 From: Alexandra Hájková Date: May 18 2021 14:11:54 +0000 Subject: does-Image-Magick-works-under-valgrind test to Fedora CI The original RHEL test also converts an image to png. This version of the test has the conversion to png disabled as it faills the test. The failure is probably caused by some rounding issue which was impossible to track down so far. The test is currently only run on x86_64. There might be "Conditional jump or move depends on uninitialised value(s)" warnings while running under valgrind, but the test is to show the transformations work with and without valgrind. --- diff --git a/tests/does-Image-Magick-works-under-valgrind/Makefile b/tests/does-Image-Magick-works-under-valgrind/Makefile new file mode 100644 index 0000000..67799aa --- /dev/null +++ b/tests/does-Image-Magick-works-under-valgrind/Makefile @@ -0,0 +1,69 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/valgrind/Sanity/does-Image-Magick-works-under-valgrind +# Description: Testing sanity of valgrind by comparing outputs of ImageMagick utilities with/without valgrind. +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2011 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2 or later. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# The image munich.jpg used in this test is from: +# https://en.wikipedia.org/wiki/File:Frauenkirche_and_Neues_Rathaus_Munich_March_2013.JPG. +# munich.jpg file is distributed under the Creative Commons +# Attribution-Share Alike 3.0 Unported license +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/valgrind/Sanity/does-Image-Magick-works-under-valgrind +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE munich.jpg + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Miroslav Franc " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Testing sanity of valgrind by comparing outputs of ImageMagick utilities with/without valgrind." >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 3h" >> $(METADATA) + @echo "RunFor: valgrind" >> $(METADATA) + @echo "Requires: valgrind ImageMagick" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: RHEL6 RHEL7" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/does-Image-Magick-works-under-valgrind/PURPOSE b/tests/does-Image-Magick-works-under-valgrind/PURPOSE new file mode 100644 index 0000000..fd23e2c --- /dev/null +++ b/tests/does-Image-Magick-works-under-valgrind/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /tools/valgrind/Sanity/does-Image-Magick-works-under-valgrind +Description: Testing sanity of valgrind by comparing outputs of ImageMagick utilities with/without valgrind. +Author: Miroslav Franc diff --git a/tests/does-Image-Magick-works-under-valgrind/main.fmf b/tests/does-Image-Magick-works-under-valgrind/main.fmf new file mode 100644 index 0000000..042dd60 --- /dev/null +++ b/tests/does-Image-Magick-works-under-valgrind/main.fmf @@ -0,0 +1,14 @@ +summary: Testing sanity of valgrind by comparing outputs of ImageMagick utilities + with/without valgrind. +description: '' +contact: Alexandra Hajkova +component: +- valgrind +test: ./runtest.sh +framework: beakerlib +recommend: +- valgrind +- ImageMagick +duration: 3h +extra-summary: /tools/valgrind/Sanity/does-Image-Magick-works-under-valgrind +extra-task: /tools/valgrind/Sanity/does-Image-Magick-works-under-valgrind diff --git a/tests/does-Image-Magick-works-under-valgrind/munich.jpg b/tests/does-Image-Magick-works-under-valgrind/munich.jpg new file mode 100644 index 0000000..6250ed6 Binary files /dev/null and b/tests/does-Image-Magick-works-under-valgrind/munich.jpg differ diff --git a/tests/does-Image-Magick-works-under-valgrind/runtest.sh b/tests/does-Image-Magick-works-under-valgrind/runtest.sh new file mode 100755 index 0000000..be62adf --- /dev/null +++ b/tests/does-Image-Magick-works-under-valgrind/runtest.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/valgrind/Sanity/does-Image-Magick-works-under-valgrind +# Description: Testing sanity of valgrind by comparing outputs of ImageMagick utilities with/without valgrind. +# Author: Miroslav Franc +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2011 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2 or later. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# The image munich.jpg used in this test is from: +# https://en.wikipedia.org/wiki/File:Frauenkirche_and_Neues_Rathaus_Munich_March_2013.JPG. +# munich.jpg file is distributed under the Creative Commons +# Attribution-Share Alike 3.0 Unported license +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +VALGRIND="${VALGRIND:-$(which valgrind)}" +PACKAGES="${PACKAGES:-$(rpm --qf '%{name}\n' -qf $(which $VALGRIND) | head -1)}" +REQUIRES="${REQUIRES:-ImageMagick}" + +Picture="munich.jpg" +Formats=(jpg gif) +Options=(-flop + -flip + -resize\ 160x100 + -resize\ 50\\\% + -sharpen\ 5x5 + -equalize + -motion-blur\ 20x5 + -paint\ 3x3 + -radial-blur\ 5 + -posterize\ 10 + ) + + +rlJournalStart + rlPhaseStartSetup + rlLogInfo "VALGRIND=$VALGRIND" + rlLogInfo "PACKAGES=$PACKAGES" + rlLogInfo "REQUIRES=$REQUIRES" + rlLogInfo "COLLECTIONS=$COLLECTIONS" + rlLogInfo "$(type valgrind)" + + rlAssertRpm --all + + rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory" + rlRun "cp $Picture $TmpDir" 0 "Copying $Picture to $TmpDir" + rlRun "pushd $TmpDir" + rlRun "mkdir out" 0 "Creating out directory" + rlPhaseEnd + + for f in "${Formats[@]}"; do + for o in "${Options[@]}"; do + rlPhaseStartTest "convert $o $Picture out/0${Picture%jpg}$f" + rlRun "convert $o $Picture out/0${Picture%jpg}$f" 0 "Converting $Picture to out/0${Picture%jpg}$f with ($o)" + rlLog "convert $o $Picture out/0${Picture%jpg}$f" + rlRun "valgrind convert $o $Picture out/1${Picture%jpg}$f" 0 "Converting $Picture to out/1${Picture%jpg}$f with ($o) [valgrind]" + rlLog "valgrind convert $o $Picture out/1${Picture%jpg}$f" + [[ $(arch) = i686 ]] || rlRun "echo \`md5sum out/[01]${Picture%jpg}$f\` | while read with nic without nic; do test \"\$with\" = \"\$without\";done" 0 "Output is the same with/without valgrind" + md5sum out/[01]${Picture%jpg}$f + rlPhaseEnd + rlPhaseStartCleanup "Cleaning for $f with $o" + rlRun "mkdir -p \"out-$o\"" + rlRun "cp -r out/* \"out-$o/\"" + rlRun "rm -f out/*" 0 "Removing the old pictures" + rlPhaseEnd + done + done + + rlPhaseStartCleanup + rlRun "rm -rf out" + rlRun "tar czf out.tgz $TmpDir/*" + rlFileSubmit "out.tgz" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd