docs: Move release notes to their own section.
[nbdkit/ericb.git] / tests / test-partitioning5.sh
blobd078254b9b439489ef89f3d736551e50f7f18219
1 #!/usr/bin/env bash
2 # nbdkit
3 # Copyright (C) 2018-2019 Red Hat Inc.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # * Neither the name of Red Hat nor the names of its contributors may be
17 # used to endorse or promote products derived from this software without
18 # specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
21 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23 # PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30 # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 # SUCH DAMAGE.
33 # Test the partitioning plugin.
35 # Test 5: Create a filesystem and embed it in an MBR logical
36 # partition. libguestfs uses virtio-scsi so the practical limit here
37 # is about 15 partitions.
39 source ./functions.sh
40 set -e
41 set -x
43 requires mke2fs -V
45 sock=`mktemp -u`
46 files="partitioning5.pid $sock
47 partitioning5.fs
48 partitioning5.p1 partitioning5.p2 partitioning5.p3 partitioning5.p5 partitioning5.p6 partitioning5.p7 partitioning5.p8 partitioning5.p9 partitioning5.p10 partitioning5.p11 partitioning5.p13"
49 rm -f $files
50 cleanup_fn rm -f $files
52 # Create partitions before and after.
53 truncate -s 1 partitioning5.p1
54 truncate -s 10M partitioning5.p2
55 truncate -s 512 partitioning5.p3
56 # partition 4 = extended partition
57 truncate -s 1 partitioning5.p5
58 truncate -s 512 partitioning5.p6
59 truncate -s 1 partitioning5.p7
60 truncate -s 1 partitioning5.p8
61 truncate -s 10M partitioning5.p9
62 truncate -s 512 partitioning5.p10
63 truncate -s 1 partitioning5.p11
64 # partition 12 = naked filesystem
65 truncate -s 10M partitioning5.p13
67 # Create the naked filesystem.
68 truncate -s 20M partitioning5.fs
69 mke2fs -F -t ext2 partitioning5.fs
71 # Run nbdkit.
72 start_nbdkit -P partitioning5.pid -U $sock \
73 partitioning \
74 partitioning5.p1 partitioning5.p2 \
75 partitioning5.p3 \
76 partitioning5.p5 partitioning5.p6 \
77 partitioning5.p7 partitioning5.p8 \
78 partitioning5.p9 partitioning5.p10 \
79 partitioning5.p11 partitioning5.fs \
80 partitioning5.p13 \
81 partition-type=mbr
83 # Connect with guestfish and read/write stuff to partition 12.
84 guestfish --format=raw -a "nbd://?socket=$sock" <<'EOF'
85 run
86 mount /dev/sda12 /
87 touch /hello
88 fill-pattern "abc" 10000 /pattern
89 ll /
90 umount /dev/sda12
91 sync
92 EOF