|
|
ad4dfde |
#!/bin/bash
|
|
|
ad4dfde |
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
|
ad4dfde |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
ad4dfde |
#
|
|
|
ad4dfde |
# runtest.sh of /CoreOS/lftp/Regression/bz810217-lftp-hangs-using-a-ascii-mode
|
|
|
ad4dfde |
# Description: Test for BZ#810217 (lftp hangs using -a ascii mode)
|
|
|
ad4dfde |
# Author: David Kutalek <dkutalek@redhat.com>
|
|
|
ad4dfde |
#
|
|
|
ad4dfde |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
ad4dfde |
#
|
|
|
ad4dfde |
# Copyright (c) 2012 Red Hat, Inc. All rights reserved.
|
|
|
ad4dfde |
#
|
|
|
ad4dfde |
# This copyrighted material is made available to anyone wishing
|
|
|
ad4dfde |
# to use, modify, copy, or redistribute it subject to the terms
|
|
|
ad4dfde |
# and conditions of the GNU General Public License version 2.
|
|
|
ad4dfde |
#
|
|
|
ad4dfde |
# This program is distributed in the hope that it will be
|
|
|
ad4dfde |
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
ad4dfde |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
ad4dfde |
# PURPOSE. See the GNU General Public License for more details.
|
|
|
ad4dfde |
#
|
|
|
ad4dfde |
# You should have received a copy of the GNU General Public
|
|
|
ad4dfde |
# License along with this program; if not, write to the Free
|
|
|
ad4dfde |
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
ad4dfde |
# Boston, MA 02110-1301, USA.
|
|
|
ad4dfde |
#
|
|
|
ad4dfde |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
ad4dfde |
|
|
|
ad4dfde |
# Include Beaker environment
|
|
|
ad4dfde |
. /usr/share/beakerlib/beakerlib.sh
|
|
|
ad4dfde |
|
|
|
ad4dfde |
PACKAGE="lftp"
|
|
|
ad4dfde |
|
|
|
ad4dfde |
rlJournalStart
|
|
|
ad4dfde |
rlPhaseStartSetup
|
|
|
ad4dfde |
rlAssertRpm $PACKAGE
|
|
|
ad4dfde |
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
|
|
fb07abf |
TESTDIR=$(pwd)
|
|
|
ad4dfde |
rlRun "pushd $TmpDir"
|
|
|
ad4dfde |
rlRun "echo 'Ascii lftp upload test file' > ./test.txt"
|
|
|
ad4dfde |
rlRun "grep '^Subsystem[[:space:]]*sftp[[:space:]]*/usr/libexec/openssh/sftp-server\$' /etc/ssh/sshd_config"
|
|
|
ad4dfde |
rlRun "useradd -m lftptester"
|
|
|
fb07abf |
rlRun "mkdir /home/lftptester/.ssh"
|
|
|
fb07abf |
rlRun "chown lftptester:lftptester /home/lftptester/.ssh"
|
|
|
fb07abf |
rlRun "chmod 700 /home/lftptester/.ssh"
|
|
|
fb07abf |
rlRun "cp $TESTDIR/config /home/lftptester/.ssh"
|
|
|
fb07abf |
rlRun "chown lftptester:lftptester /home/lftptester/.ssh/config"
|
|
|
fb07abf |
rlRun "chmod 600 /home/lftptester/.ssh/config"
|
|
|
ad4dfde |
rlRun "echo testerpwd | passwd --stdin lftptester"
|
|
|
ad4dfde |
rlRun "netstat -lnp | grep sshd | grep ':22'"
|
|
|
ad4dfde |
rlPhaseEnd
|
|
|
ad4dfde |
|
|
|
ad4dfde |
rlPhaseStartTest
|
|
|
ad4dfde |
if [ -e ~/.ssh/known_hosts ]; then
|
|
|
ad4dfde |
rlRun "rlFileBackup ~/.ssh/known_hosts" 0 "Back up ~/.ssh/known_hosts"
|
|
|
ad4dfde |
RESTORE=1
|
|
|
ad4dfde |
fi
|
|
|
ad4dfde |
rlRun "ssh-keyscan 127.0.0.1 >> ~/.ssh/known_hosts" 0 "Add ssh fingerprint for localhost to known_hosts"
|
|
|
ad4dfde |
rlRun "rlWatchdog \"lftp -d -u lftptester,testerpwd sftp://127.0.0.1:22 -e 'put -a test.txt; exit'\" 30"
|
|
|
ad4dfde |
rlRun "ls -l /home/lftptester/test.txt"
|
|
|
ad4dfde |
rlRun "cat /home/lftptester/test.txt"
|
|
|
ad4dfde |
rlPhaseEnd
|
|
|
ad4dfde |
|
|
|
ad4dfde |
rlPhaseStartCleanup
|
|
|
ad4dfde |
if [ $RESTORE -eq 1 ]; then
|
|
|
ad4dfde |
rlRun "rlFileRestore" 0 "Restore ~/.ssh/known_hosts"
|
|
|
ad4dfde |
fi
|
|
|
ad4dfde |
rlRun "userdel -f -r lftptester"
|
|
|
ad4dfde |
rlRun "popd"
|
|
|
ad4dfde |
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
|
ad4dfde |
rlPhaseEnd
|
|
|
ad4dfde |
rlJournalPrintText
|
|
|
ad4dfde |
rlJournalEnd
|