Run tests from https://src.fedoraproject.org/tests/valgrind
This commit is contained in:
parent
089ce2c919
commit
17fcd94e04
@ -1,6 +1,6 @@
|
||||
summary: CI Gating Plan
|
||||
summary: CI test plan, runs all tests from tests repo.
|
||||
discover:
|
||||
how: fmf
|
||||
directory: tests
|
||||
url: https://src.fedoraproject.org/tests/valgrind
|
||||
execute:
|
||||
how: tmt
|
||||
|
@ -1,65 +0,0 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /tools/valgrind/Sanity/bz672959-RFE-Integrate-valgrind-with-gdb-possibly-through
|
||||
# Description: Test for BZ#672959 ([RFE] Integrate valgrind with gdb possibly through)
|
||||
# Author: Miroslav Franc <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/valgrind/Sanity/bz672959-RFE-Integrate-valgrind-with-gdb-possibly-through
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE something.c error.gdb noerror.gdb
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Miroslav Franc <mfranc@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Test for BZ#672959 ([RFE] Integrate valgrind with gdb possibly through)" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 30m" >> $(METADATA)
|
||||
@echo "RunFor: valgrind" >> $(METADATA)
|
||||
@echo "Requires: valgrind gcc gdb glibc-debuginfo" >> $(METADATA)
|
||||
@echo "Requires: glibc-devel" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
@echo "Bug: 672959" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
@ -1,7 +0,0 @@
|
||||
PURPOSE of /tools/valgrind/Sanity/bz672959-RFE-Integrate-valgrind-with-gdb-possibly-through
|
||||
Description: Test for BZ#672959 ([RFE] Integrate valgrind with gdb possibly through)
|
||||
Author: Miroslav Franc <mfranc@redhat.com>
|
||||
Bug summary: [RFE] Integrate valgrind with gdb possibly through gdbserver.
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=672959
|
||||
|
||||
This is small sanity test to make sure gdb works with valgrind gdb server.
|
@ -1,5 +0,0 @@
|
||||
target remote | vgdb
|
||||
c
|
||||
p var
|
||||
c
|
||||
q
|
@ -1,20 +0,0 @@
|
||||
summary: Test for BZ#672959 ([RFE] Integrate valgrind with gdb possibly through)
|
||||
description: |
|
||||
Bug summary: [RFE] Integrate valgrind with gdb possibly through gdbserver.
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=672959
|
||||
|
||||
This is small sanity test to make sure gdb works with valgrind gdb server.
|
||||
contact: Miroslav Franc <mfranc@redhat.com>
|
||||
component:
|
||||
- valgrind
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- valgrind
|
||||
- gcc
|
||||
- gdb
|
||||
- glibc-debuginfo
|
||||
- glibc-devel
|
||||
duration: 30m
|
||||
extra-summary: /tools/valgrind/Sanity/bz672959-RFE-Integrate-valgrind-with-gdb-possibly-through
|
||||
extra-task: /tools/valgrind/Sanity/bz672959-RFE-Integrate-valgrind-with-gdb-possibly-through
|
@ -1,6 +0,0 @@
|
||||
target remote | vgdb
|
||||
b something.c:10
|
||||
c
|
||||
set (a=5)
|
||||
c
|
||||
q
|
@ -1,116 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/valgrind/Sanity/bz672959-RFE-Integrate-valgrind-with-gdb-possibly-through
|
||||
# Description: Test for BZ#672959 ([RFE] Integrate valgrind with gdb possibly through)
|
||||
# Author: Miroslav Franc <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2012 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh
|
||||
|
||||
PACKAGE=$(rpm --qf "%{name}\n" -qf $(which valgrind) | head -1)
|
||||
PACKAGES=(valgrind gcc gdb)
|
||||
|
||||
# Expect 1th argument as a path to binary to test with
|
||||
_test_routine()
|
||||
{
|
||||
local binary=$1
|
||||
|
||||
rlPhaseStartTest "$binary error"
|
||||
rlAssertExists "$binary"
|
||||
rlLog "valgrind gdb server..."
|
||||
valgrind --vex-iropt-register-updates=allregs-at-mem-access --vgdb-error=0 ./$binary > vloge 2>&1 &
|
||||
vpid=$!
|
||||
sleep 5
|
||||
rlRun "gdb -x error.gdb ./$binary > gloge 2>&1"
|
||||
[[ -d /proc/$vpid ]] && { kill -9 $vpid; rlFail "oops: valgrind still running..."; }
|
||||
rlRun "wait $vpid"
|
||||
rlAssertGrep '19.*if(x)' gloge
|
||||
rlAssertGrep '$1 = 42' gloge
|
||||
# there should be exactly one error
|
||||
rlAssertGrep 'ERROR SUMMARY: 1 errors from 1 contexts' vloge
|
||||
rlLog "> gdb output <"
|
||||
rlLog "$(<gloge)"
|
||||
rlLog "> valgrind output <"
|
||||
rlLog "$(<vloge)"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "$binary noerror"
|
||||
rlAssertExists "$binary"
|
||||
rlLog "valgrind gdb server..."
|
||||
valgrind --vex-iropt-register-updates=allregs-at-mem-access --vgdb-error=0 ./$binary > vlogn 2>&1 &
|
||||
vpid=$!
|
||||
sleep 5
|
||||
rlRun "gdb -x noerror.gdb ./$binary > glogn 2>&1"
|
||||
[[ -d /proc/$vpid ]] && { kill -9 $vpid; rlFail "oops: valgrind still running..."; }
|
||||
rlRun "wait $vpid"
|
||||
rlAssertGrep '10.*f(a);' glogn
|
||||
# this time, no errors
|
||||
rlAssertGrep 'ERROR SUMMARY: 0 errors from 0 contexts' vlogn
|
||||
rlAssertGrep 'hello, world' vlogn
|
||||
rlLog "> gdb output <"
|
||||
rlLog "$(<glogn)"
|
||||
rlLog "> valgrind output <"
|
||||
rlLog "$(<vlogn)"
|
||||
rlPhaseEnd
|
||||
}
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
which valgrind | grep "/devtoolset"
|
||||
if [ $? -eq 0 ]; then
|
||||
rpm_prefix="$(which valgrind | grep -o 'devtoolset[^/]*')-"
|
||||
fi
|
||||
|
||||
for p in "${PACKAGES[@]}"; do
|
||||
rlAssertRpm "${rpm_prefix}${p}"
|
||||
done; unset p
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp something.c error.gdb noerror.gdb $TmpDir"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlRun "gcc -g something.c -o basic.out"
|
||||
|
||||
which dwz
|
||||
if [ $? -eq 0 ]; then
|
||||
rlRun "cp basic.out dwz.out"
|
||||
rlRun "dwz dwz.out"
|
||||
rlRun "dwz_binary_size=$(du -b dwz.out | awk '{ print $1}')"
|
||||
rlRun "basic_binary_size=$(du -b basic.out | awk '{ print $1}')"
|
||||
[ "$dwz_binary_size" = "$basic_binary_size" ] && rlFail "Size of dwz binary should differs"
|
||||
run_for=(basic.out dwz.out)
|
||||
else
|
||||
run_for=(basic.out)
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
for p in "${run_for[@]}"; do
|
||||
_test_routine "$p"
|
||||
done; unset p
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,21 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void f (int x);
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int a;
|
||||
|
||||
f(a);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
f (int x)
|
||||
{
|
||||
static int var __attribute__ ((used)) = 42;
|
||||
if(x)
|
||||
puts("hello, world");
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# 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 <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# 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 <mfranc@redhat.com>" > $(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)
|
@ -1,3 +0,0 @@
|
||||
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 <mfranc@redhat.com>
|
@ -1,14 +0,0 @@
|
||||
summary: Testing sanity of valgrind by comparing outputs of ImageMagick utilities
|
||||
with/without valgrind.
|
||||
description: ''
|
||||
contact: Alexandra Hajkova <ahajkova@redhat.com>
|
||||
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
|
Binary file not shown.
Before Width: | Height: | Size: 116 KiB |
@ -1,97 +0,0 @@
|
||||
#!/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 <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# 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
|
@ -1,57 +0,0 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Author: Miroslav Franc <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE
|
||||
|
||||
.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 <mfranc@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Testing sanity of valgrind by comparing outputs of hunspell with/without valgrind." >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 20m" >> $(METADATA)
|
||||
@echo "RunFor: valgrind" >> $(METADATA)
|
||||
@echo "Requires: valgrind hunspell" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
@ -1,17 +0,0 @@
|
||||
summary: Testing sanity of valgrind by comparing outputs of hunspell with/without valgrind.
|
||||
description: |
|
||||
This test is simplified version of the older RHEL does-aspell-works-under-valgrind test.
|
||||
|
||||
The test collects README files and try to run spellchecker on them with and without valgrind. The output should be the same.
|
||||
|
||||
contact: Alexandra Petlanova <ahajkova@redhat.com>
|
||||
component:
|
||||
- valgrind
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- valgrind
|
||||
- hunspell
|
||||
duration: 5m
|
||||
extra-summary: /tools/valgrind/Sanity/does-hunspell-works-under-valgrind
|
||||
extra-task: /tools/valgrind/Sanity/does-hunspell-works-under-valgrind
|
@ -1,69 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Description: Testing sanity of valgrind by comparing outputs of hunspell with/without valgrind.
|
||||
# Author: Miroslav Franc <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include rhts environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
SPELL_CHECKER="${SPELL_CHECKER:-hunspell}"
|
||||
|
||||
VALGRIND="${VALGRIND:-$(which valgrind)}"
|
||||
PACKAGES="${PACKAGES:-$(rpm --qf '%{name}\n' -qf $(which $VALGRIND) | head -1)}"
|
||||
REQUIRES="${REQUIRES:-$SPELL_CHECKER}"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlLogInfo "VALGRIND=$VALGRIND"
|
||||
rlLogInfo "PACKAGES=$PACKAGES"
|
||||
rlLogInfo "REQUIRES=$REQUIRES"
|
||||
rlLogInfo "SPELL_CHECKER=$SPELL_CHECKER"
|
||||
rlLogInfo "$(type valgrind)"
|
||||
|
||||
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
|
||||
rlRun "echo \"NEWSX\"|hunspell -a;echo -e '#include <time.h>\nclock_t clock(void) { return 0; }'|gcc -o libclock.so -Wall -g -shared -fPIC -x c -;echo "NEWSX"|LD_PRELOAD=./libclock.so hunspell -a > out"
|
||||
|
||||
rlRun "echo \"NEWSX\"|hunspell -a;echo -e '#include <time.h>\nclock_t clock(void) { return 0; }'|gcc -o libclock.so -Wall -g -shared -fPIC -x c -;echo \"NEWSX\"|LD_PRELOAD=./libclock.so valgrind -q hunspell -a > valgrind_out"
|
||||
|
||||
# Remove dictionary to avoid possibility of different results with
|
||||
# already present dictionary. After this all commands start with
|
||||
# the clean sheet.
|
||||
rlRun "rm -f $HOME/.hunspell_en_US"
|
||||
|
||||
rlAssertNotDiffer "out" "valgrind_out"
|
||||
[ "$?" -ne 0 ] && rlLogWarning "$(diff out valgrind_out)"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd" # $TmpDir
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,64 +0,0 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of /tools/valgrind/Sanity/quick-valgrind-sanity
|
||||
# Description: Very fast check that valgrind is working
|
||||
# Author: Miroslav Franc <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
export TEST=/tools/valgrind/Sanity/quick-valgrind-sanity
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE unitialized.c rv.c alloc.c
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
./runtest.sh
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -f *~ $(BUILT_FILES)
|
||||
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Miroslav Franc <mfranc@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: Very fast check that valgrind is working" >> $(METADATA)
|
||||
@echo "Type: Sanity" >> $(METADATA)
|
||||
@echo "TestTime: 15m" >> $(METADATA)
|
||||
@echo "RunFor: valgrind" >> $(METADATA)
|
||||
@echo "Requires: gcc valgrind-devel" >> $(METADATA)
|
||||
@echo "Requires: glibc-devel glibc-devel.ppc glibc-devel.s390 glibc-devel.i686" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
|
||||
rhts-lint $(METADATA)
|
@ -1,3 +0,0 @@
|
||||
PURPOSE of /tools/valgrind/Sanity/quick-valgrind-sanity
|
||||
Description: Very fast check that valgrind is working
|
||||
Author: Miroslav Franc <mfranc@redhat.com>
|
@ -1,10 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <valgrind/memcheck.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
void *buffer = malloc(atoi(argv[1]));
|
||||
VALGRIND_DO_LEAK_CHECK;
|
||||
free(buffer);
|
||||
return 0;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
summary: Basic smoke test.
|
||||
description: 'Very fast check that valgrind is working'
|
||||
contact:
|
||||
- Alexandra Petlanova Hajkova <ahajkova@redhat.com>
|
||||
component:
|
||||
- valgrind
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
recommend:
|
||||
- valgrind
|
||||
- valgrind-devel
|
||||
- gcc
|
||||
- make
|
||||
duration: 15m
|
||||
extra-summary: /tools/valgrind/Sanity/quick-valgrind-sanity
|
||||
extra-task: /tools/valgrind/Sanity/quick-valgrind-sanity
|
@ -1,104 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /tools/valgrind/Sanity/quick-valgrind-sanity
|
||||
# Description: Very fast check that valgrind is working
|
||||
# Author: Miroslav Franc <mfranc@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2013 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
VALGRIND="${VALGRIND:-$(which valgrind)}"
|
||||
PACKAGES="${PACKAGES:-$(rpm --qf '%{name}\n' -qf $(which $VALGRIND) | head -1)}"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlLogInfo "VALGRIND=$VALGRIND"
|
||||
rlLogInfo "PACKAGES=$PACKAGES"
|
||||
rlLogInfo "REQUIRES=$REQUIRES"
|
||||
rlLogInfo "$(type valgrind)"
|
||||
rlLogInfo "$(type gcc)"
|
||||
|
||||
rlLogInfo "SKIP_COLLECTION_METAPACKAGE_CHECK=$SKIP_COLLECTION_METAPACKAGE_CHECK"
|
||||
|
||||
# We optionally need to skip checking for the presence of the metapackage
|
||||
# because that would pull in all the dependent toolset subrpms. We do not
|
||||
# always want that, especially in CI.
|
||||
_COLLECTIONS="$COLLECTIONS"
|
||||
if ! test -z $SKIP_COLLECTION_METAPACKAGE_CHECK; then
|
||||
for c in $SKIP_COLLECTION_METAPACKAGE_CHECK; do
|
||||
rlLogInfo "ignoring metapackage check for collection $c"
|
||||
export COLLECTIONS=$(shopt -s extglob && echo ${COLLECTIONS//$c/})
|
||||
done
|
||||
fi
|
||||
|
||||
rlLogInfo "(without skipped) COLLECTIONS=$COLLECTIONS"
|
||||
|
||||
rlAssertRpm --all
|
||||
|
||||
export COLLECTIONS="$_COLLECTIONS"
|
||||
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "cp unitialized.c rv.c alloc.c $TmpDir"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlRun "gcc -g unitialized.c -o unitialized"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "good"
|
||||
rlRun "valgrind --log-file=./log0 ./unitialized 0" 42
|
||||
rlAssertNotGrep 'contains uninitialised byte' ./log0
|
||||
rlAssertGrep 'ERROR SUMMARY: 0' ./log0
|
||||
rlLog "$(<log0)"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "bad"
|
||||
rlRun "valgrind --log-file=./log2 ./unitialized 2" 0-41,43-255
|
||||
rlAssertGrep 'contains uninitialised byte' ./log2
|
||||
rlAssertGrep 'ERROR SUMMARY: 1' ./log2
|
||||
rlLog "$(<log2)"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "client request"
|
||||
rlRun "gcc -g rv.c -o rv"
|
||||
rlRun "valgrind ./rv > with-valgrind"
|
||||
rlAssertGrep "I'm running on valgrind" with-valgrind
|
||||
rlLog "$(<with-valgrind)"
|
||||
rlRun "./rv > without-valgrind"
|
||||
rlAssertGrep "I'm not running on valgrind" without-valgrind
|
||||
rlLog "$(<without-valgrind)"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "client request with leak checking"
|
||||
rlRun "gcc -g alloc.c -o alloc"
|
||||
rlRun "valgrind --log-file=./log ./alloc 42"
|
||||
rlAssertGrep 'still reachable: 42 bytes in 1 blocks' log
|
||||
rlLog "$(<log)"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd" # $TmpDir
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
@ -1,12 +0,0 @@
|
||||
#include <valgrind/valgrind.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
if(RUNNING_ON_VALGRIND)
|
||||
puts("I'm running on valgrind \\o/");
|
||||
else
|
||||
puts("I'm not running on valgrind /o\\");
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/* valgrind ./a.out 0 ~> no error */
|
||||
/* valgrind ./a.out 1 ~> error */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct something {
|
||||
char c;
|
||||
int x;
|
||||
};
|
||||
/* === 8 bytes ===
|
||||
* 42
|
||||
* garbage
|
||||
* garbage
|
||||
* garbage
|
||||
* 42
|
||||
* 42
|
||||
* 42
|
||||
* 42
|
||||
*/
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct something st = { 0x2A, 0x2A2A2A2A };
|
||||
|
||||
struct something st_copy = st;
|
||||
|
||||
return (int) *(&(st_copy.c)+atoi(argv[1]));
|
||||
}
|
||||
/* error generated after main returns */
|
Loading…
Reference in New Issue
Block a user