Blame Regression/bz1228484-mirror-directory-hang/runtest.sh

c2f92c7
#!/bin/bash
c2f92c7
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
c2f92c7
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c2f92c7
#
c2f92c7
#   runtest.sh of /CoreOS/lftp/Regression/bz1228484-mirror-directory-hang
c2f92c7
#   Description: Test mirroring with subdirectories
c2f92c7
#   Author: Martin Frodl <mfrodl@redhat.com>
c2f92c7
#
c2f92c7
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c2f92c7
#
c2f92c7
#   Copyright (c) 2016 Red Hat, Inc.
c2f92c7
#
c2f92c7
#   This program is free software: you can redistribute it and/or
c2f92c7
#   modify it under the terms of the GNU General Public License as
c2f92c7
#   published by the Free Software Foundation, either version 2 of
c2f92c7
#   the License, or (at your option) any later version.
c2f92c7
#
c2f92c7
#   This program is distributed in the hope that it will be
c2f92c7
#   useful, but WITHOUT ANY WARRANTY; without even the implied
c2f92c7
#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
c2f92c7
#   PURPOSE.  See the GNU General Public License for more details.
c2f92c7
#
c2f92c7
#   You should have received a copy of the GNU General Public License
c2f92c7
#   along with this program. If not, see http://www.gnu.org/licenses/.
c2f92c7
#
c2f92c7
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
c2f92c7
c2f92c7
# Include Beaker environment
c2f92c7
. /usr/share/beakerlib/beakerlib.sh || exit 1
c2f92c7
c2f92c7
PACKAGES="lftp"
c2f92c7
c2f92c7
random() {
c2f92c7
    tr -dc a-z < /dev/urandom | head -c 8
c2f92c7
}
c2f92c7
c2f92c7
rlJournalStart
c2f92c7
    rlPhaseStartSetup
c2f92c7
        rlRun "rlImport httpd/http"
c2f92c7
        rlAssertRpm --all
c2f92c7
c2f92c7
        rlFileBackup --clean ${httpROOTDIR}
c2f92c7
        TESTDIR="${httpROOTDIR}/bz1228484"
c2f92c7
c2f92c7
        rlLogInfo "Creating directory tree on HTTP server"
c2f92c7
        mkdir ${TESTDIR}
c2f92c7
        cd ${TESTDIR}
c2f92c7
        for i in {1..4}; do
c2f92c7
            echo $(random) > $(random)
c2f92c7
            SUBDIR=$(random)
c2f92c7
            mkdir ${SUBDIR}
c2f92c7
            cd ${SUBDIR}
c2f92c7
        done
c2f92c7
c2f92c7
        rlRun "httpStart"
c2f92c7
c2f92c7
        rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
c2f92c7
        rlRun "pushd ${TmpDir}"
c2f92c7
    rlPhaseEnd
c2f92c7
c2f92c7
    rlPhaseStartTest
c2f92c7
        LFTP='lftp -c "mirror -v -v -v http://localhost/bz1228484/"'
c2f92c7
        rlRun "rlWatchdog '${LFTP}' 8" 0 "Mirroring local server with lftp"
5bb4d17
        du bz1228484
5bb4d17
        du ${TESTDIR} 
5bb4d17
        rlRun "diff -r ./bz1228484 ${TESTDIR}"
c2f92c7
    rlPhaseEnd
c2f92c7
c2f92c7
    rlPhaseStartCleanup
c2f92c7
        rlRun "popd"
c2f92c7
        rlRun "rm -r ${TmpDir}" 0 "Removing tmp directory"
c2f92c7
        rlRun "httpStop"
c2f92c7
        rlRun "rlFileRestore"
c2f92c7
    rlPhaseEnd
c2f92c7
rlJournalPrintText
c2f92c7
rlJournalEnd