]> git.proxmox.com Git - mirror_zfs-debian.git/blame - debian/tests/kernel-smoke-test-zil
Merge tag 'upstream/0.7.6'
[mirror_zfs-debian.git] / debian / tests / kernel-smoke-test-zil
CommitLineData
a99554ab
AX
1#!/bin/sh
2#
3# Copyright (C) 2016 Canonical
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License
7# as published by the Free Software Foundation; either version 2
8# of the License, or (at your option) any later version.
9#
10# This program 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
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18#
19echo -n "kernel smoke test, create and destroy ZFS Intent Log: "
20TMP=/tmp
21VDEV0=${TMP}/pool0-$$.img
22VDEV1=${TMP}/pool1-$$.img
23POOL=pool-smoke-$$
24
25dd if=/dev/zero of=${VDEV0} bs=1M count=512 > /dev/null 2>&1
26dd if=/dev/zero of=${VDEV1} bs=1M count=512 > /dev/null 2>&1
27
28zpool create ${POOL} ${VDEV0}
29ret=$?
30if [ $ret -ne 0 ]; then
31 echo "FAILED: zpool create failed, exit code=$ret"
32 rm ${VDEV0} ${VDEV1}
33 exit 1
34fi
35
36#
37# And add the ZIL
38#
39zpool add ${POOL} log ${VDEV1}
40ret=$?
41if [ $ret -ne 0 ]; then
42 echo "FAILED: ZIL add failed, exit code=$ret"
43 zpool destroy ${POOL}
44 rm ${VDEV0} ${VDEV1}
45 exit 1
46fi
47
48sync
49
50#
51# And now remove ZIL
52#
53zpool remove ${POOL} ${VDEV1}
54ret=$?
55if [ $ret -ne 0 ]; then
56 echo "FAILED: ZIL remove failed, exit code=$ret"
57 zpool destroy ${POOL}
58 rm ${VDEV0} ${VDEV1}
59 exit 1
60fi
61
62zpool destroy ${POOL}
63ret=$?
64if [ $ret -ne 0 ]; then
65 echo "FAILED: zpool destroy failed, exit code=$ret"
66 #
67 # destroy failed, try to clean up, but this
68 # wil probably fail
69 #
70 rm ${VDEV0} ${VDEV1}
71 exit 1
72fi
73
74rm ${VDEV0} ${VDEV1}
75echo "PASSED"
76exit 0