18455e4eeSKevin Wolf#!/bin/bash 28455e4eeSKevin Wolf# 38455e4eeSKevin Wolf# Test loading internal snapshots where the L1 table of the snapshot 48455e4eeSKevin Wolf# is smaller than the current L1 table. 58455e4eeSKevin Wolf# 68455e4eeSKevin Wolf# Copyright (C) 2011 Red Hat, Inc. 78455e4eeSKevin Wolf# 88455e4eeSKevin Wolf# This program is free software; you can redistribute it and/or modify 98455e4eeSKevin Wolf# it under the terms of the GNU General Public License as published by 108455e4eeSKevin Wolf# the Free Software Foundation; either version 2 of the License, or 118455e4eeSKevin Wolf# (at your option) any later version. 128455e4eeSKevin Wolf# 138455e4eeSKevin Wolf# This program is distributed in the hope that it will be useful, 148455e4eeSKevin Wolf# but WITHOUT ANY WARRANTY; without even the implied warranty of 158455e4eeSKevin Wolf# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 168455e4eeSKevin Wolf# GNU General Public License for more details. 178455e4eeSKevin Wolf# 188455e4eeSKevin Wolf# You should have received a copy of the GNU General Public License 198455e4eeSKevin Wolf# along with this program. If not, see <http://www.gnu.org/licenses/>. 208455e4eeSKevin Wolf# 218455e4eeSKevin Wolf 228455e4eeSKevin Wolf# creator 238455e4eeSKevin Wolfowner=kwolf@redhat.com 248455e4eeSKevin Wolf 258455e4eeSKevin Wolfseq=`basename $0` 268455e4eeSKevin Wolfecho "QA output created by $seq" 278455e4eeSKevin Wolf 288455e4eeSKevin Wolfhere=`pwd` 298455e4eeSKevin Wolftmp=/tmp/$$ 308455e4eeSKevin Wolfstatus=1 # failure is the default! 318455e4eeSKevin Wolf 328455e4eeSKevin Wolf_cleanup() 338455e4eeSKevin Wolf{ 348455e4eeSKevin Wolf _cleanup_test_img 358455e4eeSKevin Wolf} 368455e4eeSKevin Wolftrap "_cleanup; exit \$status" 0 1 2 3 15 378455e4eeSKevin Wolf 388455e4eeSKevin Wolf# get standard environment, filters and checks 398455e4eeSKevin Wolf. ./common.rc 408455e4eeSKevin Wolf. ./common.filter 418455e4eeSKevin Wolf. ./common.pattern 428455e4eeSKevin Wolf 438455e4eeSKevin Wolf# Any format supporting intenal snapshots 448455e4eeSKevin Wolf_supported_fmt qcow2 458455e4eeSKevin Wolf_supported_proto generic 468455e4eeSKevin Wolf_supported_os Linux 478455e4eeSKevin Wolf 488455e4eeSKevin WolfCLUSTER_SIZE=65536 498455e4eeSKevin Wolf_make_test_img 64M 50*fef9c191SJeff Cody$QEMU_IMG snapshot -c foo "$TEST_IMG" 51*fef9c191SJeff Cody$QEMU_IO -c 'write -b 0 4k' "$TEST_IMG" | _filter_qemu_io 52*fef9c191SJeff Cody$QEMU_IMG snapshot -a foo "$TEST_IMG" 538455e4eeSKevin Wolf_check_test_img 548455e4eeSKevin Wolf 558455e4eeSKevin WolfCLUSTER_SIZE=1024 568455e4eeSKevin Wolf_make_test_img 16M 57*fef9c191SJeff Cody$QEMU_IMG snapshot -c foo "$TEST_IMG" 58*fef9c191SJeff Cody$QEMU_IO -c 'write -b 0 4M' "$TEST_IMG" | _filter_qemu_io 59*fef9c191SJeff Cody$QEMU_IMG snapshot -a foo "$TEST_IMG" 608455e4eeSKevin Wolf_check_test_img 618455e4eeSKevin Wolf 628455e4eeSKevin Wolf# success, all done 638455e4eeSKevin Wolfecho "*** done" 648455e4eeSKevin Wolfrm -f $seq.full 658455e4eeSKevin Wolfstatus=0 66