|
Alexandra Hájková |
f2c4fd |
#!/bin/bash
|
|
Alexandra Hájková |
f2c4fd |
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
Alexandra Hájková |
f2c4fd |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
Alexandra Hájková |
f2c4fd |
#
|
|
Alexandra Hájková |
f2c4fd |
# runtest.sh of /tools/valgrind/Sanity/does-Image-Magick-works-under-valgrind
|
|
Alexandra Hájková |
f2c4fd |
# Description: Testing sanity of valgrind by comparing outputs of ImageMagick utilities with/without valgrind.
|
|
Alexandra Hájková |
f2c4fd |
# Author: Miroslav Franc <mfranc@redhat.com>
|
|
Alexandra Hájková |
f2c4fd |
#
|
|
Alexandra Hájková |
f2c4fd |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
Alexandra Hájková |
f2c4fd |
#
|
|
Alexandra Hájková |
f2c4fd |
# Copyright (c) 2011 Red Hat, Inc. All rights reserved.
|
|
Alexandra Hájková |
f2c4fd |
#
|
|
Alexandra Hájková |
f2c4fd |
# This copyrighted material is made available to anyone wishing
|
|
Alexandra Hájková |
f2c4fd |
# to use, modify, copy, or redistribute it subject to the terms
|
|
Alexandra Hájková |
f2c4fd |
# and conditions of the GNU General Public License version 2 or later.
|
|
Alexandra Hájková |
f2c4fd |
#
|
|
Alexandra Hájková |
f2c4fd |
# This program is distributed in the hope that it will be
|
|
Alexandra Hájková |
f2c4fd |
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
Alexandra Hájková |
f2c4fd |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
Alexandra Hájková |
f2c4fd |
# PURPOSE. See the GNU General Public License for more details.
|
|
Alexandra Hájková |
f2c4fd |
#
|
|
Alexandra Hájková |
f2c4fd |
# You should have received a copy of the GNU General Public
|
|
Alexandra Hájková |
f2c4fd |
# License along with this program; if not, write to the Free
|
|
Alexandra Hájková |
f2c4fd |
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
Alexandra Hájková |
f2c4fd |
# Boston, MA 02110-1301, USA.
|
|
Alexandra Hájková |
f2c4fd |
#
|
|
Alexandra Hájková |
f2c4fd |
# The image munich.jpg used in this test is from:
|
|
Alexandra Hájková |
f2c4fd |
# https://en.wikipedia.org/wiki/File:Frauenkirche_and_Neues_Rathaus_Munich_March_2013.JPG.
|
|
Alexandra Hájková |
f2c4fd |
# munich.jpg file is distributed under the Creative Commons
|
|
Alexandra Hájková |
f2c4fd |
# Attribution-Share Alike 3.0 Unported license
|
|
Alexandra Hájková |
f2c4fd |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
# Include rhts environment
|
|
Alexandra Hájková |
f2c4fd |
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
VALGRIND="${VALGRIND:-$(which valgrind)}"
|
|
Alexandra Hájková |
f2c4fd |
PACKAGES="${PACKAGES:-$(rpm --qf '%{name}\n' -qf $(which $VALGRIND) | head -1)}"
|
|
Alexandra Hájková |
f2c4fd |
REQUIRES="${REQUIRES:-ImageMagick}"
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
Picture="munich.jpg"
|
|
Alexandra Hájková |
f2c4fd |
Formats=(jpg gif)
|
|
Alexandra Hájková |
f2c4fd |
Options=(-flop
|
|
Alexandra Hájková |
f2c4fd |
-flip
|
|
Alexandra Hájková |
f2c4fd |
-resize\ 160x100
|
|
Alexandra Hájková |
f2c4fd |
-resize\ 50\\\%
|
|
Alexandra Hájková |
f2c4fd |
-sharpen\ 5x5
|
|
Alexandra Hájková |
f2c4fd |
-equalize
|
|
Alexandra Hájková |
f2c4fd |
-motion-blur\ 20x5
|
|
Alexandra Hájková |
f2c4fd |
-paint\ 3x3
|
|
Alexandra Hájková |
f2c4fd |
-radial-blur\ 5
|
|
Alexandra Hájková |
f2c4fd |
-posterize\ 10
|
|
Alexandra Hájková |
f2c4fd |
)
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
rlJournalStart
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseStartSetup
|
|
Alexandra Hájková |
f2c4fd |
rlLogInfo "VALGRIND=$VALGRIND"
|
|
Alexandra Hájková |
f2c4fd |
rlLogInfo "PACKAGES=$PACKAGES"
|
|
Alexandra Hájková |
f2c4fd |
rlLogInfo "REQUIRES=$REQUIRES"
|
|
Alexandra Hájková |
f2c4fd |
rlLogInfo "COLLECTIONS=$COLLECTIONS"
|
|
Alexandra Hájková |
f2c4fd |
rlLogInfo "$(type valgrind)"
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
rlAssertRpm --all
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "cp $Picture $TmpDir" 0 "Copying $Picture to $TmpDir"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "pushd $TmpDir"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "mkdir out" 0 "Creating out directory"
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseEnd
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
for f in "${Formats[@]}"; do
|
|
Alexandra Hájková |
f2c4fd |
for o in "${Options[@]}"; do
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseStartTest "convert $o $Picture out/0${Picture%jpg}$f"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "convert $o $Picture out/0${Picture%jpg}$f" 0 "Converting $Picture to out/0${Picture%jpg}$f with ($o)"
|
|
Alexandra Hájková |
f2c4fd |
rlLog "convert $o $Picture out/0${Picture%jpg}$f"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "valgrind convert $o $Picture out/1${Picture%jpg}$f" 0 "Converting $Picture to out/1${Picture%jpg}$f with ($o) [valgrind]"
|
|
Alexandra Hájková |
f2c4fd |
rlLog "valgrind convert $o $Picture out/1${Picture%jpg}$f"
|
|
Alexandra Hájková |
f2c4fd |
[[ $(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"
|
|
Alexandra Hájková |
f2c4fd |
md5sum out/[01]${Picture%jpg}$f
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseEnd
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseStartCleanup "Cleaning for $f with $o"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "mkdir -p \"out-$o\""
|
|
Alexandra Hájková |
f2c4fd |
rlRun "cp -r out/* \"out-$o/\""
|
|
Alexandra Hájková |
f2c4fd |
rlRun "rm -f out/*" 0 "Removing the old pictures"
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseEnd
|
|
Alexandra Hájková |
f2c4fd |
done
|
|
Alexandra Hájková |
f2c4fd |
done
|
|
Alexandra Hájková |
f2c4fd |
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseStartCleanup
|
|
Alexandra Hájková |
f2c4fd |
rlRun "rm -rf out"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "tar czf out.tgz $TmpDir/*"
|
|
Alexandra Hájková |
f2c4fd |
rlFileSubmit "out.tgz"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "popd"
|
|
Alexandra Hájková |
f2c4fd |
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
Alexandra Hájková |
f2c4fd |
rlPhaseEnd
|
|
Alexandra Hájková |
f2c4fd |
rlJournalPrintText
|
|
Alexandra Hájková |
f2c4fd |
rlJournalEnd
|