Skip to contentSkip to conversation

260: Add another corner case where length is zero

PATCH In review Lukas Czerner 3 participants 6 messages Oct 9, 2012 – Oct 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 260: Add another corner case where length is zero

This commit adds another corner case to test FITRIM argument handling. In this case we set length to zero and we expect the number of discarded bytes to be obviously zero, however we've had bug in both ext4 and xfs where the internal variable would underflow. This test case will be able to catch that in future.

---
 260 |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
260 +13 -0
index b005cd3..2ade9b3 100755
@@ -98,6 +98,19 @@ _scratch_unmount
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
+# This should return zero
+out=$("$FSTRIM" -v -s0 -l0 $SCRATCH_MNT)
+bytes=${out%% *}
+if [ $bytes -ne 0 ]; then
+	status=1
+	echo "We requested zero bytes to be discarded, however $bytes bytes"\
+	     "were discarded instead. Length handling probably underflowed."
+fi
+
+_scratch_unmount
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
 # This is a bit fuzzy, but since the file system is fresh
 # there should be at least (fssize/2) free space to trim.
 # This is supposed to catch wrong FITRIM argument handling
Signature · 6 lines
1.7.7.6

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/1
#1 lore raw
Quoted 42 lines · Lukas Czerner

This commit adds another corner case to test FITRIM argument handling. In this case we set length to zero and we expect the number of discarded bytes to be obviously zero, however we've had bug in both ext4 and xfs where the internal variable would underflow. This test case will be able to catch that in future.

---
 260 |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
260 +13 -0
index b005cd3..2ade9b3 100755
@@ -98,6 +98,19 @@ _scratch_unmount
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount
 
+# This should return zero
+out=$("$FSTRIM" -v -s0 -l0 $SCRATCH_MNT)
+bytes=${out%% *}
+if [ $bytes -ne 0 ]; then
+	status=1
+	echo "We requested zero bytes to be discarded, however $bytes bytes"\
+	     "were discarded instead. Length handling probably underflowed."
+fi
+
+_scratch_unmount
+_scratch_mkfs >/dev/null 2>&1
+_scratch_mount
+
 # This is a bit fuzzy, but since the file system is fresh
 # there should be at least (fssize/2) free space to trim.
 # This is supposed to catch wrong FITRIM argument handling
Signature · 6 lines
1.7.7.6

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

Looks good,

Signature · 6 lines
--Carlos

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

This commit adds another corner case to test FITRIM argument handling. In this case we set length to zero and we expect the number of discarded bytes to be obviously zero, however we've had bug in both ext4 and xfs where the internal variable would underflow. This test case will be able to catch that in future.

I'd create another test for this, rather than making 260 suddenly fail for everyone....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

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

Date: Wed, 10 Oct 2012 06:40:19 +1100
From: Dave Chinner <[email protected]>
To: Lukas Czerner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] 260: Add another corner case where length is zero

Quoted 6 lines · Lukas Czerner

This commit adds another corner case to test FITRIM argument handling. In this case we set length to zero and we expect the number of discarded bytes to be obviously zero, however we've had bug in both ext4 and xfs where the internal variable would underflow. This test case will be able to catch that in future.

Quoted 4 lines
Quoted 1 line

I'd create another test for this, rather than making 260 suddenly fail for everyone....

Hmm, I am not sure what is the point. I've created 260 exactly for this reason of testing FITRIM argument handling and it already contains number of tests like this one. I am not strongly against having this in separate test, however it seems rather unnecessary to me.

Thanks!
-Lukas

Quoted 5 lines

Cheers,

Dave.

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

#4 lore raw
Quoted 17 lines · Lukáš Czerner
Quoted 15 lines · Dave Chinner

Date: Wed, 10 Oct 2012 06:40:19 +1100
From: Dave Chinner <[email protected]>
To: Lukas Czerner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] 260: Add another corner case where length is zero

Quoted 7 lines · Lukas Czerner

This commit adds another corner case to test FITRIM argument handling. In this case we set length to zero and we expect the number of discarded bytes to be obviously zero, however we've had bug in both ext4 and xfs where the internal variable would underflow. This test case will be able to catch that in future.

Quoted 8 lines
Quoted 2 lines

I'd create another test for this, rather than making 260 suddenly fail for everyone....

Hmm, I am not sure what is the point. I've created 260 exactly for this reason of testing FITRIM argument handling and it already contains number of tests like this one. I am not strongly against having this in separate test, however it seems rather unnecessary to me.

IT's a regression test - it's only supposed to start failing when the kernel functionality is broken. That is, someone who is tracking failures over time will suddenly see a new failure in 260 and wonder what kernel code broke, when in fact nothing was changed in the kernel code. IOWs, changing the test invalidates all past history of running the test, and that in turn breaks historic regression tracking metrics...

This is why we historically have avoided changing existing tests and instead wrote new tests, no matter how similar the functionality between the old and new tests are.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#5 lore raw
Quoted 41 lines · Dave Chinner

Date: Wed, 10 Oct 2012 08:39:13 +1100
From: Dave Chinner <[email protected]>
To: Lukáš Czerner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] 260: Add another corner case where length is zero

Quoted 17 lines · Lukáš Czerner
Quoted 15 lines · Dave Chinner

Date: Wed, 10 Oct 2012 06:40:19 +1100
From: Dave Chinner <[email protected]>
To: Lukas Czerner <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] 260: Add another corner case where length is zero

Quoted 7 lines · Lukas Czerner

This commit adds another corner case to test FITRIM argument handling. In this case we set length to zero and we expect the number of discarded bytes to be obviously zero, however we've had bug in both ext4 and xfs where the internal variable would underflow. This test case will be able to catch that in future.

Quoted 8 lines
Quoted 2 lines

I'd create another test for this, rather than making 260 suddenly fail for everyone....

Hmm, I am not sure what is the point. I've created 260 exactly for this reason of testing FITRIM argument handling and it already contains number of tests like this one. I am not strongly against having this in separate test, however it seems rather unnecessary to me.

IT's a regression test - it's only supposed to start failing when the kernel functionality is broken. That is, someone who is tracking failures over time will suddenly see a new failure in 260 and wonder what kernel code broke, when in fact nothing was changed in the kernel code. IOWs, changing the test invalidates all past history of running the test, and that in turn breaks historic regression tracking metrics...

Quoted 8 lines

This is why we historically have avoided changing existing tests and instead wrote new tests, no matter how similar the functionality between the old and new tests are.

Cheers,

Dave.

Fair enough. I'll create a separate test for this.

Thanks!
-Lukas

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