xref: /openbmc/qemu/tests/qemu-iotests/005 (revision 9dd003a99842d1d82c336e45c5cce656149de382)
111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash
2*9dd003a9SVladimir Sementsov-Ogievskiy# group: img auto quick
36bf19c94SChristoph Hellwig#
46bf19c94SChristoph Hellwig# Make sure qemu-img can create 5TB images
56bf19c94SChristoph Hellwig#
66bf19c94SChristoph Hellwig# Based on a testcase from Chris Wright,
76bf19c94SChristoph Hellwig# https://bugzilla.redhat.com/show_bug.cgi?id=491943
86bf19c94SChristoph Hellwig#
96bf19c94SChristoph Hellwig# Copyright (C) 2009 Red Hat, Inc.
106bf19c94SChristoph Hellwig#
116bf19c94SChristoph Hellwig# This program is free software; you can redistribute it and/or modify
126bf19c94SChristoph Hellwig# it under the terms of the GNU General Public License as published by
136bf19c94SChristoph Hellwig# the Free Software Foundation; either version 2 of the License, or
146bf19c94SChristoph Hellwig# (at your option) any later version.
156bf19c94SChristoph Hellwig#
166bf19c94SChristoph Hellwig# This program is distributed in the hope that it will be useful,
176bf19c94SChristoph Hellwig# but WITHOUT ANY WARRANTY; without even the implied warranty of
186bf19c94SChristoph Hellwig# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
196bf19c94SChristoph Hellwig# GNU General Public License for more details.
206bf19c94SChristoph Hellwig#
216bf19c94SChristoph Hellwig# You should have received a copy of the GNU General Public License
22e8c212d6SChristoph Hellwig# along with this program.  If not, see <http://www.gnu.org/licenses/>.
236bf19c94SChristoph Hellwig#
246bf19c94SChristoph Hellwig
256bf19c94SChristoph Hellwig# creator
266bf19c94SChristoph Hellwigowner=hch@lst.de
276bf19c94SChristoph Hellwig
286bf19c94SChristoph Hellwigseq=`basename $0`
296bf19c94SChristoph Hellwigecho "QA output created by $seq"
306bf19c94SChristoph Hellwig
316bf19c94SChristoph Hellwigstatus=1	# failure is the default!
326bf19c94SChristoph Hellwig
336bf19c94SChristoph Hellwig_cleanup()
346bf19c94SChristoph Hellwig{
356bf19c94SChristoph Hellwig	_cleanup_test_img
366bf19c94SChristoph Hellwig}
376bf19c94SChristoph Hellwigtrap "_cleanup; exit \$status" 0 1 2 3 15
386bf19c94SChristoph Hellwig
396bf19c94SChristoph Hellwig# get standard environment, filters and checks
406bf19c94SChristoph Hellwig. ./common.rc
416bf19c94SChristoph Hellwig. ./common.filter
426bf19c94SChristoph Hellwig
436bf19c94SChristoph Hellwig_supported_fmt generic
449cdfa1b3SMORITA Kazutaka_supported_proto generic
456bf19c94SChristoph Hellwig_supported_os Linux
462aa4a86fSFam Zheng_unsupported_imgopts "subformat=twoGbMaxExtentFlat" \
47325dd915SMax Reitz                     "subformat=twoGbMaxExtentSparse" \
48325dd915SMax Reitz                     "subformat=streamOptimized"
496bf19c94SChristoph Hellwig
505d9c577dSChristoph Hellwig# vpc is limited to 127GB, so we can't test it here
515d9c577dSChristoph Hellwigif [ "$IMGFMT" = "vpc" ]; then
525d9c577dSChristoph Hellwig    _notrun "image format $IMGFMT does not support large image sizes"
535d9c577dSChristoph Hellwigfi
546bf19c94SChristoph Hellwig
559cdfa1b3SMORITA Kazutaka# sheepdog image is limited to 4TB, so we can't test it here
569cdfa1b3SMORITA Kazutakaif [ "$IMGPROTO" = "sheepdog" ]; then
579cdfa1b3SMORITA Kazutaka    _notrun "image protocol $IMGPROTO does not support large image sizes"
589cdfa1b3SMORITA Kazutakafi
599cdfa1b3SMORITA Kazutaka
60b807a993SThomas Huth# Sanity check: For raw, we require a file system that permits the creation
61b807a993SThomas Huth# of a HUGE (but very sparse) file. Check we can create it before continuing.
62b807a993SThomas Huthif [ "$IMGFMT" = "raw" ]; then
6330729ae9SThomas Huth    _require_large_file 5T
64b807a993SThomas Huthfi
65b807a993SThomas Huth
666bf19c94SChristoph Hellwigecho
676bf19c94SChristoph Hellwigecho "creating large image"
686bf19c94SChristoph Hellwig_make_test_img 5000G
696bf19c94SChristoph Hellwig
706bf19c94SChristoph Hellwigecho
716bf19c94SChristoph Hellwigecho "small read"
72fef9c191SJeff Cody$QEMU_IO -c "read 1024 4096" "$TEST_IMG" | _filter_qemu_io
736bf19c94SChristoph Hellwig
746bf19c94SChristoph Hellwigecho
756bf19c94SChristoph Hellwigecho "small write"
76fef9c191SJeff Cody$QEMU_IO -c "write 8192 4096" "$TEST_IMG" | _filter_qemu_io
776bf19c94SChristoph Hellwig
786bf19c94SChristoph Hellwig# success, all done
796bf19c94SChristoph Hellwigecho "*** done"
806bf19c94SChristoph Hellwigrm -f $seq.full
816bf19c94SChristoph Hellwigstatus=0
82