4 # qemu-img measure tests for LUKS images
6 # Copyright (C) 2020 Red Hat, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 owner=stefanha@redhat.com
26 echo "QA output created by $seq"
28 status=1 # failure is the default!
33 rm -f "$TEST_IMG.converted"
35 trap "_cleanup; exit \$status" 0 1 2 3 15
37 # get standard environment, filters and checks
46 SECRET=secret,id=sec0,data=passphrase
48 echo "== measure 1G image file =="
51 $QEMU_IMG measure --object "$SECRET" \
53 -o key-secret=sec0,iter-time=10 \
57 echo "== create 1G image file (size should be no greater than measured) =="
61 stat -c "image file size in bytes: %s" "$TEST_IMG_FILE"
64 echo "== modified 1G image file (size should be no greater than measured) =="
67 $QEMU_IO --object "$SECRET" --image-opts "$TEST_IMG" -c "write -P 0x51 0x10000 0x400" | _filter_qemu_io | _filter_testdir
68 stat -c "image file size in bytes: %s" "$TEST_IMG_FILE"
71 echo "== measure preallocation=falloc 1G image file =="
74 $QEMU_IMG measure --object "$SECRET" \
76 -o key-secret=sec0,iter-time=10,preallocation=falloc \
80 echo "== measure with input image file =="
83 IMGFMT=raw IMGKEYSECRET= IMGOPTS= _make_test_img 1G | _filter_imgfmt
84 QEMU_IO_OPTIONS= IMGOPTSSYNTAX= $QEMU_IO -f raw -c "write -P 0x51 0x10000 0x400" "$TEST_IMG_FILE" | _filter_qemu_io | _filter_testdir
85 $QEMU_IMG measure --object "$SECRET" \
87 -o key-secret=sec0,iter-time=10 \