diff mbox series

xfs/030: fix test for external log device

Message ID d3b3a65e-3575-f153-98ca-4a34e170ab78@redhat.com (mailing list archive)
State New, archived
Headers show
Series xfs/030: fix test for external log device | expand

Commit Message

Eric Sandeen Feb. 20, 2020, 2:16 a.m. UTC
Several tests fail if an external log device is used; in this case
the xfs_db invocation fails with a clear indication of why, so fix
that as other tests do by testing for and using the external log
option if present.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

Comments

Eric Sandeen Feb. 20, 2020, 2:20 a.m. UTC | #1
On 2/19/20 8:16 PM, Eric Sandeen wrote:
> Several tests fail if an external log device is used; in this case
> the xfs_db invocation fails with a clear indication of why, so fix
> that as other tests do by testing for and using the external log
> option if present.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

hm self-NAK I didn't realize we had _scratch_xfs_db, better to go
through and fix all of these sorts of things at once.

Luis, seems like you have an itch to scratch, no?

> ---
> 
> diff --git a/common/repair b/common/repair
> index 5a9097f4..cf69dde9 100644
> --- a/common/repair
> +++ b/common/repair
> @@ -9,8 +9,12 @@ _zero_position()
>  	value=$1
>  	struct="$2"
>  
> +	SCRATCH_OPTIONS=""
> +	[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
> +		SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
> +
>  	# set values for off/len variables provided by db
> -	eval `xfs_db -r -c "$struct" -c stack $SCRATCH_DEV | perl -ne '
> +	eval `xfs_db -r -c "$struct" -c stack $SCRATCH_OPTIONS $SCRATCH_DEV | perl -ne '
>  		if (/byte offset (\d+), length (\d+)/) {
>  			print "offset=$1\nlength=$2\n"; exit
>  		}'`
> diff --git a/tests/xfs/030 b/tests/xfs/030
> index efdb6a18..e1cc32ef 100755
> --- a/tests/xfs/030
> +++ b/tests/xfs/030
> @@ -77,7 +77,10 @@ else
>  	_scratch_unmount
>  fi
>  clear=""
> -eval `xfs_db -r -c "sb 1" -c stack $SCRATCH_DEV | perl -ne '
> +SCRATCH_OPTIONS=""
> +[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
> +	SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
> +eval `xfs_db -r -c "sb 1" -c stack $SCRATCH_OPTIONS $SCRATCH_DEV | perl -ne '
>  	if (/byte offset (\d+), length (\d+)/) {
>  		print "clear=", $1 / 512, "\n"; exit
>  	}'`
> 
>
Luis Chamberlain Feb. 20, 2020, 1:42 p.m. UTC | #2
On Wed, Feb 19, 2020 at 08:20:14PM -0600, Eric Sandeen wrote:
> On 2/19/20 8:16 PM, Eric Sandeen wrote:
> > Several tests fail if an external log device is used; in this case
> > the xfs_db invocation fails with a clear indication of why, so fix
> > that as other tests do by testing for and using the external log
> > option if present.
> > 
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> 
> hm self-NAK I didn't realize we had _scratch_xfs_db, better to go
> through and fix all of these sorts of things at once.
> 
> Luis, seems like you have an itch to scratch, no?

I didn't know it was so easy, sure! Since I test rt and logdev
on stable kernels, will give this a crack once I have my new
stable test rig running. Thanks for the proactive approach.

  Luis
diff mbox series

Patch

diff --git a/common/repair b/common/repair
index 5a9097f4..cf69dde9 100644
--- a/common/repair
+++ b/common/repair
@@ -9,8 +9,12 @@  _zero_position()
 	value=$1
 	struct="$2"
 
+	SCRATCH_OPTIONS=""
+	[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+		SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
+
 	# set values for off/len variables provided by db
-	eval `xfs_db -r -c "$struct" -c stack $SCRATCH_DEV | perl -ne '
+	eval `xfs_db -r -c "$struct" -c stack $SCRATCH_OPTIONS $SCRATCH_DEV | perl -ne '
 		if (/byte offset (\d+), length (\d+)/) {
 			print "offset=$1\nlength=$2\n"; exit
 		}'`
diff --git a/tests/xfs/030 b/tests/xfs/030
index efdb6a18..e1cc32ef 100755
--- a/tests/xfs/030
+++ b/tests/xfs/030
@@ -77,7 +77,10 @@  else
 	_scratch_unmount
 fi
 clear=""
-eval `xfs_db -r -c "sb 1" -c stack $SCRATCH_DEV | perl -ne '
+SCRATCH_OPTIONS=""
+[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+	SCRATCH_OPTIONS="-l$SCRATCH_LOGDEV"
+eval `xfs_db -r -c "sb 1" -c stack $SCRATCH_OPTIONS $SCRATCH_DEV | perl -ne '
 	if (/byte offset (\d+), length (\d+)/) {
 		print "clear=", $1 / 512, "\n"; exit
 	}'`