fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eryu Guan <guaneryu@gmail.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value
Date: Sun, 9 Feb 2020 23:29:54 +0800	[thread overview]
Message-ID: <20200209152954.GE2697@desktop> (raw)
In-Reply-To: <158086092087.1989378.18220785148122680849.stgit@magnolia>

On Tue, Feb 04, 2020 at 04:02:00PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If xfs_io's utimes command cannot interpret the arguments that are given
> to it, it will print out "Bad value for [am]time".  Detect when this
> happens and drop the file out of the test entirely.
> 
> This is particularly noticeable on 32-bit platforms and the largest
> timestamp seconds supported by the filesystem is INT_MAX.  In this case,
> the maximum value we can cram into tv_sec is INT_MAX, and there is no
> way to actually test setting a timestamp of INT_MAX + 1 to test the
> clamping.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/generic/402 |   11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/tests/generic/402 b/tests/generic/402
> index 2a34d127..32988866 100755
> --- a/tests/generic/402
> +++ b/tests/generic/402
> @@ -63,10 +63,19 @@ run_test_individual()
>  	# check if the time needs update
>  	if [ $update_time -eq 1 ]; then
>  		echo "Updating file: $file to timestamp $timestamp"  >> $seqres.full
> -		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
> +		$XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file >> $tmp.utimes 2>&1

Agree with Amir here, ">" whould be better, instead of appending.

> +		cat $tmp.utimes >> $seqres.full
> +		if grep -q "Bad value" "$tmp.utimes"; then

Echo a message to $seqres.full about this test being skipped?

> +			rm -f $file $tmp.utimes
> +			return
> +		fi
> +		cat $tmp.utimes
> +		rm $tmp.utimes
>  		if [ $? -ne 0 ]; then

So here we test the result of "rm $tmp.utimes"? I guess that's always a
pass.

>  			echo "Failed to update times on $file" | tee -a $seqres.full
>  		fi
> +	else
> +		test -f $file || return

Same here, better to be verbose about skipping test.

Thanks,
Eryu

>  	fi
>  
>  	tsclamp=$((timestamp<tsmin?tsmin:timestamp>tsmax?tsmax:timestamp))
> 

  parent reply	other threads:[~2020-02-09 15:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05  0:01 [PATCH 0/5] fstests: random fixes Darrick J. Wong
2020-02-05  0:01 ` [PATCH 1/5] xfs/449: filter out "Discarding..." from output Darrick J. Wong
2020-02-06  4:44   ` Zorro Lang
2020-02-05  0:01 ` [PATCH 2/5] xfs/020: fix truncation test Darrick J. Wong
2020-02-06  4:44   ` Zorro Lang
2020-02-05  0:02 ` [PATCH 3/5] generic/402: skip test if xfs_io can't parse the date value Darrick J. Wong
2020-02-05  6:55   ` Amir Goldstein
2020-02-09 15:29   ` Eryu Guan [this message]
2020-02-11 15:20     ` Darrick J. Wong
2020-02-05  0:02 ` [PATCH 4/5] xfs/117: fix inode corruption loop Darrick J. Wong
2020-02-06  4:50   ` Zorro Lang
2020-02-05  0:02 ` [PATCH 5/5] fsx: support 64-bit operation counts Darrick J. Wong
2020-02-06  4:57   ` Zorro Lang
2020-02-06 17:51     ` Darrick J. Wong

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=20200209152954.GE2697@desktop \
    --to=guaneryu@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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).