xref: /openbmc/qemu/tests/qemu-iotests/123 (revision 68894b5fed671d49587209697f2224b4e857fd1a)
111a82d14SPhilippe Mathieu-Daudé#!/usr/bin/env bash
29dd003a9SVladimir Sementsov-Ogievskiy# group: rw quick
3723bfab5SMax Reitz#
4723bfab5SMax Reitz# Test case for qemu-img convert to NBD
5723bfab5SMax Reitz#
6723bfab5SMax Reitz# Copyright (C) 2015 Red Hat, Inc.
7723bfab5SMax Reitz#
8723bfab5SMax Reitz# This program is free software; you can redistribute it and/or modify
9723bfab5SMax Reitz# it under the terms of the GNU General Public License as published by
10723bfab5SMax Reitz# the Free Software Foundation; either version 2 of the License, or
11723bfab5SMax Reitz# (at your option) any later version.
12723bfab5SMax Reitz#
13723bfab5SMax Reitz# This program is distributed in the hope that it will be useful,
14723bfab5SMax Reitz# but WITHOUT ANY WARRANTY; without even the implied warranty of
15723bfab5SMax Reitz# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16723bfab5SMax Reitz# GNU General Public License for more details.
17723bfab5SMax Reitz#
18723bfab5SMax Reitz# You should have received a copy of the GNU General Public License
19723bfab5SMax Reitz# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20723bfab5SMax Reitz#
21723bfab5SMax Reitz
22723bfab5SMax Reitz# creator
23*42a5009dSJohn Snowowner=hreitz@redhat.com
24723bfab5SMax Reitz
25723bfab5SMax Reitzseq="$(basename $0)"
26723bfab5SMax Reitzecho "QA output created by $seq"
27723bfab5SMax Reitz
28723bfab5SMax Reitzstatus=1	# failure is the default!
29723bfab5SMax Reitz
30723bfab5SMax Reitz_cleanup()
31723bfab5SMax Reitz{
32723bfab5SMax Reitz    _cleanup_test_img
33f91ecbd7SMax Reitz    _rm_test_img "$SRC_IMG"
34723bfab5SMax Reitz}
35723bfab5SMax Reitztrap "_cleanup; exit \$status" 0 1 2 3 15
36723bfab5SMax Reitz
37723bfab5SMax Reitz# get standard environment, filters and checks
38723bfab5SMax Reitz. ./common.rc
39723bfab5SMax Reitz. ./common.filter
40723bfab5SMax Reitz
41723bfab5SMax Reitz_supported_fmt raw
42723bfab5SMax Reitz_supported_proto nbd
43723bfab5SMax Reitz_supported_os Linux
44723bfab5SMax Reitz
45723bfab5SMax ReitzSRC_IMG="$TEST_DIR/source.$IMGFMT"
46723bfab5SMax Reitz
47723bfab5SMax Reitz_make_test_img 1M
4852a97b5aSMax ReitzTEST_IMG_FILE=$SRC_IMG IMGPROTO=file _make_test_img 1M
49723bfab5SMax Reitz
50723bfab5SMax Reitz$QEMU_IO -c 'write -P 42 0 1M' "$SRC_IMG" | _filter_qemu_io
51723bfab5SMax Reitz
52723bfab5SMax Reitz$QEMU_IMG convert -n -f $IMGFMT -O raw "$SRC_IMG" "$TEST_IMG"
53723bfab5SMax Reitz
54723bfab5SMax Reitz$QEMU_IO -c 'read -P 42 0 1M' "$TEST_IMG" | _filter_qemu_io
55723bfab5SMax Reitz
56723bfab5SMax Reitz
57723bfab5SMax Reitz# success, all done
58723bfab5SMax Reitzecho
59723bfab5SMax Reitzecho '*** done'
60723bfab5SMax Reitzrm -f $seq.full
61723bfab5SMax Reitzstatus=0
62