Initial import of binutils 2.22 on the new vendor branch
[dragonfly.git] / contrib / lvm2 / dist / test / t-pool-labels.sh
1 # Copyright (C) 2007 Red Hat, Inc. All rights reserved.
2 #
3 # This copyrighted material is made available to anyone wishing to use,
4 # modify, copy, or redistribute it subject to the terms and conditions
5 # of the GNU General Public License v.2.
6 #
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software Foundation,
9 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
10
11 . ./test-utils.sh
12
13 # create the old GFS pool labeled linear devices
14 create_pool_label_()
15 {
16   # FIXME
17   # echo -e is bashism, dash builtin sh doesn't do \xNN in printf either
18   # printf comes from coreutils, and is probably not posix either
19   env printf "\x01\x16\x70\x06\x5f\xcf\xff\xb9\xf8\x24\x8apool1" | dd of=$2 bs=5 seek=1 conv=notrunc
20   env printf "\x04\x01\x03\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x0$1\x68\x01\x16\x70\x00\x00\x00\x00\x00\x06\x5f\xd0" | dd of=$2 bs=273 seek=1 conv=notrunc
21 }
22
23 env printf "" || exit 200 # skip if printf is not available
24
25 aux prepare_devs 2
26
27 create_pool_label_ 0 "$dev1"
28 create_pool_label_ 1 "$dev2"
29
30 # check that pvcreate fails without -ff on the pool device
31 not pvcreate "$dev1"
32
33 # check that vgdisplay and pvcreate -ff works with the pool device
34 vgdisplay --config 'global { locking_type = 0 }'
35 disable_dev "$dev2"
36 # FIXME! since pool1 cannot be opened, vgdisplay gives error... should we say
37 # "not" there instead, checking that it indeed does fail?
38 vgdisplay --config 'global { locking_type = 0 }' || true
39 pvcreate -ff -y "$dev1"