diff mbox

[2/2] fstests: give user friendly prompts for already mounted dir

Message ID 1452148649-22451-3-git-send-email-hejianet@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jia He Jan. 7, 2016, 6:37 a.m. UTC
This adds user friendly prompts to output the already mounted line from _mount.
xfstests will do the cleanup (ie. umount) and user can not get the mount directory
information.

Signed-off-by: Jia He <hejianet@gmail.com>
---
 common/rc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Dave Chinner Jan. 10, 2016, 11:29 p.m. UTC | #1
On Thu, Jan 07, 2016 at 02:37:29PM +0800, Jia He wrote:
> This adds user friendly prompts to output the already mounted line from _mount.
> xfstests will do the cleanup (ie. umount) and user can not get the mount directory
> information.
> 
> Signed-off-by: Jia He <hejianet@gmail.com>
> ---
>  common/rc | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index d33e3fb..5b40fb4 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1271,7 +1271,9 @@ _require_scratch_nocheck()
>          # if it's mounted, make sure its on $SCRATCH_MNT
>          if ! _mount | grep -F $SCRATCH_DEV | grep -q $SCRATCH_MNT
>          then
> -            echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
> +            echo "\$SCRATCH_DEV=$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT=$SCRATCH_MNT - aborting"
> +            echo "Already mounted result:"
> +            _mount | grep -F $SCRATCH_DEV
>              exit 1
>          fi

Should use a temporary local variable rather than looking at the
mount table twice. e.g.

	mount_rec=`_mount | grep -F $SCRATCH_DEV`
	echo $mount_rec | grep -q $SCRATCH_MNT
	if [ $? -ne 0 ]; then
		# new error message
		echo $mount_rec
	fi

Cheers,

Dave.
Jia He Jan. 11, 2016, 5:20 a.m. UTC | #2
? 1/11/16 7:29 AM, Dave Chinner ??:
> On Thu, Jan 07, 2016 at 02:37:29PM +0800, Jia He wrote:
>> This adds user friendly prompts to output the already mounted line from _mount.
>> xfstests will do the cleanup (ie. umount) and user can not get the mount directory
>> information.
>>
>> Signed-off-by: Jia He <hejianet@gmail.com>
>> ---
>>   common/rc | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/common/rc b/common/rc
>> index d33e3fb..5b40fb4 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -1271,7 +1271,9 @@ _require_scratch_nocheck()
>>           # if it's mounted, make sure its on $SCRATCH_MNT
>>           if ! _mount | grep -F $SCRATCH_DEV | grep -q $SCRATCH_MNT
>>           then
>> -            echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
>> +            echo "\$SCRATCH_DEV=$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT=$SCRATCH_MNT - aborting"
>> +            echo "Already mounted result:"
>> +            _mount | grep -F $SCRATCH_DEV
>>               exit 1
>>           fi
> Should use a temporary local variable rather than looking at the
> mount table twice. e.g.
>
> 	mount_rec=`_mount | grep -F $SCRATCH_DEV`
> 	echo $mount_rec | grep -q $SCRATCH_MNT
> 	if [ $? -ne 0 ]; then
> 		# new error message
> 		echo $mount_rec
> 	fi
Thanks? Dave
v3 is sending.

B.R.
Justin
>
> Cheers,
>
> Dave.

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/rc b/common/rc
index d33e3fb..5b40fb4 100644
--- a/common/rc
+++ b/common/rc
@@ -1271,7 +1271,9 @@  _require_scratch_nocheck()
         # if it's mounted, make sure its on $SCRATCH_MNT
         if ! _mount | grep -F $SCRATCH_DEV | grep -q $SCRATCH_MNT
         then
-            echo "\$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT - aborting"
+            echo "\$SCRATCH_DEV=$SCRATCH_DEV is mounted but not on \$SCRATCH_MNT=$SCRATCH_MNT - aborting"
+            echo "Already mounted result:"
+            _mount | grep -F $SCRATCH_DEV
             exit 1
         fi
         # and then unmount it
@@ -1353,7 +1355,9 @@  _require_test()
         # if it's mounted, make sure its on $TEST_DIR
         if ! _mount | grep -F $TEST_DEV | grep -q $TEST_DIR
         then
-            echo "\$TEST_DEV is mounted but not on \$TEST_DIR - aborting"
+            echo "\$TEST_DEV=$TEST_DEV is mounted but not on \$TEST_DIR=$TEST_DIR - aborting"
+            echo "Already mounted result:"
+            _mount | grep -F $TEST_DEV
             exit 1
         fi
     else