Skip to content
Browse files

I have ported cachefile script.

  • Loading branch information...
1 parent 73bea0e commit 1d6c72b8c796457c2498f6e27a8fa132da8e5895 @vikramjadhav vikramjadhav committed Dec 7, 2010
View
1 ZFS-Test_Suite/tests/functional/cachefile/cachefile.cfg
@@ -29,3 +29,4 @@
export CPATH="/etc/zfs/zpool.cache"
export CPATH1=/var/tmp/cachefile.$$
export CPATH2=/cachefile.$$
+export TESTPOOL2="tank2"
View
6 ZFS-Test_Suite/tests/functional/cachefile/cachefile_001_pos.ksh
@@ -59,9 +59,7 @@
# __stc_assertion_end
#
################################################################################
-
DISKS="$@"
-
function cleanup
{
typeset file
@@ -90,7 +88,6 @@ typeset -i i=0
while (( i < ${#opts[*]} )); do
log_must $ZPOOL create -o cachefile=${opts[i]} $TESTPOOL $DISKS
-
case ${opts[((i+1))]} in
false) log_mustnot pool_in_cache $TESTPOOL
;;
@@ -103,10 +100,7 @@ while (( i < ${#opts[*]} )); do
log_fail "cachefile property not set as expected. " \
"Expect: ${opts[((i+2))]}, Current: $PROP"
fi
-
- umount /$TESTPOOL #temp changes
log_must $ZPOOL destroy $TESTPOOL
- rm -rf /$TESTPOOL #temp changes
sleep 10
(( i = i + 3 ))
done
View
3 ZFS-Test_Suite/tests/functional/cachefile/cachefile_002_pos.ksh
@@ -27,9 +27,9 @@
# ident "@(#)cachefile_002_pos.ksh 1.2 09/01/13 SMI"
#
+. $STF_SUITE/commands.cfg
. $STF_SUITE/include/libtest.kshlib
. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib
-. $STF_SUITE/commands.cfg
. $STF_SUITE/tests/functional/cachefile/cachefile.cfg
. $STF_SUITE/include/default_common_varible.kshlib
@@ -76,6 +76,7 @@ verify_runnable "global"
log_assert "Importing a pool with \"cachefile\" set doesn't update zpool.cache"
log_onexit cleanup
+
log_must $ZPOOL create -o cachefile=none $TESTPOOL $DISKS
typeset DEVICEDIR=$(get_device_dir $DISKS)
log_mustnot pool_in_cache $TESTPOOL
View
4 ZFS-Test_Suite/tests/functional/cachefile/cachefile_003_pos.ksh
@@ -93,7 +93,6 @@ set -A opts "none" "none" \
"$CPATH1" "$CPATH1" \
"$CPATH2" "$CPATH2"
-
while (( i < ${#opts[*]} )); do
log_must $ZPOOL create -o altroot=$TESTDIR -o cachefile=${opts[i]} \
$TESTPOOL $DISKS
@@ -108,8 +107,7 @@ while (( i < ${#opts[*]} )); do
log_fail "cachefile property not set as expected. " \
"Expect: ${opts[((i+1))]}, Current: $PROP"
fi
-
- umount /$TESTDIR # temp cahnges
+ umount /$TESTDIR
log_must $ZPOOL destroy $TESTPOOL
(( i = i + 2 ))
done
View
25 ZFS-Test_Suite/tests/functional/cachefile/cachefile_004_pos.ksh
@@ -28,11 +28,11 @@
#
-. $STF_SUITE/include/libtest.kshlib
-. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib
. $STF_SUITE/commands.cfg
-. $STF_SUITE/tests/functional/cachefile/cachefile.cfg
+. $STF_SUITE/include/libtest.kshlib
. $STF_SUITE/include/default_common_varible.kshlib
+. $STF_SUITE/tests/functional/cachefile/cachefile.cfg
+. $STF_SUITE/tests/functional/cachefile/cachefile.kshlib
#################################################################################
@@ -81,7 +81,6 @@ function cleanup
fi
((i += 1))
done
-
if poolexists $TESTPOOL ; then
destroy_pool $TESTPOOL
fi
@@ -101,47 +100,53 @@ log_must $ZPOOL create $TESTPOOL $DISKS
mntpnt=$(get_prop mountpoint $TESTPOOL)
typeset -i i=0
+
+############# Create two device
while ((i < 2)); do
log_must $DD if=/dev/zero of=$mntpnt/vdev$i bs=1M count=64
eval vdev$i=$mntpnt/vdev$i
((i += 1))
done
+############# Create first pool with one same cahcefile1.
log_must $ZPOOL create -o cachefile=$CPATH1 $TESTPOOL1 $vdev0
log_must pool_in_cache $TESTPOOL1 $CPATH1
+############# Create second pool with one same cahcefile1.
log_must $ZPOOL create -o cachefile=$CPATH1 $TESTPOOL2 $vdev1
log_must pool_in_cache $TESTPOOL2 $CPATH1
+
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL1
log_must pool_in_cache $TESTPOOL1 $CPATH2
-
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL2
log_must pool_in_cache $TESTPOOL2 $CPATH2
-
+############ Verify cachefile1 not exist.
if [[ -f $CPATH1 ]]; then
log_fail "Verify set when cachefile is set on pool."
fi
-umount /$TESTPOOL1 #temp changes
+############# Export the two pools.
+#umount /$TESTPOOL1 #temp changes
log_must $ZPOOL export $TESTPOOL1
-umount /$TESTPOOL2 #temp cahnges
+#umount /$TESTPOOL2 #temp cahnges
log_must $ZPOOL export $TESTPOOL2
+############ Verify cachefile2 not exist.
if [[ -f $CPATH2 ]]; then
log_fail "Verify export when cachefile is set on pool."
fi
+######### Import the two pools and set cachefile to cachefile2.
log_must $ZPOOL import -d $mntpnt $TESTPOOL1
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL1
log_must pool_in_cache $TESTPOOL1 $CPATH2
-
log_must $ZPOOL import -d $mntpnt $TESTPOOL2
log_must $ZPOOL set cachefile=$CPATH2 $TESTPOOL2
log_must pool_in_cache $TESTPOOL2 $CPATH2
+########## Destroy the two pools.
log_must $ZPOOL destroy $TESTPOOL1
-
log_must $ZPOOL destroy $TESTPOOL2
if [[ -f $CPATH2 ]]; then
log_fail "Verify destroy when cachefile is set on pool."

0 comments on commit 1d6c72b

Please sign in to comment.
Something went wrong with that request. Please try again.