#!/usr/bin/env bash
#
# qemu-img measure sub-command tests
#
# Copyright (C) 2017 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# creator
owner=stefanha@redhat.com

seq=`basename $0`
echo "QA output created by $seq"

status=1    # failure is the default!

_cleanup()
{
    _cleanup_test_img
    _rm_test_img "$TEST_IMG.converted"
}
trap "_cleanup; exit \$status" 0 1 2 3 15

# get standard environment, filters and checks
. ./common.rc
. ./common.filter
. ./common.pattern

_supported_fmt raw qcow2
_supported_proto file
_supported_os Linux
_require_working_luks

echo "== Input validation =="
echo

_make_test_img 1G

$QEMU_IMG measure # missing arguments
$QEMU_IMG measure --size 2G "$TEST_IMG" # only one allowed
$QEMU_IMG measure "$TEST_IMG" a # only one filename allowed
$QEMU_IMG measure --object secret,id=sec0,data=MTIzNDU2,format=base64 # size or filename needed
$QEMU_IMG measure --image-opts # missing filename
$QEMU_IMG measure -f qcow2 # missing filename
$QEMU_IMG measure -l snap1 # missing filename
$QEMU_IMG measure -o , # invalid option list
$QEMU_IMG measure -l snapshot.foo # invalid snapshot option
$QEMU_IMG measure --output foo # invalid output format
$QEMU_IMG measure --size -1 # invalid image size
$QEMU_IMG measure -O foo "$TEST_IMG" # unknown image file format

make_test_img_with_fmt() {
    # Shadow global variables within this function
    local IMGFMT="$1"
    _make_test_img --no-opts "$2"
}

qemu_io_with_fmt() {
    # Shadow global variables within this function
    local QEMU_IO_OPTIONS=$(echo "$QEMU_IO_OPTIONS" | sed "s/-f $IMGFMT/-f $1/")
    shift
    $QEMU_IO "$@"
}

# The proof is in the pudding: converted image size cannot be larger than the
# required size.
#
# Note: if a change to the image format code causes the file size to change,
# then this test fails!  This is good because it's a reminder to check that the
# required size is still at least as big as the actual converted file size.
convert_and_show_size() {
    local fmt="$1"
    shift
    $QEMU_IMG convert -f "$fmt" -O "$IMGFMT" "$TEST_IMG" "$@" "$TEST_IMG.converted"
    stat -c "converted image file size in bytes: %s" "$TEST_IMG.converted"
}

for ofmt in human json; do
    echo
    echo "== Size calculation for a new file ($ofmt) =="
    echo

    # Try a few interesting sizes
    $QEMU_IMG measure --output=$ofmt -O "$IMGFMT" --size 0
    $QEMU_IMG measure --output=$ofmt -O "$IMGFMT" --size 2G
    $QEMU_IMG measure --output=$ofmt -O "$IMGFMT" --size 64G
    $QEMU_IMG measure --output=$ofmt -O "$IMGFMT" --size 256G
    $QEMU_IMG measure --output=$ofmt -O "$IMGFMT" --size 1T
    $QEMU_IMG measure --output=$ofmt -O "$IMGFMT" --size 2P
    $QEMU_IMG measure --output=$ofmt -O "$IMGFMT" --size 7E

    # Always test the raw input files but also IMGFMT
    for fmt in $(echo -e "raw\n$IMGFMT\n" | sort -u); do
        echo
        echo "== Empty $fmt input image ($ofmt) =="
        echo
        make_test_img_with_fmt "$fmt" 0
        $QEMU_IMG measure --output=$ofmt -f "$fmt" -O "$IMGFMT" "$TEST_IMG"
        echo
        convert_and_show_size "$fmt"

        echo
        echo "== $fmt input image with data ($ofmt) =="
        echo
        make_test_img_with_fmt "$fmt" 1G
        $QEMU_IMG measure --output=$ofmt -f "$fmt" -O "$IMGFMT" "$TEST_IMG"
        qemu_io_with_fmt "$fmt" -c "write 512 512" "$TEST_IMG" | _filter_qemu_io
        qemu_io_with_fmt "$fmt" -c "write 64K 64K" "$TEST_IMG" | _filter_qemu_io
        if [ "$fmt" = "qcow2" ]; then
            $QEMU_IMG snapshot -c snapshot1 "$TEST_IMG"
        fi
        qemu_io_with_fmt "$fmt" -c "write 128M 63K" "$TEST_IMG" | _filter_qemu_io
        $QEMU_IMG measure --output=$ofmt -f "$fmt" -O "$IMGFMT" "$TEST_IMG"
        echo
        convert_and_show_size "$fmt"

        if [ "$fmt" = "qcow2" ]; then
            echo
            echo "== $fmt input image with internal snapshot ($ofmt) =="
            echo
            $QEMU_IMG measure --output=$ofmt -f "$fmt" -l snapshot1 \
                              -O "$IMGFMT" "$TEST_IMG"
            echo
            convert_and_show_size "$fmt" -l snapshot1
        fi

        if [ "$IMGFMT" = "qcow2" ]; then
            echo
            echo "== $fmt input image and a backing file ($ofmt) =="
            echo
            # The backing file doesn't need to exist :)
            $QEMU_IMG measure --output=$ofmt -o backing_file=x \
                              -f "$fmt" -O "$IMGFMT" "$TEST_IMG"

            echo
            echo "== $fmt input image and LUKS encryption =="
            echo
            $QEMU_IMG measure --output=$ofmt \
                              --object secret,id=sec0,data=base \
                              -o encrypt.format=luks,encrypt.key-secret=sec0,encrypt.iter-time=10 \
                              -f "$fmt" -O "$IMGFMT" "$TEST_IMG"
        fi

        echo
        echo "== $fmt input image and preallocation ($ofmt) =="
        echo
        $QEMU_IMG measure --output=$ofmt -o preallocation=full \
                          -f "$fmt" -O "$IMGFMT" "$TEST_IMG"
        echo
        convert_and_show_size "$fmt" -o preallocation=full

        echo
        echo "== Fully-allocated $fmt input image ($ofmt) =="
        echo
        make_test_img_with_fmt "$fmt" 8M
        qemu_io_with_fmt "$fmt" -c "write 0 8M" "$TEST_IMG" | _filter_qemu_io
        $QEMU_IMG measure --output=$ofmt -f "$fmt" -O "$IMGFMT" "$TEST_IMG"
        echo
        convert_and_show_size "$fmt"
    done
done

# success, all done
echo "*** done"
rm -f $seq.full
status=0
