Skip to contentSkip to conversation

qemu-iotests: Fixed test case 026

PATCH Superseded Kevin Wolf 2 participants 4 messages Sep 2, 2013 – Sep 4, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qemu-iotests: Fixed test case 026

The reference output for test case 026 hasn't been updated in a long time and it's one of the "known failing" cases. This patch updates the reference output so that unintentional changes can be reliably detected again.

The problem with this test case is that it produces different output depending on whether -nocache is used or not. The solution of this patch is to actually have two different reference outputs. If nnn.out.nocache exists, it is used as the reference output for -nocache; otherwise, nnn.out stays valid for both cases.

---
 tests/qemu-iotests/026.out         |  28 +-
 tests/qemu-iotests/026.out.nocache | 626 +++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/check           |  12 +-
 3 files changed, 649 insertions(+), 17 deletions(-)
 create mode 100644 tests/qemu-iotests/026.out.nocache
tests/qemu-iotests/026.out +14 -14
index fb4f20e..0764389 100644
@@ -126,62 +126,64 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 Event: l2_update; errno: 5; imm: off; once: on; write 
 write failed: Input/output error
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_update; errno: 5; imm: off; once: on; write -b
 write failed: Input/output error
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_update; errno: 5; imm: off; once: off; write 
 write failed: Input/output error
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_update; errno: 5; imm: off; once: off; write -b
 write failed: Input/output error
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_update; errno: 28; imm: off; once: on; write 
 write failed: No space left on device
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_update; errno: 28; imm: off; once: on; write -b
 write failed: No space left on device
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_update; errno: 28; imm: off; once: off; write 
 write failed: No space left on device
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_update; errno: 28; imm: off; once: off; write -b
 write failed: No space left on device
 
-128 leaked clusters were found on the image.
+127 leaked clusters were found on the image.
 This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_alloc.write; errno: 5; imm: off; once: on; write 
 write failed: Input/output error
-No errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_alloc.write; errno: 5; imm: off; once: on; write -b
@@ -205,7 +207,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
 
 Event: l2_alloc.write; errno: 28; imm: off; once: on; write 
 write failed: No space left on device
-No errors were found on the image.
+
+1 leaked clusters were found on the image.
+This means waste of disk space, but no harm to data.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l2_alloc.write; errno: 28; imm: off; once: on; write -b
@@ -575,7 +579,6 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l1_grow.write_table; errno: 5; imm: off; once: off
-qcow2_free_clusters failed: Input/output error
 write failed: Input/output error
 No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
@@ -586,7 +589,6 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l1_grow.write_table; errno: 28; imm: off; once: off
-qcow2_free_clusters failed: No space left on device
 write failed: No space left on device
 No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
@@ -597,7 +599,6 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l1_grow.activate_table; errno: 5; imm: off; once: off
-qcow2_free_clusters failed: Input/output error
 write failed: Input/output error
 
 96 leaked clusters were found on the image.
@@ -610,7 +611,6 @@ No errors were found on the image.
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 
 
 Event: l1_grow.activate_table; errno: 28; imm: off; once: off
-qcow2_free_clusters failed: No space left on device
 write failed: No space left on device
 
 96 leaked clusters were found on the image.
tests/qemu-iotests/026.out.nocache new file +626 -0

626 lines not on this page · raw message

tests/qemu-iotests/check +9 -3
index 74628ae..42d6955 100755
@@ -239,12 +239,18 @@ do
 		echo -n " [failed, exit status $sts]"
 		err=true
 	    fi
-	    if [ ! -f $seq.out ]
+
+        reference=$seq.out
+        if (echo $QEMU_IO_OPTIONS | grep -s -- '--nocache' > /dev/null); then
+            [ -f $seq.out.nocache ] && reference=$seq.out.nocache
+        fi
+
+	    if [ ! -f $reference ]
 	    then
 		echo " - no qualified output"
 		err=true
 	    else
-		if diff -w $seq.out $tmp.out >/dev/null 2>&1
+		if diff -w $reference $tmp.out >/dev/null 2>&1
 		then
 		    echo ""
 		    if $err
@@ -256,7 +262,7 @@ do
 		else
 		    echo " - output mismatch (see $seq.out.bad)"
 		    mv $tmp.out $seq.out.bad
-		    $diff -w $seq.out $seq.out.bad
+		    $diff -w $reference $seq.out.bad
 		    err=true
 		fi
 	    fi
Signature · 1 line
1.8.1.4
#1 lore raw

tests/qemu-iotests/check do · line 243

Quoted 11 lines · Kevin Wolf
tests/qemu-iotests/check +2 -1
index 74628ae..42d6955 100755
@@ -239,12 +239,18 @@ do
 		echo -n " [failed, exit status $sts]"
 		err=true
 	    fi
-	    if [ ! -f $seq.out ]
+
+        reference=$seq.out

Please keep the same indentation style as the rest of the file (seems to use 8-space tabs plus spaces for 4-space indentation).

tests/qemu-iotests/check do · line 244

Quoted 1 line
tests/qemu-iotests/check +1 -0
+        if (echo $QEMU_IO_OPTIONS | grep -s -- '--nocache' > /dev/null); then

man grep says:
"Portable shell scripts should avoid both -q and -s and should redirect standard and error output to /dev/null instead."

Since you're already redirecting stdout to /dev/null we might as well redirect stderr too and drop the -s option.

author
#2 lore raw

Am 02.09.2013 um 14:58 hat Stefan Hajnoczi geschrieben:

Quoted 7 lines · Kevin Wolf
Quoted 6 lines
tests/qemu-iotests/check +0 -0
index 74628ae..42d6955 100755
@@ -239,12 +239,18 @@ do
 		echo -n " [failed, exit status $sts]"
Quoted 8 lines

tests/qemu-iotests/check do · line 243

Quoted 5 lines
tests/qemu-iotests/check +2 -1
 		err=true
 	    fi
-	    if [ ! -f $seq.out ]
+
+        reference=$seq.out

Please keep the same indentation style as the rest of the file (seems to use 8-space tabs plus spaces for 4-space indentation).

I could live with just tabs, but this kind of mix is a totally broken style. :-/

I'd rather send a patch to convert the whole qemu-iotests scripts to spaces first. Would you agree with that?

Quoted 8 lines

tests/qemu-iotests/check do · line 244

Quoted 1 line
tests/qemu-iotests/check +1 -0
+        if (echo $QEMU_IO_OPTIONS | grep -s -- '--nocache' > /dev/null); then

man grep says:
"Portable shell scripts should avoid both -q and -s and should redirect standard and error output to /dev/null instead."

Since you're already redirecting stdout to /dev/null we might as well redirect stderr too and drop the -s option.

Okay, will do in v2, though I generally don't care about portability of qemu-iotests.

Kevin

#3 lore raw
Quoted 17 lines · Kevin Wolf

Am 02.09.2013 um 14:58 hat Stefan Hajnoczi geschrieben:

Quoted 7 lines · Kevin Wolf
Quoted 6 lines
tests/qemu-iotests/check +0 -0
index 74628ae..42d6955 100755
@@ -239,12 +239,18 @@ do
 		echo -n " [failed, exit status $sts]"
Quoted 8 lines

tests/qemu-iotests/check do · line 243

Quoted 5 lines
tests/qemu-iotests/check +2 -1
 		err=true
 	    fi
-	    if [ ! -f $seq.out ]
+
+        reference=$seq.out

Please keep the same indentation style as the rest of the file (seems to use 8-space tabs plus spaces for 4-space indentation).

Quoted 5 lines

I could live with just tabs, but this kind of mix is a totally broken style. :-/

I'd rather send a patch to convert the whole qemu-iotests scripts to spaces first. Would you agree with that?

Yep.

Stefan