Revert "ci: skip "lib/test-fork-safe-execvpe.sh" on Alpine Linux"
[libnbd.git] / interop / dirty-bitmap.sh
blob10ecedb642049048f9e8eda76969d90609850870
1 #!/usr/bin/env bash
2 # nbd client library in userspace
3 # Copyright Red Hat
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 # Test reading qemu dirty-bitmap.
21 source ../tests/functions.sh
22 set -e
23 set -x
25 requires qemu-img bitmap --help
26 requires qemu-io --version
27 requires qemu-nbd --version
29 # This test uses the qemu-nbd -B option.
30 if ! qemu-nbd --help | grep -sq -- -B; then
31 echo "$0: skipping because qemu-nbd does not support the -B option"
32 exit 77
35 files="dirty-bitmap.qcow2"
36 rm -f $files
37 cleanup_fn rm -f $files
39 # Create file with intentionally different written areas vs. dirty areas
40 qemu-img create -f qcow2 dirty-bitmap.qcow2 1M
41 qemu-io -f qcow2 -c 'w 0 64k' dirty-bitmap.qcow2
42 qemu-img bitmap --add --enable -f qcow2 dirty-bitmap.qcow2 bitmap0
43 qemu-io -f qcow2 -c 'w 64k 64k' -c 'w -z 512k 64k' dirty-bitmap.qcow2
45 # Run the test.
46 $VG ./dirty-bitmap qemu:dirty-bitmap:bitmap0 \
47 qemu-nbd -f qcow2 -B bitmap0 dirty-bitmap.qcow2