adding new test

This commit is contained in:
Ondrej Mejzlik 2023-02-15 10:09:57 +01:00
commit 0865c2ad60
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,27 @@
summary: smoke test
description: ''
contact: Petr Sklenar <psklenar@redhat.com>
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

70
Sanity/smoke-test/runtest.sh Executable file
View file

@ -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 <jskarvad@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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