Revert "ci: skip "lib/test-fork-safe-execvpe.sh" on Alpine Linux"
[libnbd.git] / interop / structured-read.sh
blob5d22e4fa81a6c0b14b6acce014b828628919b700
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 structured read callbacks.
21 source ../tests/functions.sh
22 set -e
23 set -x
25 requires qemu-img --version
26 requires qemu-io --version
27 requires qemu-nbd --version
29 files="structured-read.qcow2"
30 rm -f $files
31 cleanup_fn rm -f $files
33 # Create file with cluster size 512 and contents all 1 except for single
34 # 512-byte hole at offset 2048
35 qemu-img create -f qcow2 -o cluster_size=512,compat=v3 structured-read.qcow2 3k
36 qemu-io -d unmap -f qcow2 -c 'w -P 1 0 3k' -c 'w -zu 2k 512' \
37 structured-read.qcow2
39 # Run the test.
40 $VG ./structured-read qemu-nbd -f qcow2 structured-read.qcow2