111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash 2*9dd003a9SVladimir Sementsov-Ogievskiy# group: rw backing auto quick 32557d865SKevin Wolf# 42557d865SKevin Wolf# Simple backing file reads 52557d865SKevin Wolf# 62557d865SKevin Wolf# Copyright (C) 2009 Red Hat, Inc. 72557d865SKevin Wolf# 82557d865SKevin Wolf# This program is free software; you can redistribute it and/or modify 92557d865SKevin Wolf# it under the terms of the GNU General Public License as published by 102557d865SKevin Wolf# the Free Software Foundation; either version 2 of the License, or 112557d865SKevin Wolf# (at your option) any later version. 122557d865SKevin Wolf# 132557d865SKevin Wolf# This program is distributed in the hope that it will be useful, 142557d865SKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of 152557d865SKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 162557d865SKevin Wolf# GNU General Public License for more details. 172557d865SKevin Wolf# 182557d865SKevin Wolf# You should have received a copy of the GNU General Public License 19e8c212d6SChristoph Hellwig# along with this program. If not, see <http://www.gnu.org/licenses/>. 202557d865SKevin Wolf# 212557d865SKevin Wolf 222557d865SKevin Wolf# creator 232557d865SKevin Wolfowner=kwolf@redhat.com 242557d865SKevin Wolf 252557d865SKevin Wolfseq=`basename $0` 262557d865SKevin Wolfecho "QA output created by $seq" 272557d865SKevin Wolf 282557d865SKevin Wolfstatus=1 # failure is the default! 292557d865SKevin Wolf 302557d865SKevin Wolf_cleanup() 312557d865SKevin Wolf{ 322557d865SKevin Wolf _cleanup_test_img 332557d865SKevin Wolf} 342557d865SKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15 352557d865SKevin Wolf 362557d865SKevin Wolf# get standard environment, filters and checks 372557d865SKevin Wolf. ./common.rc 382557d865SKevin Wolf. ./common.filter 392557d865SKevin Wolf. ./common.pattern 402557d865SKevin Wolf 412557d865SKevin Wolf# Any format supporting backing files 42f5a4bbd9SStefan Hajnoczi_supported_fmt qcow qcow2 vmdk qed 439cdfa1b3SMORITA Kazutaka_supported_proto generic 44325dd915SMax Reitz_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \ 45325dd915SMax Reitz "subformat=streamOptimized" 462557d865SKevin Wolf 472557d865SKevin WolfTEST_OFFSETS="0 4294967296" 482557d865SKevin Wolf 49794d00f7SFam ZhengTEST_IMG_SAVE=$TEST_IMG 50794d00f7SFam ZhengTEST_IMG=$TEST_IMG.base 512557d865SKevin Wolf_make_test_img 6G 522557d865SKevin Wolf 532557d865SKevin Wolfecho "Filling base image" 542557d865SKevin Wolfecho 552557d865SKevin Wolf 562557d865SKevin Wolffor offset in $TEST_OFFSETS; do 572557d865SKevin Wolf # Some clusters with alternating backing file/image file reads 582557d865SKevin Wolf io writev $(( offset )) 512 1024 64 592557d865SKevin Wolf 602557d865SKevin Wolf # Complete backing clusters 612557d865SKevin Wolf io writev $(( offset + 64 * 1024)) 65536 65536 1 622557d865SKevin Wolfdone 632557d865SKevin Wolf_check_test_img 642557d865SKevin Wolf 652557d865SKevin Wolfecho "Creating test image with backing file" 662557d865SKevin Wolfecho 672557d865SKevin Wolf 68794d00f7SFam ZhengTEST_IMG=$TEST_IMG_SAVE 69b66ff2c2SEric Blake_make_test_img -b "$TEST_IMG.base" -F $IMGFMT 6G 702557d865SKevin Wolf 712557d865SKevin Wolfecho "Filling test image" 722557d865SKevin Wolfecho 732557d865SKevin Wolf 742557d865SKevin Wolffor offset in $TEST_OFFSETS; do 752557d865SKevin Wolf # Some clusters with alternating backing file/image file reads 762557d865SKevin Wolf io writev $(( offset + 512 )) 512 1024 64 772557d865SKevin Wolf 782557d865SKevin Wolf # Complete test image clusters 792557d865SKevin Wolf io writev $(( offset + 64 * 1024 + 65536)) 65536 65536 1 802557d865SKevin Wolfdone 812557d865SKevin Wolf_check_test_img 822557d865SKevin Wolf 832557d865SKevin Wolfecho "Reading" 842557d865SKevin Wolfecho 852557d865SKevin Wolf 862557d865SKevin Wolffor offset in $TEST_OFFSETS; do 872557d865SKevin Wolf # Some clusters with alternating backing file/image file reads 882557d865SKevin Wolf io readv $(( offset )) 512 1024 64 892557d865SKevin Wolf io readv $(( offset + 512 )) 512 1024 64 902557d865SKevin Wolf 912557d865SKevin Wolf # Complete test image clusters 922557d865SKevin Wolf io readv $(( offset + 64 * 1024)) 65536 65536 1 932557d865SKevin Wolf io readv $(( offset + 64 * 1024 + 65536)) 65536 65536 1 942557d865SKevin Wolf 952557d865SKevin Wolf # Empty sectors 962557d865SKevin Wolf io_zero readv $(( offset + 64 * 1024 + 65536 * 4 )) 65536 65536 1 972557d865SKevin Wolfdone 982557d865SKevin Wolf_check_test_img 992557d865SKevin Wolf 1002557d865SKevin Wolf# success, all done 1012557d865SKevin Wolfecho "*** done" 1022557d865SKevin Wolfrm -f $seq.full 1032557d865SKevin Wolfstatus=0 104