111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2*9dd003a9SVladimir Sementsov-Ogievskiy# group: rw auto quick 386ce1f6eSReda Sallahi# 486ce1f6eSReda Sallahi# qemu-img dd test with different block sizes 586ce1f6eSReda Sallahi# 686ce1f6eSReda Sallahi# Copyright (C) 2016 Reda Sallahi 786ce1f6eSReda Sallahi# 886ce1f6eSReda Sallahi# This program is free software; you can redistribute it and/or modify 986ce1f6eSReda Sallahi# it under the terms of the GNU General Public License as published by 1086ce1f6eSReda Sallahi# the Free Software Foundation; either version 2 of the License, or 1186ce1f6eSReda Sallahi# (at your option) any later version. 1286ce1f6eSReda Sallahi# 1386ce1f6eSReda Sallahi# This program is distributed in the hope that it will be useful, 1486ce1f6eSReda Sallahi# but WITHOUT ANY WARRANTY; without even the implied warranty of 1586ce1f6eSReda Sallahi# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1686ce1f6eSReda Sallahi# GNU General Public License for more details. 1786ce1f6eSReda Sallahi# 1886ce1f6eSReda Sallahi# You should have received a copy of the GNU General Public License 1986ce1f6eSReda Sallahi# along with this program. If not, see <http://www.gnu.org/licenses/>. 2086ce1f6eSReda Sallahi# 2186ce1f6eSReda Sallahi 2286ce1f6eSReda Sallahiowner=fullmanet@gmail.com 2386ce1f6eSReda Sallahi 2486ce1f6eSReda Sallahiseq="$(basename $0)" 2586ce1f6eSReda Sallahiecho "QA output created by $seq" 2686ce1f6eSReda Sallahi 2786ce1f6eSReda Sallahistatus=1 2886ce1f6eSReda Sallahi 2986ce1f6eSReda Sallahi_cleanup() 3086ce1f6eSReda Sallahi{ 3186ce1f6eSReda Sallahi _cleanup_test_img 32f91ecbd7SMax Reitz _rm_test_img "$TEST_IMG.out" 3386ce1f6eSReda Sallahi} 3486ce1f6eSReda Sallahitrap "_cleanup; exit \$status" 0 1 2 3 15 3586ce1f6eSReda Sallahi 3686ce1f6eSReda Sallahi. ./common.rc 3786ce1f6eSReda Sallahi. ./common.filter 3886ce1f6eSReda Sallahi. ./common.pattern 3986ce1f6eSReda Sallahi 4086ce1f6eSReda Sallahi_supported_fmt generic 4186ce1f6eSReda Sallahi_supported_proto file 422c6f6006SDaniel P. Berrange_unsupported_fmt luks 4386ce1f6eSReda Sallahi 4486ce1f6eSReda SallahiTEST_SIZES="5 512 1024 1999 1K 64K 1M" 4586ce1f6eSReda Sallahi 4686ce1f6eSReda Sallahifor bs in $TEST_SIZES; do 4786ce1f6eSReda Sallahi echo 4886ce1f6eSReda Sallahi echo "== Creating image ==" 4986ce1f6eSReda Sallahi 5086ce1f6eSReda Sallahi size=1M 5186ce1f6eSReda Sallahi _make_test_img $size 5286ce1f6eSReda Sallahi _check_test_img 5386ce1f6eSReda Sallahi $QEMU_IO -c "write -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io 5486ce1f6eSReda Sallahi 5586ce1f6eSReda Sallahi echo 5686ce1f6eSReda Sallahi echo "== Converting the image with dd with a block size of $bs ==" 5786ce1f6eSReda Sallahi 5886ce1f6eSReda Sallahi $QEMU_IMG dd if="$TEST_IMG" of="$TEST_IMG.out" bs=$bs -O "$IMGFMT" 5986ce1f6eSReda Sallahi TEST_IMG="$TEST_IMG.out" _check_test_img 6086ce1f6eSReda Sallahi 6186ce1f6eSReda Sallahi echo 6286ce1f6eSReda Sallahi echo "== Compare the images with qemu-img compare ==" 6386ce1f6eSReda Sallahi 6486ce1f6eSReda Sallahi $QEMU_IMG compare "$TEST_IMG" "$TEST_IMG.out" 6586ce1f6eSReda Sallahidone 6686ce1f6eSReda Sallahi 6786ce1f6eSReda Sallahiecho 6886ce1f6eSReda Sallahiecho "*** done" 6986ce1f6eSReda Sallahirm -f "$seq.full" 7086ce1f6eSReda Sallahistatus=0 71