From 0865c2ad602ff4dafd26a95c9b68d1dcae7b8e49 Mon Sep 17 00:00:00 2001 From: Ondrej Mejzlik Date: Wed, 15 Feb 2023 10:09:57 +0100 Subject: [PATCH] adding new test --- Sanity/smoke-test/main.fmf | 27 ++++++++++++++ Sanity/smoke-test/runtest.sh | 70 ++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 Sanity/smoke-test/main.fmf create mode 100755 Sanity/smoke-test/runtest.sh diff --git a/Sanity/smoke-test/main.fmf b/Sanity/smoke-test/main.fmf new file mode 100644 index 0000000..2c1ab5d --- /dev/null +++ b/Sanity/smoke-test/main.fmf @@ -0,0 +1,27 @@ +summary: smoke test +description: '' +contact: Petr Sklenar +component: +- dosfstools +test: ./runtest.sh +framework: beakerlib +recommend: +- dosfstools +duration: 10m +enabled: true +tag: +- NoRHEL4 +- NoRHEL5 +- TIPfail_infra +- TIPfail_samba +- TIPfail_systemd +- TIPpass +- Tier1 +tier: '1' +adjust: +- enabled: false + when: distro == rhel-4, rhel-5 + continue: false +extra-nitrate: TC#0598802 +extra-summary: /CoreOS/dosfstools/Sanity/smoke-test +extra-task: /CoreOS/dosfstools/Sanity/smoke-test diff --git a/Sanity/smoke-test/runtest.sh b/Sanity/smoke-test/runtest.sh new file mode 100755 index 0000000..b3b20d2 --- /dev/null +++ b/Sanity/smoke-test/runtest.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/dosfstools/Sanity/smoke-test +# Description: smoke test +# Author: Jaroslav Skarvada +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2018 Red Hat, Inc. +# +# 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/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="dosfstools" + +IMG="img.img" +# size in MB +IMG_SIZE="100" +MNT="mnt" +TEST_FILE="test.txt" +TEST_PATTERN="Hello world!" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlRun "dd if=/dev/zero of=$IMG bs=1M count=$IMG_SIZE" + rlRun "echo 'Hello world!' > $TEST_FILE" 0 "Creating testfile $TEST_FILE" + rlRun "mkdir mnt" 0 "Creating mountpoint $MNT" + rlPhaseEnd + + rlPhaseStartTest + rlRun "mkfs.vfat $IMG" 0 "Creating VFAT" + rlRun "mount -o loop $IMG $MNT" 0 "Loop mounting $IMG" + rlRun "cp $TEST_FILE $MNT" 0 "Copying file to VFAT" + rlRun "umount $MNT" 0 "Unmounting $MNT" + rlAssertNotExists "$MNT/$TEST_FILE" + rlRun "mount -o loop $IMG $MNT" 0 "Loop mounting $IMG" + rlAssertGrep "$TEST_PATTERN" "$MNT/$TEST_FILE" + rlRun "umount $MNT" 0 "Unmounting $MNT" + rlRun "fsck.vfat -n $IMG" 0 "Checking VFAT filesystem" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rmdir $MNT" 0 "Removing mountpoint $MNT" + rlRun "rm -f $IMG $TEST_FILE" 0 "Removing files" + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd