]>
Commit | Line | Data |
---|---|---|
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 | # | |
19 | echo -n "kernel smoke test, create and destroy pool, raidz1: " | |
20 | TMP=/tmp | |
21 | VDEV0=${TMP}/pool0-$$.img | |
22 | VDEV1=${TMP}/pool1-$$.img | |
23 | VDEV2=${TMP}/pool2-$$.img | |
24 | VDEV3=${TMP}/pool3-$$.img | |
25 | VDEV_SZ=128 | |
26 | POOL=pool-smoke-$$ | |
27 | ||
28 | dd if=/dev/zero of=${VDEV0} bs=1M count=${VDEV_SZ} > /dev/null 2>&1 | |
29 | dd if=/dev/zero of=${VDEV1} bs=1M count=${VDEV_SZ} > /dev/null 2>&1 | |
30 | dd if=/dev/zero of=${VDEV2} bs=1M count=${VDEV_SZ} > /dev/null 2>&1 | |
31 | dd if=/dev/zero of=${VDEV3} bs=1M count=${VDEV_SZ} > /dev/null 2>&1 | |
32 | ||
33 | zpool create ${POOL} raidz ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} | |
34 | ret=$? | |
35 | if [ $ret -ne 0 ]; then | |
36 | echo "FAILED: zpool create failed, exit code=$ret" | |
37 | rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} | |
38 | exit 1 | |
39 | fi | |
40 | ||
41 | zpool destroy ${POOL} | |
42 | ret=$? | |
43 | if [ $ret -ne 0 ]; then | |
44 | echo "FAILED: zpool destroy failed, exit code=$ret" | |
45 | # | |
46 | # destroy failed, try to clean up, but this | |
47 | # wil probably fail | |
48 | # | |
49 | rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} | |
50 | exit 1 | |
51 | fi | |
52 | ||
53 | rm ${VDEV0} ${VDEV1} ${VDEV2} ${VDEV3} | |
54 | echo "PASSED" | |
55 | exit 0 |