Skip to contentSkip to conversation

xfstests: Improve test 219 to work with different filesystems

PATCH Superseded Jan Kara 2 participants 4 messages May 19, 2011 – Jun 3, 2011

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jan Kara

author
#0 lore raw

PATCH 1/1 xfstests: Improve test 219 to work with different filesystems

Different filesystems account different amount of metadata in quota. Thus it is impractical to check for a particular amount of space occupied by a file because there is no right value. Change the test to verify whether the amount of space is between the expected amount of space and the expected amount +5%. The number of files is checked exactly as previously.

---
 219 |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

Dave, does this look better?

219 +23 -2
index 836d703..ad4e64d 100755
@@ -58,6 +58,23 @@ test_files()
 	done
 }
 
+check_usage()
+{
+	wroteblocks=$1
+	wrotefiles=$2
+	read id exceed blocks bsoft bhard inodes isoft ihard
+	if [ "$blocks" -lt "$wroteblocks" ]; then
+		echo "Too few blocks used (type=$type)"
+	# Save 5% for overhead of metadata or different block size
+	elif [ "$blocks" -gt $((wroteblocks+wroteblocks/20)) ]; then
+		echo "Too many blocks used (type=$type)"
+	elif [ "$inodes" != "$wrotefiles" ]; then
+		echo "Bad number of inodes used (type=$type)"
+	else
+		echo "Usage OK (type=$type)"
+	fi
+}
+
 test_accounting()
 {
 	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
@@ -77,8 +94,12 @@ test_accounting()
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
 
-	repquota -$type -n $SCRATCH_MNT  | grep -v "^#0" | _filter_scratch |
-	awk '/^#/ { if (seen[$1]) next; seen[$1]++; } { print; }'
+	if [ $type == 'u' ]; then
+		id=$uid
+	else
+		id=$gid
+	fi
+	repquota -$type -n $SCRATCH_MNT  | grep "^#$id" | check_usage 144 3
 }
 
 # real QA test starts here
Signature · 6 lines
1.7.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#1 lore raw
Quoted 6 lines · Jan Kara

Different filesystems account different amount of metadata in quota. Thus it is impractical to check for a particular amount of space occupied by a file because there is no right value. Change the test to verify whether the amount of space is between the expected amount of space and the expected amount +5%. The number of files is checked exactly as previously.

Quoted 6 lines
---
 219 |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

Dave, does this look better?

Any reaction on this?

Honza

Quoted 47 lines
219 +23 -2
index 836d703..ad4e64d 100755
@@ -58,6 +58,23 @@ test_files()
 	done
 }
 
+check_usage()
+{
+	wroteblocks=$1
+	wrotefiles=$2
+	read id exceed blocks bsoft bhard inodes isoft ihard
+	if [ "$blocks" -lt "$wroteblocks" ]; then
+		echo "Too few blocks used (type=$type)"
+	# Save 5% for overhead of metadata or different block size
+	elif [ "$blocks" -gt $((wroteblocks+wroteblocks/20)) ]; then
+		echo "Too many blocks used (type=$type)"
+	elif [ "$inodes" != "$wrotefiles" ]; then
+		echo "Bad number of inodes used (type=$type)"
+	else
+		echo "Usage OK (type=$type)"
+	fi
+}
+
 test_accounting()
 {
 	echo "### some controlled buffered, direct and mmapd IO (type=$type)"
@@ -77,8 +94,12 @@ test_accounting()
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
 
-	repquota -$type -n $SCRATCH_MNT  | grep -v "^#0" | _filter_scratch |
-	awk '/^#/ { if (seen[$1]) next; seen[$1]++; } { print; }'
+	if [ $type == 'u' ]; then
+		id=$uid
+	else
+		id=$gid
+	fi
+	repquota -$type -n $SCRATCH_MNT  | grep "^#$id" | check_usage 144 3
 }
 
 # real QA test starts here
Signature · 1 line
1.7.1
Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw
In reply to Jan Kara
Quoted 7 lines · Jan Kara

Different filesystems account different amount of metadata in quota. Thus it is impractical to check for a particular amount of space occupied by a file because there is no right value. Change the test to verify whether the amount of space is between the expected amount of space and the expected amount +5%. The number of files is checked exactly as previously.

I don't know enough about the differences
between filesystem quota reporting. Perhaps
that's something whose definition should be
better formalized across filesystem types.
In any case I don't outright object to
allowing the 5% variability.

I do have questions/comments about your change,
however.

Quoted 35 lines
---
 219 |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

Dave, does this look better?

219 +17 -0
index 836d703..ad4e64d 100755
@@ -58,6 +58,23 @@ test_files()
 	done
 }
 
+check_usage()
+{
+	wroteblocks=$1
+	wrotefiles=$2
+	read id exceed blocks bsoft bhard inodes isoft ihard
+	if [ "$blocks" -lt "$wroteblocks" ]; then
+		echo "Too few blocks used (type=$type)"
+	# Save 5% for overhead of metadata or different block size
+	elif [ "$blocks" -gt $((wroteblocks+wroteblocks/20)) ]; then
+		echo "Too many blocks used (type=$type)"
+	elif [ "$inodes" != "$wrotefiles" ]; then
+		echo "Bad number of inodes used (type=$type)"
+	else
+		echo "Usage OK (type=$type)"
+	fi
+}
+
 test_accounting()
 {
 	echo "### some controlled buffered, direct and mmapd IO (type=$type)"

219 test_accounting() · line 81

Quoted 5 lines
219 +0 -2
@@ -77,8 +94,12 @@ test_accounting()
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
 
-	repquota -$type -n $SCRATCH_MNT  | grep -v "^#0" | _filter_scratch |
-	awk '/^#/ { if (seen[$1]) next; seen[$1]++; } { print; }'

Why did you delete this awk line?

219 test_accounting() · line 101

Quoted 5 lines
219 +5 -0
+	if [ $type == 'u' ]; then
+		id=$uid
+	else
+		id=$gid
+	fi

This (above) seems to be doing a better job of selecting what we're interested in seeing rather than filtering out anything owned by root. Is that what you're doing here? Does doing this also eliminate duplicate entries (which I think can occur when multiple user names share the same UID, for example)?

Regardless, this hunk has nothing to do with the 5% slop that's the stated purpose of this patch. It really ought to have been done as separate (earlier) patch. Maybe this isn't a big deal for xfstests but in XFS we try to be more disciplined about that.

219 test_accounting() · line 105

Quoted 4 lines
219 +1 -0
+	repquota -$type -n $SCRATCH_MNT  | grep "^#$id" | check_usage 144 3
 }
 
 # real QA test starts here

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

author
#3 lore raw
Quoted 7 lines · Alex Elder
Quoted 6 lines · Jan Kara

Different filesystems account different amount of metadata in quota. Thus it is impractical to check for a particular amount of space occupied by a file because there is no right value. Change the test to verify whether the amount of space is between the expected amount of space and the expected amount +5%. The number of files is checked exactly as previously.

Quoted 6 lines
Quoted 1 line

I don't know enough about the differences
between filesystem quota reporting. Perhaps
that's something whose definition should be
better formalized across filesystem types.

Yes, the definition is different for different filesystems and it's kind
of hard to change it now...

Quoted 61 lines

In any case I don't outright object to
allowing the 5% variability.

I do have questions/comments about your change,
however.

Quoted 35 lines
---
 219 |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

Dave, does this look better?

219 +17 -0
index 836d703..ad4e64d 100755
@@ -58,6 +58,23 @@ test_files()
 	done
 }
 
+check_usage()
+{
+	wroteblocks=$1
+	wrotefiles=$2
+	read id exceed blocks bsoft bhard inodes isoft ihard
+	if [ "$blocks" -lt "$wroteblocks" ]; then
+		echo "Too few blocks used (type=$type)"
+	# Save 5% for overhead of metadata or different block size
+	elif [ "$blocks" -gt $((wroteblocks+wroteblocks/20)) ]; then
+		echo "Too many blocks used (type=$type)"
+	elif [ "$inodes" != "$wrotefiles" ]; then
+		echo "Bad number of inodes used (type=$type)"
+	else
+		echo "Usage OK (type=$type)"
+	fi
+}
+
 test_accounting()
 {
 	echo "### some controlled buffered, direct and mmapd IO (type=$type)"

219 test_accounting() · line 81

Quoted 5 lines
219 +0 -2
@@ -77,8 +94,12 @@ test_accounting()
 		$here/src/lstat64 $file | head -3 | _filter_scratch
 	done
 
-	repquota -$type -n $SCRATCH_MNT  | grep -v "^#0" | _filter_scratch |
-	awk '/^#/ { if (seen[$1]) next; seen[$1]++; } { print; }'

Why did you delete this awk line?

219 test_accounting() · line 101

Quoted 5 lines
219 +5 -0
+	if [ $type == 'u' ]; then
+		id=$uid
+	else
+		id=$gid
+	fi

This (above) seems to be doing a better job of selecting what we're interested in seeing rather than filtering out anything owned by root. Is that what you're doing here? Does doing this also eliminate duplicate entries (which I think can occur when multiple user names share the same UID, for example)?

Quoted 5 lines

Regardless, this hunk has nothing to do with the 5% slop that's the stated purpose of this patch. It really ought to have been done as separate (earlier) patch. Maybe this isn't a big deal for xfstests but in XFS we try to be more disciplined about that.

I've droppped the awk like because we check things differently now.
Previously we just reported all users (except root whose usage was changing depending on other things stored in the filesystem so it had to be excluded) and compared this against expected output. After my change we check only usage of a particular user used for testing and check_usage() uses just the first line of output so there's no need to remove possible duplicate entries.

So I didn't feel the particular need to separate out the change because I just viewed it as one logical change of how we check stuff...

Quoted 4 lines

219 test_accounting() · line 105

Quoted 4 lines
219 +1 -0
+	repquota -$type -n $SCRATCH_MNT  | grep "^#$id" | check_usage 144 3
 }
 
 # real QA test starts here

Honza

Signature · 7 lines
Jan Kara <[email protected]>
SUSE Labs, CR

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