]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - debian/tests/kernel-smoke-test-snapshot
3 # Copyright (C) 2016 Canonical
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.
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.
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.
19 echo -n "kernel smoke test, ZFS snapshot: "
21 VDEV0
=${TMP}/pool0-$$.img
22 VDEV1
=${TMP}/pool1-$$.img
24 MARKER
=/${POOL}/test
/marker
26 dd if=/dev
/zero of
=${VDEV0} bs
=1M count
=512 > /dev
/null
2>&1
27 dd if=/dev
/zero of
=${VDEV1} bs
=1M count
=512 > /dev
/null
2>&1
29 zpool create
${POOL} ${VDEV0} ${VDEV1}
31 if [ $ret -ne 0 ]; then
32 echo "FAILED: zpool create failed, exit code=$ret"
37 zfs create
${POOL}/test
39 if [ $ret -ne 0 ]; then
40 echo "FAILED: zfs create failed, exit code=$ret"
47 # Populate with files..
49 cp -rp /etc
/${POOL}/test
55 zfs snapshot
-r ${POOL}/test@snap
57 if [ $ret -ne 0 ]; then
58 echo "FAILED: zfs snapshot failed, exit code=$ret"
67 rm -rf /${POOL}/test
/etc
${MARKER}
72 zfs rollback
${POOL}/test@snap
74 if [ $ret -ne 0 ]; then
75 echo "FAILED: zfs rollback failed, exit code=$ret"
82 # Check rolled back marker contains sane data
84 if [ ! -e ${MARKER} ]; then
85 echo "FAILED: zfs rollback failed, ${MARKER} not restored"
91 if [ $data -ne $$
]; then
92 echo "FAILED: zfs rollback failed, ${MARKER} contained unexpected data"
98 zfs destroy
${POOL}/test@snap
100 if [ $ret -ne 0 ]; then
101 echo "FAILED: zfs destroy snapshot failed, exit code=$ret"
102 zpool destroy
${POOL}
107 zpool destroy
${POOL}
109 if [ $ret -ne 0 ]; then
110 echo "FAILED: zpool destroy failed, exit code=$ret"
112 # destroy failed, try to clean up, but this