[Pkg-zfsonlinux-devel] [SCM] zfs branch, master, updated. upstream/0.6.5.5-682-ga99554a

Aron Xu aron at debian.org
Mon Apr 25 13:35:30 UTC 2016


The following commit has been merged in the master branch:
commit a99554ab24fb05b3acb5fadd5f9916e6a1ca49a5
Author: Aron Xu <aron at debian.org>
Date:   Mon Apr 25 21:09:12 2016 +0800

    Adding smoke testing scripts from Ubuntu

diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..f0197e6
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: kernel-smoke-test
+Restrictions: needs-root
+Depends: @
diff --git a/debian/tests/kernel-smoke-test b/debian/tests/kernel-smoke-test
new file mode 100755
index 0000000..8edf18f
--- /dev/null
+++ b/debian/tests/kernel-smoke-test
@@ -0,0 +1,48 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+#
+# We run all the tests in this specific order from this
+# main script so that we don't have to go through the
+# pain of checking and rebuilding installing and removing
+# the modules for each test.  A good smoke test will
+# exercise all the base functionality with the same
+# instance of the ZFS spl and zfs drivers to see what
+# the cumulative testing of each scenario does to the
+# environment.
+#
+TESTS="kernel-smoke-test-pool-2x2-mirror kernel-smoke-test-pool-4x1-mirror kernel-smoke-test-pool-nested-raidz3 kernel-smoke-test-pool-raidz1 kernel-smoke-test-pool-raidz2 kernel-smoke-test-pool-raidz3 kernel-smoke-test-pool-striped kernel-smoke-test-zil kernel-smoke-test-filesystem kernel-smoke-test-snapshot kernel-smoke-test-clone kernel-smoke-test-send-receive kernel-smoke-test-scrub"
+rc=0
+#
+#  We only test on 64 bit arches for the moment
+#  as these are the ones that ZFS supports.
+#
+if [ `getconf LONG_BIT` = "32" ]
+then
+	echo "Testing on 32 bit architectures not possible."
+	exit 0
+fi
+
+for t in ${TESTS}
+do
+	./debian/tests/$t
+	if [ $? -ne 0 ]; then
+		rc=1
+	fi
+done
+exit $rc
diff --git a/debian/tests/kernel-smoke-test-clone b/debian/tests/kernel-smoke-test-clone
new file mode 100755
index 0000000..eaa2c23
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-clone
@@ -0,0 +1,96 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, ZFS clone: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+POOL=pool-smoke-$$
+DATA=/${POOL}/test/data
+DATA_CLONE=/${POOL}/test-clone/data
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=128 > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=128 > /dev/null 2>&1
+
+zpool create ${POOL} ${VDEV0} ${VDEV1}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+zfs create ${POOL}/test
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs create failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Populate with files..
+#
+cp -rp /etc /${POOL}/test
+dd if=/dev/urandom of=${DATA} bs=1M count=64 > /dev/null 2>&1
+sum1=$(md5sum ${DATA} | awk '{print $1}')
+
+#
+# Make a snapshot
+#
+zfs snapshot -r ${POOL}/test at snap
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs snapshot failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Clone 
+#
+zfs clone ${POOL}/test at snap ${POOL}/test-clone
+
+#
+# Checksums must agree
+#
+sum2=$(md5sum ${DATA_CLONE} | awk '{print $1}')
+if [ x"$sum1" != x"$sum2" ]; then
+	echo "FAILED: cloned data different from original"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-filesystem b/debian/tests/kernel-smoke-test-filesystem
new file mode 100755
index 0000000..d8fd834
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-filesystem
@@ -0,0 +1,99 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy ZFS filesystems: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+POOL=pool-smoke-$$
+ZFSFS="test tmp example data1 data2 data3"
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=512 > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=512 > /dev/null 2>&1
+
+zpool create ${POOL} ${VDEV0} ${VDEV1}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# And populate with ZFS file systems
+#
+for fs in ${ZFSFS}
+do
+	zfs create ${POOL}/$fs 
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "FAILED: zfs create filesystem $fs failed, exit code=$ret"
+		zpool destroy ${POOL}
+		rm ${VDEV0} ${VDEV1}
+		exit 1
+	fi
+	
+	zfs set quota=128M ${POOL}/$fs
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "FAILED: zfs set quota on $fs failed, exit code=$ret"
+		zpool destroy ${POOL}
+		rm ${VDEV0} ${VDEV1}
+		exit 1
+	fi
+
+	zfs set compression=on ${POOL}/$fs
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "FAILED: zfs set compression on $fs failed, exit code=$ret"
+		zpool destroy ${POOL}
+		rm ${VDEV0} ${VDEV1}
+		exit 1
+	fi
+done
+
+#
+# And destroy ZFS file systems
+#
+for fs in ${ZFSFS}
+do
+	zfs destroy ${POOL}/$fs 
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		echo "FAILED: zfs destroy filesystem $fs failed, exit code=$ret"
+		zpool destroy ${POOL}
+		rm ${VDEV0} ${VDEV1}
+		exit 1
+	fi
+done
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-pool-2x2-mirror b/debian/tests/kernel-smoke-test-pool-2x2-mirror
new file mode 100755
index 0000000..7728f88
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-pool-2x2-mirror
@@ -0,0 +1,55 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy pool, 2x2 mirror: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV_SZ=128
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} mirror ${VDEV0} ${VDEV1} mirror ${VDEV2} ${VDEV3}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-pool-4x1-mirror b/debian/tests/kernel-smoke-test-pool-4x1-mirror
new file mode 100755
index 0000000..b48f868
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-pool-4x1-mirror
@@ -0,0 +1,55 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy pool, 4x1 mirror: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV_SZ=128
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} mirror ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-pool-nested-raidz3 b/debian/tests/kernel-smoke-test-pool-nested-raidz3
new file mode 100755
index 0000000..5f233a5
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-pool-nested-raidz3
@@ -0,0 +1,63 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy pool, nested raidz3: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV4=${TMP}/pool4-$$.img
+VDEV5=${TMP}/pool5-$$.img
+VDEV6=${TMP}/pool6-$$.img
+VDEV7=${TMP}/pool7-$$.img
+VDEV_SZ=64
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV4} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV5} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV6} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV7} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} raidz3 ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} raidz3 ${VDEV4} ${VDEV5} ${VDEV6} ${VDEV7}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} ${VDEV4} ${VDEV5} ${VDEV6} ${VDEV7}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} ${VDEV4} ${VDEV5} ${VDEV6} ${VDEV7}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} ${VDEV4} ${VDEV5} ${VDEV6} ${VDEV7}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-pool-raidz1 b/debian/tests/kernel-smoke-test-pool-raidz1
new file mode 100755
index 0000000..cf8d04b
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-pool-raidz1
@@ -0,0 +1,55 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy pool, raidz1: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV_SZ=128
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} raidz ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-pool-raidz2 b/debian/tests/kernel-smoke-test-pool-raidz2
new file mode 100755
index 0000000..236aa29
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-pool-raidz2
@@ -0,0 +1,55 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy pool, raidz2: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV_SZ=128
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} raidz2 ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-pool-raidz3 b/debian/tests/kernel-smoke-test-pool-raidz3
new file mode 100755
index 0000000..15835bf
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-pool-raidz3
@@ -0,0 +1,55 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy pool, raidz3: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV_SZ=128
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} raidz3 ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-pool-striped b/debian/tests/kernel-smoke-test-pool-striped
new file mode 100755
index 0000000..d035f06
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-pool-striped
@@ -0,0 +1,55 @@
+#!/bin/sh 
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy pool, striped: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV_SZ=128
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-scrub b/debian/tests/kernel-smoke-test-scrub
new file mode 100755
index 0000000..a330715
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-scrub
@@ -0,0 +1,114 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, corrupt data and clean with a scrub: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+VDEV2=${TMP}/pool2-$$.img
+VDEV3=${TMP}/pool3-$$.img
+VDEV_SZ=128
+POOL=pool-smoke-$$
+DATA=/${POOL}/random.dat
+ZFSFS="test tmp example data1 data2 data3"
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+
+zpool create ${POOL} mirror ${VDEV0} ${VDEV1} mirror ${VDEV2} ${VDEV3}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+#
+# Create a file
+#
+dd if=/dev/urandom of=$DATA bs=1M count=64 > /dev/null 2>&1
+sum1=$(md5sum ${DATA} | awk '{print $1}')
+
+#
+# Corrupt VDEV0
+#
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+sync
+
+#
+# Offline "corrupted" VDEV
+#
+zpool detach ${POOL} ${VDEV0}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool detach failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+#
+# Zero corrupted VDEV and re-attach
+#
+dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1
+zpool attach ${POOL} ${VDEV1} ${VDEV0} -f
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool attach failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool scrub ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool scrub failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+sum2=$(md5sum ${DATA} | awk '{print $1}')
+#
+# Checksums must agree
+#
+if [ x"$sum1" != x"$sum2" ]; then
+	echo "FAILED: corrupted data on scrubbed pool"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-send-receive b/debian/tests/kernel-smoke-test-send-receive
new file mode 100755
index 0000000..b1f6668
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-send-receive
@@ -0,0 +1,109 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, ZFS send and receive: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+POOL=pool-smoke-$$
+SNAP=${TMP}/snapshot-$$.zfs
+DATA=/${POOL}/test/data
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=512 > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=512 > /dev/null 2>&1
+
+zpool create ${POOL} ${VDEV0} ${VDEV1}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+zfs create ${POOL}/test
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs create failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Populate with files..
+#
+cp -rp /etc /${POOL}/test
+dd if=/dev/urandom of=${DATA} bs=1M count=64 > /dev/null 2>&1
+sum1=$(md5sum ${DATA} | awk '{print $1}')
+
+#
+# Make a snapshot
+#
+zfs snapshot -r ${POOL}/test at snap
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs snapshot failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Make snapshot
+#
+zfs send ${POOL}/test at snap > ${SNAP}
+
+rm -rf ${POOL}/test
+
+zfs destroy ${POOL}/test at snap
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs destroy snapshot failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Receive it back..
+#
+zfs receive -F ${POOL}/test < ${SNAP}
+
+sum2=$(md5sum ${DATA} | awk '{print $1}')
+if [ x"$sum1" != x"$sum2" ]; then
+        echo "FAILED: received data different from original"
+        zpool destroy ${POOL}
+        rm ${VDEV0} ${VDEV1}
+        exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-snapshot b/debian/tests/kernel-smoke-test-snapshot
new file mode 100755
index 0000000..62e10c2
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-snapshot
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, ZFS snapshot: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+POOL=pool-smoke-$$
+MARKER=/${POOL}/test/marker
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=512 > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=512 > /dev/null 2>&1
+
+zpool create ${POOL} ${VDEV0} ${VDEV1}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+zfs create ${POOL}/test
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs create failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Populate with files..
+#
+cp -rp /etc /${POOL}/test
+echo $$ > ${MARKER}
+
+#
+# Make a snapshot
+#
+zfs snapshot -r ${POOL}/test at snap
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs snapshot failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Remove files
+#
+rm -rf /${POOL}/test/etc ${MARKER}
+
+#
+# Roll back
+#
+zfs rollback ${POOL}/test at snap
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs rollback failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# Check rolled back marker contains sane data
+#
+if [ ! -e ${MARKER} ]; then
+	echo "FAILED: zfs rollback failed, ${MARKER} not restored"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+data=$(cat ${MARKER})
+if [ $data -ne $$ ]; then
+	echo "FAILED: zfs rollback failed, ${MARKER} contained unexpected data"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+zfs destroy ${POOL}/test at snap
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zfs destroy snapshot failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1}
+echo "PASSED"
+exit 0
diff --git a/debian/tests/kernel-smoke-test-zil b/debian/tests/kernel-smoke-test-zil
new file mode 100755
index 0000000..42af87a
--- /dev/null
+++ b/debian/tests/kernel-smoke-test-zil
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# Copyright (C) 2016 Canonical
+#   
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+echo -n "kernel smoke test, create and destroy ZFS Intent Log: "
+TMP=/tmp
+VDEV0=${TMP}/pool0-$$.img
+VDEV1=${TMP}/pool1-$$.img
+POOL=pool-smoke-$$
+
+dd if=/dev/zero of=${VDEV0} bs=1M count=512 > /dev/null 2>&1
+dd if=/dev/zero of=${VDEV1} bs=1M count=512 > /dev/null 2>&1
+
+zpool create ${POOL} ${VDEV0} 
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool create failed, exit code=$ret"
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+#
+# And add the ZIL
+#
+zpool add ${POOL} log ${VDEV1}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: ZIL add failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+sync
+
+#
+# And now remove ZIL
+#
+zpool remove ${POOL} ${VDEV1}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: ZIL remove failed, exit code=$ret"
+	zpool destroy ${POOL}
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+zpool destroy ${POOL}
+ret=$?
+if [ $ret -ne 0 ]; then
+	echo "FAILED: zpool destroy failed, exit code=$ret"
+	#
+	# destroy failed, try to clean up, but this
+	# wil probably fail
+	#
+	rm ${VDEV0} ${VDEV1}
+	exit 1
+fi
+
+rm ${VDEV0} ${VDEV1}
+echo "PASSED"
+exit 0

-- 
OpenZFS on Linux



More information about the Pkg-zfsonlinux-devel mailing list