mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 22:35:35 +00:00
tests/regression: fix mount test to use next available loop device
looping through the first 16 loop devices to find a free device will
fail if those mount devices are taken, and unfortunately there are
now services that use an excessive amount of loop devices causing
the regression test to fail.
PR: https://gitlab.com/apparmor/apparmor/merge_requests/379
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
(cherry picked from commit ab0f2af1da
)
This commit is contained in:
@@ -67,21 +67,9 @@ if [ ! -b /dev/loop0 ] ; then
|
|||||||
modprobe loop
|
modprobe loop
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# kinda ugly way of atomically finding a free loop device
|
# find the next free loop device and mount it
|
||||||
for i in $(seq 0 15)
|
loop_device=$(losetup -f) || fatalerror 'Unable to find a free loop device'
|
||||||
do
|
/sbin/losetup "$loop_device" ${mount_file} > /dev/null 2> /dev/null
|
||||||
if [ "$loop_device" = "unset" ]
|
|
||||||
then
|
|
||||||
if /sbin/losetup /dev/loop$i ${mount_file} > /dev/null 2> /dev/null
|
|
||||||
then
|
|
||||||
loop_device=/dev/loop$i;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "$loop_device" = "unset" ]
|
|
||||||
then
|
|
||||||
fatalerror 'Unable to find a free loop device'
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# TEST 1. Make sure can mount and umount unconfined
|
# TEST 1. Make sure can mount and umount unconfined
|
||||||
|
Reference in New Issue
Block a user