glibc/tests/Regression/bz699724-Memory-leak-within-NSSLOW-Init-as-called-by/runtest.sh

99 lines
3.7 KiB
Bash
Raw Normal View History

#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /tools/glibc/Regression/bz699724-Memory-leak-within-NSSLOW-Init-as-called-by
# Description: Test for bz699724 (Memory leak within NSSLOW_Init, as called by)
# 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.
#
# 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
PACKAGES=(glibc valgrind)
rlJournalStart
rlPhaseStartSetup
for p in "${PACKAGES[@]}"; do
rlAssertRpm "$p"
done; unset p
rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "cp test_crypt.py $TmpDir"
rlRun "pushd $TmpDir"
if rlIsRHEL 9
then
CURPYTHON="python3"
CURPYTEST="/usr/lib64/python3.9/test/test_crypt.py"
elif rlIsRHEL 8
then
CURPYTHON="python3"
CURPYTEST="/usr/lib64/python3.6/test/test_crypt.py"
elif rlIsRHEL 7
then
CURPYTHON="python"
CURPYTEST="/usr/lib64/python2.7/test/test_crypt.py"
elif rlIsRHEL 6
then
CURPYTHON="python"
if [ "$(rlGetPrimaryArch)" == "i686" ]
then
CURPYTEST="/usr/lib/python2.6/test/test_crypt.py"
else
CURPYTEST="/usr/lib64/python2.6/test/test_crypt.py"
fi
else
# guess it's Fedora
CURPYTHON="python3"
CURPYPRETEST=$(python3 -m site |grep -o -E /usr/lib64/python3\\.[0-9]+|head -n 1)
CURPYTEST="${CURPYPRETEST}/test/test_crypt.py"
fi
rlPhaseEnd
rlPhaseStartTest "python-test package"
#rlRun "valgrind python /usr/lib64/python2.6/test/test_crypt.py 2>&1| grep -A2 'LEAK SUMMARY' > log 2>&1"
rlAssertExists $CURPYTEST
rlRun "valgrind $CURPYTHON $CURPYTEST > valgrind1.out 2>&1"
rlRun "grep -A2 'LEAK SUMMARY' valgrind1.out > log 2>&1"
rlRun "grep -q 'definitely lost: 0' log"
rlRun "grep -q 'indirectly lost: 0' log"
rlFileSubmit valgrind1.out
rlFileSubmit log
rlPhaseEnd
rlPhaseStartTest "test_crypt.py bundled with the test case (50 x)"
#rlRun "valgrind --num-callers=50 --leak-check=full python test_crypt.py 50 2>&1| grep -A2 'LEAK SUMMARY' > log2 2>&1"
rlRun "valgrind --num-callers=50 --leak-check=full $CURPYTHON test_crypt.py 50 > valgrind2.out 2>&1" 0,1
rlRun "grep -A2 'LEAK SUMMARY' valgrind2.out > log2 2>&1"
rlRun "grep -q 'definitely lost: 0' log2"
rlRun "grep -q 'indirectly lost: 0' log2"
rlFileSubmit valgrind2.out
rlFileSubmit log2
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd