Skip to contentSkip to conversation

xfstests 233: fix user fsgqa access to fsstress

PATCH In review Tom Marek 3 participants 8 messages Apr 17, 2012 – Apr 19, 2012

lore
Share & tools
lore

Tom Marek

author
#0 lore raw

PATCH v2 1/3 xfstests 233: fix user fsgqa access to fsstress

User fsgqa may sometimes be unable to run fsstress (when xfstests are owned by root) because fsgqa doesn't have rights to list directory where the fsstress utility is located.

This fix changes directory to fsstress location as root before running fsstress so user fsgqa may run it without any problems.

---
 233 |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
233 +4 -2
index 28e6ac7..e9eacae 100755
@@ -62,14 +62,16 @@ _fsstress()
 -f rmdir=20 -f link=10 -f creat=10 -f mkdir=10 -f unlink=20 -f symlink=10 \
 -f rename=10 -f fsync=2 -f write=15 -f dwrite=15 \
 -n $count -d $out -p 7"
-
 	echo "fsstress $args" | tee -a $here/$seq.full | sed -e "s#$out#outdir#"
-	if ! su $qa_user -c "$FSSTRESS_PROG $args" | tee -a $here/$seq.full | _filter_num
+	fsstressdir=${FSSTRESS_PROG%/*}
+	cd $fsstressdir
+	if ! su $qa_user -c "./`basename $FSSTRESS_PROG` $args" | tee -a $here/$seq.full | _filter_num
 	then
 		echo "    fsstress $args returned $?"
 		cat $tmp.out | tee -a $here/$seq.full
 		status=1
 	fi
+	cd $here
 }
 
 # real QA test starts here
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#1 lore raw

PATCH v2 2/3 xfstests 198, 240, common.rc: added check for aiodio-sparse2

Tests number 198 and 240 could fail when aiodio-sparse2 was not build. _require_aiodio helper was added to common.rc file to fix this.

---
V2: check for aiodio-sparse2 was moved to helper function located in
common.rc file. _require_aiodio was added to tests 198 and 240.

 198       |    2 ++
 240       |    1 +
 common.rc |    8 ++++++++
 3 files changed, 11 insertions(+), 0 deletions(-)
198 +2 -0
index e46ec8d..210b7bb 100755
@@ -45,6 +45,8 @@ _cleanup()
 _supported_fs generic
 _supported_os Linux
 
+_require_aiodio
+
 echo "Silence is golden."
 
 # real QA test starts here
240 +1 -0
index 563449e..5b37bdc 100755
@@ -52,6 +52,7 @@ _supported_fs generic
 _supported_os Linux
 
 _require_sparse_files
+_require_aiodio
 
 echo "Silence is golden."
 
common.rc +8 -0
index cab0b64..7745df1 100644
@@ -770,6 +770,14 @@ _require_scratch()
     fi
 }
 
+# this test needs aio-dio-regress to be built
+#
+_require_aiodio()
+{
+    [ -x $here/src/aio-dio-regress/aiodio_sparse2 ] || \
+        _notrun "This tests requires src/aio-dio-regress/ to be built"
+}
+
 # this test needs a logdev
 #
 _require_logdev()
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw

Re: [PATCH 2/3 V2] xfstests 198, 240, common.rc: added check for aiodio-sparse2

Quoted 6 lines · Tom Marek

Tests number 198 and 240 could fail when aiodio-sparse2 was not build. _require_aiodio helper was added to common.rc file to fix this.

.....

common.rc _require_scratch() · line 779

Quoted 11 lines
common.rc +7 -0
@@ -770,6 +770,14 @@ _require_scratch()
     fi
 }
 
+# this test needs aio-dio-regress to be built
+#
+_require_aiodio()
+{
+    [ -x $here/src/aio-dio-regress/aiodio_sparse2 ] || \
+        _notrun "This tests requires src/aio-dio-regress/ to be built"
+}

This function already exists in common.rc, which is why I pointed it out for use.

# this test requires that a (specified) aio-dio executable exists
# $1 - command (optional)
#
_require_aiodio()
{
    if [ -z "$1" ]
    then
        AIO_TEST=src/aio-dio-regress/aiodio_sparse2
        [ -x $AIO_TEST ] || _notrun "aio-dio utilities required"
    else
        AIO_TEST=src/aio-dio-regress/$1
        [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
    fi
}

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw

Re: [PATCH 2/3 V2] xfstests 198, 240, common.rc: added check for aiodio-sparse2

Quoted 38 lines · Dave Chinner
Quoted 6 lines · Tom Marek

Tests number 198 and 240 could fail when aiodio-sparse2 was not build. _require_aiodio helper was added to common.rc file to fix this.

.....

common.rc _require_scratch() · line 779

Quoted 11 lines
common.rc +7 -0
@@ -770,6 +770,14 @@ _require_scratch()
     fi
 }
 
+# this test needs aio-dio-regress to be built
+#
+_require_aiodio()
+{
+    [ -x $here/src/aio-dio-regress/aiodio_sparse2 ] || \
+        _notrun "This tests requires src/aio-dio-regress/ to be built"
+}

This function already exists in common.rc, which is why I pointed it out for use.

# this test requires that a (specified) aio-dio executable exists
# $1 - command (optional)
#
_require_aiodio()
{
    if [ -z "$1" ]
    then
        AIO_TEST=src/aio-dio-regress/aiodio_sparse2
        [ -x $AIO_TEST ] || _notrun "aio-dio utilities required"
    else
        AIO_TEST=src/aio-dio-regress/$1
        [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
    fi
}
Quoted 3 lines

Cheers,

Dave.

Hi Tom,

did you use the git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
repository for the xfstests ? The one I've been using (from oss.sgi.com) is terribly out of date so it does not have _require_aiodio() yet.

Thanks!
-Lukas

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#4 lore raw

Re: [PATCH 2/3 V2] xfstests 198, 240, common.rc: added check for aiodio-sparse2

Quoted 44 lines · Lukas Czerner
Quoted 37 lines · Dave Chinner
Quoted 6 lines · Tom Marek

Tests number 198 and 240 could fail when aiodio-sparse2 was not build. _require_aiodio helper was added to common.rc file to fix this.

.....

common.rc _require_scratch() · line 779

Quoted 11 lines
common.rc +7 -0
@@ -770,6 +770,14 @@ _require_scratch()
      fi
  }
 
+# this test needs aio-dio-regress to be built
+#
+_require_aiodio()
+{
+    [ -x $here/src/aio-dio-regress/aiodio_sparse2 ] || \
+        _notrun "This tests requires src/aio-dio-regress/ to be built"
+}

This function already exists in common.rc, which is why I pointed it out for use.

# this test requires that a (specified) aio-dio executable exists
# $1 - command (optional)
#
_require_aiodio()
{
     if [ -z "$1" ]
     then
         AIO_TEST=src/aio-dio-regress/aiodio_sparse2
         [ -x $AIO_TEST ] || _notrun "aio-dio utilities required"
     else
         AIO_TEST=src/aio-dio-regress/$1
         [ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
     fi
}
Quoted 3 lines

Cheers,

Dave.

Hi Tom,

Quoted 7 lines

did you use the git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
repository for the xfstests ? The one I've been using (from oss.sgi.com) is terribly out of date so it does not have _require_aiodio() yet.

Thanks!
-Lukas

Hi Lukas,

unfortunately I was using that old repository on oos.sgi.com. Thanks!

T.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

author
#5 lore raw

PATCH v2 3/3 xfstests 273: fix of reading scratch size and removing lost+found

In reply to Tom Marek

There were two reasons why test 273 was failing. Firstrly, it was removing everything from SCRATCH_MNT directory at the beginning of tests including the lost+found directory. This cauesd error while checking scratch fs after finishing test. Secondly, obtaining of the partition size was not counting with with behaviour of df utility which may split the line containg informations about one partition when it is too long thus it may have returned nothing.

First problem was solved with removing all unnecessary rm -rf commands and the second one was fixed with alternative awk script which is able to deal with any line splitting possible.

---
 273 |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
273 +4 -6
index 2965132..86262d1 100755
@@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
 	cd /
-	rm -rf $SCRATCH_MNT/* $tmp.*
+	rm -rf $tmp.*
 	_scratch_unmount
 }
 
@@ -66,9 +66,9 @@ _file_create()
 		exit
 	fi
 
-	cd $SCRATCH_MNT/origin
+	cd $SCRATCH_MNT
 
-	_disksize=`df --block-size=1 | grep $SCRATCH_DEV | awk '{print $2}'`
+	_disksize=`df --block-size=1 $SCRATCH_DEV | awk -v sd=$SCRATCH_DEV 'BEGIN{c=0}{for(i=1;i<=NF;++i){a[c]=$i;++c}}END{for(entry in a){if(a[entry] ~ sd){print a[entry + 3]; break}}}'`
 	_disksize=$(($_disksize / 3))
 	_num=$(($_disksize / $count / $threads / 4096))
 	_count=$count
@@ -105,8 +105,6 @@ _do_workload()
 {
 	_pids=""
 	_pid=1
-	
-	rm -rf $SCRATCH_MNT/*
 
 	_threads_set
 	_file_create
@@ -134,7 +132,7 @@ echo "------------------------------"
 
 rm -f $seq.full
 
-umount $SCRATCH_DEV 2>/dev/null
+_scratch_unmount 2>/dev/null
 _scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seq.full 2>&1
 _scratch_mount
 
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#6 lore raw
In reply to Tom Marek
Quoted 3 lines · Tom Marek

User fsgqa may sometimes be unable to run fsstress (when xfstests are owned by root) because fsgqa doesn't have rights to list directory where the fsstress utility is located.

That sounds like an installation problem, not something that needs to be worked around in the tests. Indeed, this problem woul dmean that the fsgqa user woul dnot be able to execute anything in the src/, ltp/ or tools/ subdirectories, and I don't think we want to work around all those sorts of problems in tests like this.

Indeed, if you look at the make install rules, the install rule for the ltp/ subdir does:

....
TARGETS = doio fsstress fsx growfiles iogen
SCRIPTS = rwtest.sh
.....
install: default

        $(INSTALL) -m 755 -d $(PKG_LIB_DIR)/ltp
        $(INSTALL) -m 755 $(TARGETS) $(PKG_LIB_DIR)/ltp
        $(INSTALL) -m 755 $(SCRIPTS) $(PKG_LIB_DIR)/ltp

It changes the permissions on the ltp/ directory to rwxr-xr-x, as well as for the binaries in the ltp/ subdir. This means the fsgqa user should be able to run the ltp/fsstress binary without any changes to the test scripts.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#7 lore raw
Quoted 23 lines · Dave Chinner
Quoted 3 lines · Tom Marek

User fsgqa may sometimes be unable to run fsstress (when xfstests are owned by root) because fsgqa doesn't have rights to list directory where the fsstress utility is located.

That sounds like an installation problem, not something that needs to be worked around in the tests. Indeed, this problem woul dmean that the fsgqa user woul dnot be able to execute anything in the src/, ltp/ or tools/ subdirectories, and I don't think we want to work around all those sorts of problems in tests like this.

Indeed, if you look at the make install rules, the install rule for the ltp/ subdir does:

....
TARGETS = doio fsstress fsx growfiles iogen
SCRIPTS = rwtest.sh
.....
install: default

        $(INSTALL) -m 755 -d $(PKG_LIB_DIR)/ltp
        $(INSTALL) -m 755 $(TARGETS) $(PKG_LIB_DIR)/ltp
        $(INSTALL) -m 755 $(SCRIPTS) $(PKG_LIB_DIR)/ltp
Quoted 9 lines

It changes the permissions on the ltp/ directory to rwxr-xr-x, as well as for the binaries in the ltp/ subdir. This means the fsgqa user should be able to run the ltp/fsstress binary without any changes to the test scripts.

Cheers,

Dave.

Hm, good to know. I did not knew that, there is not a word about this in README, but I could have just read the Makefile I guess. Tom could you rather fix the README ?

Thanks!
-Lukas

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs