Adding append put test

This commit is contained in:
Ondrej Mejzlik 2020-10-20 09:50:24 +02:00
commit 0d0c010cd6
2 changed files with 110 additions and 0 deletions

View file

@ -0,0 +1,28 @@
summary: Test for bz735840 (ftp - append, put, send commands cause memory leaks)
description: |
Bug summary: ftp - append, put, send commands cause memory leaks
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=735840
component:
- ftp
test: ./runtest.sh
framework: beakerlib
recommend:
- ftp
- valgrind
- vsftpd
- expect
duration: 5m
enabled: true
tag:
- TIPfail_infra
- TIPfail_samba
- TIPfail_systemd
- TIPpass_Security
- Tier3
- TierCandidatesFAIL
tier: '3'
relevancy: |
arch = ia64, s390, s390x: False
extra-nitrate: TC#0121904
extra-summary: /CoreOS/ftp/Regression/bz735840-ftp-append-put-send-commands-cause-memory-leaks
extra-task: /CoreOS/ftp/Regression/bz735840-ftp-append-put-send-commands-cause-memory-leaks

View file

@ -0,0 +1,82 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/ftp/Regression/bz735840-ftp-append-put-send-commands-cause-memory-leaks
# Description: Test for bz735840 (ftp - append, put, send commands cause memory leaks)
# Author: Dalibor Pospisil <dapospis@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/lib/beakerlib/beakerlib.sh
PACKAGE="ftp"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
getsebool ftp_home_dir 2>/dev/null && {
rlRun "prevbool_ftp_home_dir=$(getsebool ftp_home_dir |sed -e 's/.* --> \(\S\+\).*/\1/')" 0 "Get previous value of ftp_home_dir boolean"
rlRun "setsebool ftp_home_dir 1" 0 "Enable ftp to access home dir"
}
rlRun "useradd ftptest" 0 "Create testing user"
rlServiceStart vsftpd
expect <<EOF
spawn -noecho passwd ftptest
expect "*ew*password*" {send -- "T4jn3h3s10\r"}
expect "*etype*password*" {send -- "T4jn3h3s10\r"}
expect eof
EOF
rlPhaseEnd
rlPhaseStartTest
rlRun "echo 'test file'>testlife.txt"
rlLog "Run expect valgrind ftp and upload a file twice"
expect <<EOF
spawn -noecho valgrind --leak-check=full --log-file=./ftp.memchk /usr/bin/ftp localhost
expect "*Name*" {send -- "ftptest\r"}
expect "*Password:*" {send -- "T4jn3h3s10\r"}
expect "*ftp>*" {send -- "put testlife.txt\r"}
expect "*ftp>*" {send -- "put testlife.txt\r"}
expect "*ftp>*" {send -- "bye\r"}
expect eof
EOF
res=$?
rlAssert0 "Check that expect passed ok" $res
rlAssertExists "./ftp.memchk"
rlAssertGrep "definitely lost: 0" ftp.memchk
rlPhaseEnd
rlPhaseStartCleanup
rlServiceRestore vsftpd
rlRun "userdel -r ftptest" 0 "Remove testing user"
getsebool ftp_home_dir 2>/dev/null && {
rlRun "setsebool ftp_home_dir $prevbool_ftp_home_dir" 0 "Return ftp_home_dir boolean back"
}
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd