Skip to content

Commit

Permalink
slog 1,2,3,4,5,6,7 ported
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohan Puri committed Oct 26, 2010
1 parent 5ef32bd commit f0dad26
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ function log_neg_expect
logfile="$logfile.$$"
chmod 0777 $logfile
done


echo "$@"
"$@" 2>$logfile
echo "in log_neg_expect arg is : $@"
typeset status=$?
out="$CAT $logfile"

Expand Down Expand Up @@ -162,7 +162,7 @@ function log_neg_expect
_printsuccess "$@" "exited $status"
fi
fi
#_recursive_output $logfile "false"
_recursive_output $logfile "false"
return $ret
}

Expand All @@ -177,9 +177,9 @@ function log_pos
typeset out=""
typeset logfile="/tmp/log.$$"

# while [[ -e $logfile ]]; do
# logfile="$logfile"
# done
while [[ -e $logfile ]]; do
logfile="$logfile"
done
echo "args to log_pos : $@"
"$@" 2>$logfile
typeset status=$?
Expand All @@ -203,7 +203,7 @@ function log_pos
_printsuccess "$@"
fi
fi
#_recursive_output $logfile "false"
_recursive_output $logfile "false"
return $status
}

Expand Down
5 changes: 3 additions & 2 deletions ZFS-Test_Suite/tests/functional/slog/slog.kshlib
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ function verify_slog_device
while (( i < ${#dev_stat_tab[@]} )); do
typeset dev=${dev_stat_tab[$i]}
typeset stat=${dev_stat_tab[((i+1))]}

case $dev in
stripe:$device)
stripe:$device)
echo " hi"
if [[ "$type" == 'mirror' ]]; then
log_note "Unexpected type: mirror"
return 1
Expand All @@ -134,6 +134,7 @@ function verify_slog_device
fi
;;
mirror:$device)
echo "hello"
if [[ -z "$type" || $type == 'stripe' ]]; then
log_note "Unexpected type: stripe"
return 1
Expand Down
7 changes: 4 additions & 3 deletions ZFS-Test_Suite/tests/functional/slog/slog_002_pos
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#
################################################################################

verify_runnable "global"
#verify_runnable "global"

log_assert "Adding a log device to normal pool works."
log_onexit cleanup
Expand All @@ -65,13 +65,14 @@ do
do
for logtype in "" "mirror"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV $spare $SDEV
log_must $ZPOOL create $TESTPOOL $type -f $VDEV $spare $SDEV
log_must $ZPOOL add $TESTPOOL log $logtype $LDEV
log_must display_status $TESTPOOL
typeset ldev=$(random_get $LDEV)
log_must verify_slog_device \
$TESTPOOL $ldev 'ONLINE' $logtype
log_must $ZPOOL destroy -f $TESTPOOL
log_must $ZFS umount -a
log_must $ZPOOL destroy $TESTPOOL
done
done
done
Expand Down
6 changes: 3 additions & 3 deletions ZFS-Test_Suite/tests/functional/slog/slog_003_pos
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ do
do
for newtype in "" "mirror"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must $ZPOOL create $TESTPOOL $type -f $VDEV \
$spare $SDEV log $logtype $LDEV
log_must $ZPOOL add $TESTPOOL \
log $newtype $LDEV2
Expand All @@ -76,8 +76,8 @@ do
ldev=$(random_get $LDEV2)
log_must verify_slog_device \
$TESTPOOL $ldev 'ONLINE' $newtype

log_must $ZPOOL destroy -f $TESTPOOL
log_must $ZFS umount -a
log_must $ZPOOL destroy $TESTPOOL
done
done
done
Expand Down
6 changes: 3 additions & 3 deletions ZFS-Test_Suite/tests/functional/slog/slog_004_pos
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ do
do
for logtype in "" "mirror"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must $ZPOOL create $TESTPOOL $type -f $VDEV \
$spare $SDEV log $logtype $LDEV

ldev=$(random_get $LDEV)
Expand All @@ -76,8 +76,8 @@ do
$TESTPOOL $ldev 'ONLINE' 'mirror'
log_must verify_slog_device \
$TESTPOOL $ldev2 'ONLINE' 'mirror'

log_must $ZPOOL destroy -f $TESTPOOL
log_must $ZFS umount -a
log_must $ZPOOL destroy $TESTPOOL
done
done
done
Expand Down
5 changes: 3 additions & 2 deletions ZFS-Test_Suite/tests/functional/slog/slog_005_pos
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ for type in "" "mirror" "raidz" "raidz2"
do
for spare in "" "spare"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV $spare $SDEV \
log_must $ZPOOL create $TESTPOOL $type -f $VDEV $spare $SDEV \
log mirror $LDEV mirror $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_must $ZPOOL detach $TESTPOOL $ldev
log_must display_status $TESTPOOL
log_mustnot verify_slog_device $TESTPOOL $ldev 'ONLINE' 'mirror'

log_must $ZPOOL destroy -f $TESTPOOL
log_must $ZFS umount -a
log_must $ZPOOL destroy $TESTPOOL
done
done

Expand Down
9 changes: 5 additions & 4 deletions ZFS-Test_Suite/tests/functional/slog/slog_006_pos
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,19 @@ do
do
for logtype in "" "mirror"
do
log_must $ZPOOL create $TESTPOOL $type $VDEV \
log_must $ZPOOL create $TESTPOOL $type -f $VDEV \
$spare $SDEV log $logtype $LDEV
sdev=$(random_get $LDEV)
tdev=$(random_get $LDEV2)
log_must $ZPOOL replace $TESTPOOL $sdev $tdev
log_must $ZPOOL replace -f $TESTPOOL $sdev $tdev
log_must display_status $TESTPOOL
# sleep 15 to make sure replacement completely.
log_must $SLEEP 15
log_must verify_slog_device \
$TESTPOOL $tdev 'ONLINE' $logtype

log_must $ZPOOL destroy -f $TESTPOOL

log_must $ZFS umount -a
log_must $ZPOOL destroy $TESTPOOL
done
done
done
Expand Down
11 changes: 8 additions & 3 deletions ZFS-Test_Suite/tests/functional/slog/slog_007_pos
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#
################################################################################

verify_runnable "global"
#verify_runnable "global"

log_assert "Exporting and importing pool with log devices passes."
log_onexit cleanup
Expand All @@ -80,8 +80,10 @@ do
#
# Nomal export/import operating
#
log_must $ZFS umount -a
log_must $ZPOOL export $TESTPOOL
log_must $ZPOOL import -d $VDIR -d $VDIR2 $TESTPOOL
log_must $ZFS mount -a
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_slog_device \
Expand All @@ -90,14 +92,17 @@ do
#
# Destroy the pool and import again
#
log_must $ZFS umount -a
log_must $ZPOOL destroy $TESTPOOL
log_must $ZPOOL import -Df -d $VDIR -d $VDIR2 $TESTPOOL
log_must $ZFS mount -a
log_must display_status $TESTPOOL
ldev=$(random_get $LDEV $LDEV2)
log_must verify_slog_device \
$TESTPOOL $ldev 'ONLINE' $logtype

log_must $ZPOOL destroy -f $TESTPOOL

log_must $ZFS umount -a
log_must $ZPOOL destroy $TESTPOOL
done
done
done
Expand Down
4 changes: 2 additions & 2 deletions ZFS-Test_Suite/tests/functional/slog/slog_008_neg
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#
################################################################################

verify_runnable "global"
#verify_runnable "global"

log_assert "A raidz/raidz2 log is not supported."
log_onexit cleanup
Expand All @@ -63,7 +63,7 @@ do
do
for logtype in "raidz" "raidz1" "raidz2"
do
log_mustnot $ZPOOL create $TESTPOOL $type $VDEV \
log_mustnot $ZPOOL create $TESTPOOL $type -f $VDEV \
$spare $SDEV log $logtype $LDEV $LDEV2
ldev=$(random_get $LDEV $LDEV2)
log_mustnot verify_slog_device \
Expand Down

0 comments on commit f0dad26

Please sign in to comment.