fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Pavel Reichl <preichl@redhat.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] generic/495: split the test
Date: Wed, 21 Apr 2021 12:19:05 -0400	[thread overview]
Message-ID: <YIBQeWVBJOj2PY0j@bfoster> (raw)
In-Reply-To: <20210420223044.51214-1-preichl@redhat.com>

On Wed, Apr 21, 2021 at 12:30:44AM +0200, Pavel Reichl wrote:
> Split each swap-file test into its own test. So on file-systems that
> do not support e.g. sparse files (exfat) other swap-file tests can be
> executed.
> 
> Signed-off-by: Pavel Reichl <preichl@redhat.com>
> ---
>  tests/generic/495     | 14 ++----------
>  tests/generic/495.out |  3 ---
>  tests/generic/634     | 50 +++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/634.out |  2 ++
>  tests/generic/group   |  1 +
>  5 files changed, 55 insertions(+), 15 deletions(-)
>  create mode 100755 tests/generic/634
>  create mode 100644 tests/generic/634.out
> 
...
> diff --git a/tests/generic/634 b/tests/generic/634
> new file mode 100755
> index 00000000..069d9f0e
> --- /dev/null
> +++ b/tests/generic/634
> @@ -0,0 +1,50 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2018 Facebook. All Rights Reserved.
> +#
> +# FS QA Test 634
> +#
> +# Test invalid swap files.
> +# Empty swap file (only swap header)
> +#
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1	# failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +	rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +_supported_fs generic
> +_require_scratch_swapfile
> +_require_test_program mkswap
> +_require_test_program swapon
> +
> +_scratch_mkfs >> $seqres.full 2>&1
> +_scratch_mount
> +
> +rm -f "$SCRATCH_MNT/swap"

This looks spurious now that the fs is initially clean. Otherwise LGTM:

Reviewed-by: Brian Foster <bfoster@redhat.com>

> +touch "$SCRATCH_MNT/swap"
> +$CHATTR_PROG +C "$SCRATCH_MNT/swap" >> $seqres.full 2>&1
> +chmod 0600 "$SCRATCH_MNT/swap"
> +_pwrite_byte 0x61 0 $(get_page_size) "$SCRATCH_MNT/swap" >> $seqres.full
> +"$here/src/mkswap" "$SCRATCH_MNT/swap"
> +"$here/src/swapon" "$SCRATCH_MNT/swap"
> +swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1
> +
> +status=0
> +exit
> diff --git a/tests/generic/634.out b/tests/generic/634.out
> new file mode 100644
> index 00000000..b90e5758
> --- /dev/null
> +++ b/tests/generic/634.out
> @@ -0,0 +1,2 @@
> +QA output created by 634
> +swapon: Invalid argument
> diff --git a/tests/generic/group b/tests/generic/group
> index 033465f1..158d759b 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -636,3 +636,4 @@
>  631 auto rw overlay rename
>  632 auto quick mount
>  633 auto quick atime attr cap idmapped io_uring mount perms rw unlink
> +634 auto quick swap
> -- 
> 2.30.2
> 


  reply	other threads:[~2021-04-21 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 22:30 [PATCH] generic/495: split the test Pavel Reichl
2021-04-21 16:19 ` Brian Foster [this message]
2021-04-23 10:10   ` Pavel Reichl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YIBQeWVBJOj2PY0j@bfoster \
    --to=bfoster@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=preichl@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).