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