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