From 90d897bd3e16bda6f438085dd74eac3192ac9221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Hrdina?= Date: Mon, 3 Apr 2023 14:49:23 +0200 Subject: [PATCH] Adding fmf plan and test /CoreOS/mailcap/Sanity/basic --- Sanity/basic/mail | 21 ++++++++++++ Sanity/basic/main.fmf | 24 ++++++++++++++ Sanity/basic/mutt.exp | 8 +++++ Sanity/basic/run-test.sh | 4 +++ Sanity/basic/runtest.sh | 72 ++++++++++++++++++++++++++++++++++++++++ plans/all.fmf | 5 +++ 6 files changed, 134 insertions(+) create mode 100644 Sanity/basic/mail create mode 100644 Sanity/basic/main.fmf create mode 100644 Sanity/basic/mutt.exp create mode 100644 Sanity/basic/run-test.sh create mode 100755 Sanity/basic/runtest.sh create mode 100644 plans/all.fmf diff --git a/Sanity/basic/mail b/Sanity/basic/mail new file mode 100644 index 0000000..90fec0f --- /dev/null +++ b/Sanity/basic/mail @@ -0,0 +1,21 @@ +From root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com Fri Jun 21 06:16:44 2019 +Return-Path: +X-Original-To: root +Delivered-To: root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com +Received: by ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com (Postfix, from userid 0) + id 881FF200019C; Fri, 21 Jun 2019 06:16:36 -0400 (EDT) +Date: Fri, 21 Jun 2019 06:16:36 -0400 +To: root@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com +Subject: lala +User-Agent: Heirloom mailx 12.5 7/5/10 +MIME-Version: 1.0 +Content-Type: text/html; charset=us-ascii +Content-Transfer-Encoding: 7bit +Message-Id: <20190621101644.881FF200019C@ci-vm-10-0-136-117.hosted.upshift.rdu2.redhat.com> +From: root +Status: RO + + +lsdlsl + + diff --git a/Sanity/basic/main.fmf b/Sanity/basic/main.fmf new file mode 100644 index 0000000..2c096cf --- /dev/null +++ b/Sanity/basic/main.fmf @@ -0,0 +1,24 @@ +summary: Basic sanity test +description: '' +contact: fhrdina@redhat.com +component: + - mailcap +test: ./runtest.sh +framework: beakerlib +recommend: + - mailcap + - mutt + - expect +duration: 20m +enabled: true +tag: + - Tier1 +tier: '1' +adjust: + - enabled: false + when: distro < rhel-8 + continue: false +extra-nitrate: TC#0601873 +extra-summary: /CoreOS/mailcap/Sanity/basic +extra-task: /CoreOS/mailcap/Sanity/basic +id: 82030add-7735-45f6-b211-d90f8747605a \ No newline at end of file diff --git a/Sanity/basic/mutt.exp b/Sanity/basic/mutt.exp new file mode 100644 index 0000000..f73f291 --- /dev/null +++ b/Sanity/basic/mutt.exp @@ -0,0 +1,8 @@ +spawn mutt +expect "q:Quit" { + sleep 2 + send "\r"; send "qq"; +} + +interact + diff --git a/Sanity/basic/run-test.sh b/Sanity/basic/run-test.sh new file mode 100644 index 0000000..9745ff5 --- /dev/null +++ b/Sanity/basic/run-test.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +rm -rf /tmp/testing +echo "123 hello world We are here" > /tmp/testing diff --git a/Sanity/basic/runtest.sh b/Sanity/basic/runtest.sh new file mode 100755 index 0000000..81e077b --- /dev/null +++ b/Sanity/basic/runtest.sh @@ -0,0 +1,72 @@ +#!/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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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" + +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 + rlRun "script -qfec 'expect -f ./mutt.exp'" + 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 diff --git a/plans/all.fmf b/plans/all.fmf new file mode 100644 index 0000000..e1a0780 --- /dev/null +++ b/plans/all.fmf @@ -0,0 +1,5 @@ +summary: Run all tests +discover: + how: fmf +execute: + how: tmt