qemu-iotests: Fix test 031 for qcow2 v3 support

qcow2.py must be updated to work with version 3 images at all, the
output has changed since the feature table extension has been added, and
version 2 and version 3 images can't possibly have the same test output.

Change the test case to completely ignore IMGOPTS and run the test for
both compat=1.1 and compat=0.10 regardless of the ./check command line.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
index 6365f28..2d5e3b1 100755
--- a/tests/qemu-iotests/031
+++ b/tests/qemu-iotests/031
@@ -45,26 +45,34 @@
 _supported_os Linux
 
 CLUSTER_SIZE=65536
-echo
-echo === Create image with unknown header extension ===
-echo
-_make_test_img 64M
-./qcow2.py $TEST_IMG add-header-ext 0x12345678 "This is a test header extension"
-./qcow2.py $TEST_IMG dump-header
-_check_test_img
 
-echo
-echo === Rewrite header with no backing file ===
-echo
-$QEMU_IMG rebase -u -b "" $TEST_IMG
-./qcow2.py $TEST_IMG dump-header
-_check_test_img
+# qcow2.py output depends on the exact options used, so override the command
+# line here as an exception
+for IMGOPTS in "compat=0.10" "compat=1.1"; do
 
-echo
-echo === Add a backing file and format ===
-echo
-$QEMU_IMG rebase -u -b "/some/backing/file/path" -F host_device $TEST_IMG
-./qcow2.py $TEST_IMG dump-header
+    echo
+    echo ===== Testing with -o $IMGOPTS =====
+    echo
+    echo === Create image with unknown header extension ===
+    echo
+    _make_test_img 64M
+    ./qcow2.py $TEST_IMG add-header-ext 0x12345678 "This is a test header extension"
+    ./qcow2.py $TEST_IMG dump-header
+    _check_test_img
+
+    echo
+    echo === Rewrite header with no backing file ===
+    echo
+    $QEMU_IMG rebase -u -b "" $TEST_IMG
+    ./qcow2.py $TEST_IMG dump-header
+    _check_test_img
+
+    echo
+    echo === Add a backing file and format ===
+    echo
+    $QEMU_IMG rebase -u -b "/some/backing/file/path" -F host_device $TEST_IMG
+    ./qcow2.py $TEST_IMG dump-header
+done
 
 # success, all done
 echo "*** done"