Commit ea81ca9d authored by Max Reitz's avatar Max Reitz Committed by Kevin Wolf
Browse files

iotests: Use $PYTHON for Python scripts



Instead of invoking Python scripts directly via ./, use $PYTHON to
obtain the correct Python interpreter command.

Signed-off-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarFam Zheng <famz@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 7fed1a49
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -56,22 +56,22 @@ for IMGOPTS in "compat=0.10" "compat=1.1"; do
    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
    $PYTHON qcow2.py "$TEST_IMG" add-header-ext 0x12345678 "This is a test header extension"
    $PYTHON 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
    $PYTHON 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
    $PYTHON qcow2.py "$TEST_IMG" dump-header
done

# success, all done
+3 −3
Original line number Diff line number Diff line
@@ -53,15 +53,15 @@ IMGOPTS="compat=1.1"
echo === Create image with unknown autoclear feature bit ===
echo
_make_test_img 64M
./qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
./qcow2.py "$TEST_IMG" dump-header
$PYTHON qcow2.py "$TEST_IMG" set-feature-bit autoclear 63
$PYTHON qcow2.py "$TEST_IMG" dump-header

echo
echo === Repair image ===
echo
_check_test_img -r all

./qcow2.py "$TEST_IMG" dump-header
$PYTHON qcow2.py "$TEST_IMG" dump-header

# success, all done
echo "*** done"
+9 −9
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ _make_test_img $size
$QEMU_IO -c "write -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io

# The dirty bit must not be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img

echo
@@ -75,7 +75,7 @@ _make_test_img $size
_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io

# The dirty bit must be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img

echo
@@ -84,7 +84,7 @@ echo "== Read-only access must still work =="
$QEMU_IO -r -c "read -P 0x5a 0 512" "$TEST_IMG" | _filter_qemu_io

# The dirty bit must be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

echo
echo "== Repairing the image file must succeed =="
@@ -92,7 +92,7 @@ echo "== Repairing the image file must succeed =="
_check_test_img -r all

# The dirty bit must not be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

echo
echo "== Data should still be accessible after repair =="
@@ -108,12 +108,12 @@ _make_test_img $size
_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io

# The dirty bit must be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

$QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io

# The dirty bit must not be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

echo
echo "== Creating an image file with lazy_refcounts=off =="
@@ -124,7 +124,7 @@ _make_test_img $size
_no_dump_exec $QEMU_IO -c "write -P 0x5a 0 512" -c "abort" "$TEST_IMG" 2>&1 | _filter_qemu_io

# The dirty bit must not be set since lazy_refcounts=off
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img

echo
@@ -140,8 +140,8 @@ $QEMU_IO -c "write 0 512" "$TEST_IMG" | _filter_qemu_io
$QEMU_IMG commit "$TEST_IMG"

# The dirty bit must not be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
./qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG".base dump-header | grep incompatible_features

_check_test_img
TEST_IMG="$TEST_IMG".base _check_test_img
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ _make_test_img $((1024*1024))T
echo
echo "creating too large image (1 EB) using qcow2.py"
_make_test_img 4G
./qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
$PYTHON qcow2.py "$TEST_IMG" set-header size $((1024 ** 6))
_check_test_img

# success, all done
+10 −10
Original line number Diff line number Diff line
@@ -68,13 +68,13 @@ poke_file "$TEST_IMG" "$l1_offset" "\x80\x00\x00\x00\x00\x03\x00\x00"
_check_test_img

# The corrupt bit should not be set anyway
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

# Try to write something, thereby forcing the corrupt bit to be set
$QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io

# The corrupt bit must now be set
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

# Try to open the image R/W (which should fail)
$QEMU_IO -c "$OPEN_RW" -c "read 0 512" 2>&1 | _filter_qemu_io \
@@ -99,19 +99,19 @@ poke_file "$TEST_IMG" "$(($rb_offset+8))" "\x00\x01"
# Redirect new data cluster onto refcount block
poke_file "$TEST_IMG" "$l2_offset" "\x80\x00\x00\x00\x00\x02\x00\x00"
_check_test_img
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

# Try to fix it
_check_test_img -r all

# The corrupt bit should be cleared
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

# Look if it's really really fixed
$QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

echo
echo "=== Testing cluster data reference into inactive L2 table ==="
@@ -124,13 +124,13 @@ $QEMU_IO -c "$OPEN_RW" -c "write -P 2 0 512" | _filter_qemu_io
poke_file "$TEST_IMG" "$l2_offset_after_snapshot" \
                      "\x80\x00\x00\x00\x00\x04\x00\x00"
_check_test_img
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$QEMU_IO -c "$OPEN_RW" -c "write -P 3 0 512" | _filter_qemu_io
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
_check_test_img -r all
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$QEMU_IO -c "$OPEN_RW" -c "write -P 4 0 512" | _filter_qemu_io
./qcow2.py "$TEST_IMG" dump-header | grep incompatible_features
$PYTHON qcow2.py "$TEST_IMG" dump-header | grep incompatible_features

# Check data
$QEMU_IO -c "$OPEN_RO" -c "read -P 4 0 512" | _filter_qemu_io
Loading