FS/XFS testing framework
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Naohiro Aota <naohiro.aota@wdc.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] common/rc: check error case and fail the test
Date: Wed, 27 Sep 2023 07:33:47 -0700	[thread overview]
Message-ID: <20230927143347.GD11423@frogsfrogsfrogs> (raw)
In-Reply-To: <20230927061100.95365-1-naohiro.aota@wdc.com>

On Wed, Sep 27, 2023 at 03:11:00PM +0900, Naohiro Aota wrote:
> If we place /var/lib/xfstests on a read-only filesystem, commands in
> _link_out_file_named() fail to modify the files. However, they won't fail
> the test. As a result, the test case fails mysteriously with only "no
> qualified output" printed.
> 
> Fix it by checking the error case.
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
> ---
>  common/rc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index 76a7e7740318..4e9bd34f7772 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3431,8 +3431,8 @@ _link_out_file_named()
>  		}
>  		print $result
>  		' <$seqfull.cfg)
> -	rm -f $1
> -	ln -fs $(basename $1).$suffix $1
> +	rm -f $1 || _fail "_link_out_file_named: failed to remove existing output file"
> +	ln -fs $(basename $1).$suffix $1 || _fail "_link_out_file_named: failed to setup output file"

For the second _fail, you could improve the diagnostic output by
specifying /which/ output file couldn't be linked, e.g.

	ln -fs $(basename $1).$suffix $1 || \
		_fail "$(basename $1).$suffix: could not setup output file"

Since there's always the possibility of Weird Things happening, like
project quota ENOSPC/EXDEV failures, ro mounts, and other strange things
that might be a consequence of the file the test picked.

With that changed,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

>  }
>  
>  _link_out_file()
> -- 
> 2.42.0
> 

      reply	other threads:[~2023-09-27 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-27  6:11 [PATCH] common/rc: check error case and fail the test Naohiro Aota
2023-09-27 14:33 ` Darrick J. Wong [this message]

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=20230927143347.GD11423@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=naohiro.aota@wdc.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