Compare commits
1 commit
main
...
scripts-sm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
796bab9b45 |
2 changed files with 58 additions and 0 deletions
10
Sanity/valgrind-scripts-smoke/main.fmf
Normal file
10
Sanity/valgrind-scripts-smoke/main.fmf
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
summary: Smoke test for valgrind scripts
|
||||
contact: Jesus Checa Hidalgo <jchecahi@redhat.com>
|
||||
component:
|
||||
- valgrind
|
||||
test: ./runtest.sh
|
||||
framework: beakerlib
|
||||
require:
|
||||
- valgrind
|
||||
tier: 1
|
||||
duration: 5m
|
||||
48
Sanity/valgrind-scripts-smoke/runtest.sh
Executable file
48
Sanity/valgrind-scripts-smoke/runtest.sh
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
VERSION=$(rpm -q --queryformat="%{version}" valgrind)
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup
|
||||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
|
||||
rlRun "pushd $tmp"
|
||||
rlRun "set -o pipefail"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest
|
||||
for prog in $(rpm -ql valgrind | grep ^/usr/bin); do
|
||||
if file $prog | grep -q ELF; then
|
||||
rlLogDebug "Skipping ELF executable"
|
||||
continue
|
||||
fi
|
||||
|
||||
LOGFILE="$(basename $prog).log"
|
||||
if $prog --version &> $LOGFILE; then
|
||||
rlPass "[ok] $prog"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Perl scripts might return other than 0 but still be correct.
|
||||
# This is because some of them print the version/help message with
|
||||
# die() instead doing a print() and exit. die() always set the
|
||||
# return code to 255. Hence we rely on grepping the version string,
|
||||
# and make sure that the log contains only one line.
|
||||
if grep -q "$(basename $prog)-${VERSION}" $LOGFILE \
|
||||
&& [[ $(wc -l < $LOGFILE) -eq "1" ]];
|
||||
then
|
||||
rlPass "[ok] $prog"
|
||||
continue
|
||||
fi
|
||||
|
||||
# Anything else is a failure
|
||||
rlFail "[fail] $prog"
|
||||
rlLog "$(cat $LOGFILE)"
|
||||
done
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $tmp" 0 "Remove tmp directory"
|
||||
rlPhaseEnd
|
||||
rlJournalEnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue