mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 16:35:02 +01:00
Regression swap test: skip with failure if on tmpfs
The regression swap test attempts to activate a swap file in a directory under where tmpdir is set in uservars.inc; if this is a tmpfs filesystem, this will fail (it's kind of silly to create a swap file on a tmpfs, a memory-backed filesystem). This patch adds a check to the swap test script and skips the tests if it detects it's on tmpfs and marks the test as a failure if the check fails. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
ad2973e89f
commit
6557090ac3
1 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,15 @@ bin=$pwd
|
|||
## A. SWAP
|
||||
##
|
||||
|
||||
# check if we can run the test at all
|
||||
fstype=$(stat -f --format '%T' "${tmpdir}")
|
||||
if [ "${fstype}" == "tmpfs" ] ; then
|
||||
echo "ERROR: tmpdir '${tmpdir}' is of type tmpfs; can't mount a swapfile on it" 1>&2
|
||||
echo "ERROR: skipping swap tests" 1>&2
|
||||
num_testfailures=1
|
||||
exit
|
||||
fi
|
||||
|
||||
swap_file=$tmpdir/swapfile
|
||||
|
||||
dd if=/dev/zero of=${swap_file} bs=1024 count=512 2> /dev/null
|
||||
|
|
Loading…
Add table
Reference in a new issue