mailcap/Sanity/basic/runtest.sh
2024-06-11 10:25:35 +02:00

77 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/mailcap/Sanity/basic
# Description: Basic sanity test
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="mailcap"
export LINES=24
export COLUMNS=80
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlFileBackup "/var/mail/root"
rlRun "cat ./mail > /var/mail/root"
rlRun "cat ./run-test.sh > /usr/local/bin/run-test.sh"
rlRun "chmod +x /usr/local/bin/run-test.sh"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "cp ./mutt.exp $TmpDir"
rlRun "pushd $TmpDir"
rlRun "echo 'text/html; /usr/local/bin/run-test.sh %s; copiousoutput' > /root/.mailcap"
rlRun "echo 'auto_view text/html' > /root/.muttrc"
rlRun "mkdir /root/Mail/" 0-255
rlRun "rm -rf /tmp/testing"
rlPhaseEnd
rlPhaseStartTest
script -qfec 'expect -f ./mutt.exp'
rlRun "ls /dev" 0 "Get me tty list"
rlRun "cat typescript" 0 "Get me log"
rlRun "cat ~/.muttdebug0" 0 "Get me debug of mutt"
rlAssertGrep "123 hello world We are here" /tmp/testing
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "rm -rf /usr/local/bin/run-test.sh"
rlRun "rm -rf /root/.mailcap"
rlRun "rm -rf /root/.muttrc"
rlRun "rm -rf /tmp/testing"
rlFileRestore
rlPhaseEnd
rlJournalPrintText
rlJournalEnd