This commit is contained in:
František Hrdina 2024-07-09 13:50:33 +02:00
commit a44682b4aa
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,23 @@
summary: lockdev test
description: ''
contact: Lukas Zachar <lzachar@redhat.com>
component:
- lockdev
test: ./runtest.sh
framework: beakerlib
recommend:
- lockdev
duration: 5m
enabled: true
tag:
- Tier1
tier: '1'
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=149468
adjust:
- enabled: false
when: distro < rhel-8
continue: false
extra-nitrate: TC#0315571
extra-summary: /CoreOS/lockdev/subdirs
extra-task: /CoreOS/lockdev/subdirs

49
Sanity/lockdev-test/runtest.sh Executable file
View file

@ -0,0 +1,49 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1
CMD=${CMD:-"lockdev"}
DEVICE="/dev/input/mice"
LOCK="/var/lock/lockdev/LCK..input:mice"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm lockdev
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "pushd $tmp"
export LANG=C
rlPhaseEnd
rlPhaseStartTest
if [ -f "$LOCK" ]; then
rlLogWarning "[already locked $DEVICE]"
rlDie "Terminate test, device already locked"
fi
if [ -e "$DEVICE" ]; then
rlRun "$CMD -l $DEVICE" 0 "Lock device"
# lock file expected
if [ -f "$LOCK" ]; then
rlPass "Lockfile exists"
rlRun "$CMD -u $DEVICE" 0 "Unlock device"
# lock file unexpected
if [ -f "$LOCK" ]; then
rlFail "FAIL [remove $LOCK]"
else
rlPass "Remove succesfful"
fi
else
rlFail "Fail [create $LOCK]"
rlRun "$CMD -u $DEVICE" 0 "Unlock device"
fi
else
rlLogWarning "[missing $DEVICE]"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd