Fedora CI: integrate does-hunspell-works-under-valgrind test
This commit is contained in:
parent
75fe92cbdd
commit
858fa472f5
57
tests/does-hunspell-works-under-valgrind/Makefile
Normal file
57
tests/does-hunspell-works-under-valgrind/Makefile
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# 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)
|
17
tests/does-hunspell-works-under-valgrind/main.fmf
Normal file
17
tests/does-hunspell-works-under-valgrind/main.fmf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
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
|
94
tests/does-hunspell-works-under-valgrind/runtest.sh
Executable file
94
tests/does-hunspell-works-under-valgrind/runtest.sh
Executable file
@ -0,0 +1,94 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
out="$TmpDir/spell_check.out"
|
||||||
|
err="$TmpDir/spell_check.err"
|
||||||
|
vout="$TmpDir/spell_check.valgrind.out"
|
||||||
|
verr="$TmpDir/spell_check.valgrind.err"
|
||||||
|
|
||||||
|
spell_checker_command=""
|
||||||
|
spell_checker_command="echo \"hackerx\" | $SPELL_CHECKER -a > $out 2> $err"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
rlRun "$spell_checker_command" 0-255
|
||||||
|
|
||||||
|
if [ "$?" -eq "0" ]; then
|
||||||
|
spell_checker_command="${spell_checker_command/$out/$vout}"
|
||||||
|
spell_checker_command="${spell_checker_command/$err/$verr}"
|
||||||
|
|
||||||
|
rlRun "rm -f $HOME/.hunspell_en_US"
|
||||||
|
rlRun "valgrind $spell_checker_command" 0-255
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
rlLogWarning "Valgrind check failed"
|
||||||
|
rlLogWarning "$(cat $verr)"
|
||||||
|
else
|
||||||
|
rlAssertNotDiffer "$out" "$vout"
|
||||||
|
[ "$?" -ne 0 ] && rlLogWarning "$(diff $out $vout)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
((skipped++))
|
||||||
|
|
||||||
|
rlLogWarning "Regular check failed"
|
||||||
|
rlLogWarning "$(cat $err)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rlRun "rm -f $out $err $vout $verr"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
|
rlPhaseStartCleanup
|
||||||
|
rlRun "popd" # $TmpDir
|
||||||
|
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||||
|
rlPhaseEnd
|
||||||
|
rlJournalPrintText
|
||||||
|
rlJournalEnd
|
Loading…
Reference in New Issue
Block a user