[apparmor] [patch] regression swap test: skip if on tmpfs
John Johansen
john.johansen at canonical.com
Wed Mar 19 08:31:29 UTC 2014
On 03/19/2014 12:29 AM, Steve Beattie wrote:
> The regression swap test attempts to activate a swap file in a directory
> under where the tmpdir[1] 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 i.e. a memory-backed filesystem). This patch adds a check for
> that to the swap test script, skips the tests and marks the test as a
> failure if the check fails.
>
> [1] Sadly, it does not honor TMPDIR.
>
> Signed-off-by: Steve Beattie <steve at nxnw.org>
Acked-by: John Johansen <john.johansen at canonical.com>
> ---
> tests/regression/apparmor/swap.sh | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> Index: b/tests/regression/apparmor/swap.sh
> ===================================================================
> --- a/tests/regression/apparmor/swap.sh
> +++ b/tests/regression/apparmor/swap.sh
> @@ -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
>
>
>
More information about the AppArmor
mailing list