]>
git.proxmox.com Git - mirror_zfs-debian.git/blob - debian/tests/kernel-smoke-test-clone
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 clone: "
21 VDEV0
=${TMP}/pool0-$$.img
22 VDEV1
=${TMP}/pool1-$$.img
24 DATA
=/${POOL}/test
/data
25 DATA_CLONE
=/${POOL}/test-clone
/data
27 dd if=/dev
/zero of
=${VDEV0} bs
=1M count
=128 > /dev
/null
2>&1
28 dd if=/dev
/zero of
=${VDEV1} bs
=1M count
=128 > /dev
/null
2>&1
30 zpool create
${POOL} ${VDEV0} ${VDEV1}
32 if [ $ret -ne 0 ]; then
33 echo "FAILED: zpool create failed, exit code=$ret"
38 zfs create
${POOL}/test
40 if [ $ret -ne 0 ]; then
41 echo "FAILED: zfs create failed, exit code=$ret"
48 # Populate with files..
50 cp -rp /etc
/${POOL}/test
51 dd if=/dev
/urandom of
=${DATA} bs
=1M count
=64 > /dev
/null
2>&1
52 sum1
=$
(md5sum ${DATA} |
awk '{print $1}')
57 zfs snapshot
-r ${POOL}/test@snap
59 if [ $ret -ne 0 ]; then
60 echo "FAILED: zfs snapshot failed, exit code=$ret"
69 zfs clone
${POOL}/test@snap
${POOL}/test-clone
72 # Checksums must agree
74 sum2
=$
(md5sum ${DATA_CLONE} |
awk '{print $1}')
75 if [ x
"$sum1" != x
"$sum2" ]; then
76 echo "FAILED: cloned data different from original"
84 if [ $ret -ne 0 ]; then
85 echo "FAILED: zpool destroy failed, exit code=$ret"
87 # destroy failed, try to clean up, but this