aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2017-10-23 09:45:59 -0700
committerGitHub <[email protected]>2017-10-23 09:45:59 -0700
commitd5e024cba215ddbe433658e2d19e611eab33e2c9 (patch)
treed2ecac9cb0a32c54ce3fd0d198f579e4785b6acd /tests/zfs-tests/include
parent1cfdb0e6e401087778712fa893777b064a8afb6b (diff)
Emit history events for 'zpool create'
History commands and events were being suppressed for the 'zpool create' command since the history object did not yet exist. Create the object earlier so this history doesn't get lost. Split the pool_destroy event in to pool_destroy and pool_export so they may be distinguished. Updated events_001_pos and events_002_pos test cases. They now check for the expected history events and were reworked to be more reliable. Reviewed-by: Nathaniel Clark <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #6712 Closes #6486
Diffstat (limited to 'tests/zfs-tests/include')
-rw-r--r--tests/zfs-tests/include/default.cfg.in4
-rw-r--r--tests/zfs-tests/include/libtest.shlib21
2 files changed, 16 insertions, 9 deletions
diff --git a/tests/zfs-tests/include/default.cfg.in b/tests/zfs-tests/include/default.cfg.in
index 7b2ef4d30..90d1d8bd6 100644
--- a/tests/zfs-tests/include/default.cfg.in
+++ b/tests/zfs-tests/include/default.cfg.in
@@ -179,6 +179,8 @@ if is_linux; then
DEV_MPATHDIR="/dev/mapper"
ZEDLET_DIR="/var/tmp/zed"
+ ZED_LOG="$ZEDLET_DIR/zed.log"
+ ZED_DEBUG_LOG="$ZEDLET_DIR/zed.debug.log"
VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf"
VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf"
@@ -200,4 +202,4 @@ else
fi
export unpack_opts pack_opts verbose unpack_preserve pack_preserve \
ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_RDSKDIR DEV_MPATHDIR \
- ZEDLET_DIR VDEVID_CONF VDEVID_CONF_ETC
+ ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index 14348d7c6..eef678455 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -3361,11 +3361,14 @@ function zed_setup
# Customize the zed.rc file to enable the full debug log.
log_must sed -i '/\#ZED_DEBUG_LOG=.*/d' $ZEDLET_DIR/zed.rc
- echo "ZED_DEBUG_LOG=$ZEDLET_DIR/zed.debug.log" >>$ZEDLET_DIR/zed.rc
+ echo "ZED_DEBUG_LOG=$ZED_DEBUG_LOG" >>$ZEDLET_DIR/zed.rc
+ # Scripts must only be user writable.
+ saved_umask=$(umask)
+ log_must umask 0022
log_must cp ${ZEDLET_LIBEXEC_DIR}/all-syslog.sh $ZEDLET_DIR
log_must cp ${ZEDLET_LIBEXEC_DIR}/all-debug.sh $ZEDLET_DIR
- log_must touch $ZEDLET_DIR/zed.debug.log
+ log_must umask $saved_umask
}
#
@@ -3381,10 +3384,9 @@ function zed_cleanup
log_must rm -f ${ZEDLET_DIR}/zed-functions.sh
log_must rm -f ${ZEDLET_DIR}/all-syslog.sh
log_must rm -f ${ZEDLET_DIR}/all-debug.sh
- log_must rm -f ${ZEDLET_DIR}/zed.pid
- log_must rm -f ${ZEDLET_DIR}/zedlog
- log_must rm -f ${ZEDLET_DIR}/zed.debug.log
log_must rm -f ${ZEDLET_DIR}/state
+ log_must rm -f $ZED_LOG
+ log_must rm -f $ZED_DEBUG_LOG
log_must rm -f $VDEVID_CONF_ETC
log_must rm -f $VDEVID_CONF
rmdir $ZEDLET_DIR
@@ -3412,9 +3414,10 @@ function zed_start
log_note "Starting ZED"
# run ZED in the background and redirect foreground logging
- # output to zedlog
+ # output to $ZED_LOG.
+ log_must truncate -s 0 $ZED_DEBUG_LOG
log_must eval "zed -vF -d $ZEDLET_DIR -p $ZEDLET_DIR/zed.pid" \
- "-s $ZEDLET_DIR/state 2>${ZEDLET_DIR}/zedlog &"
+ "-s $ZEDLET_DIR/state 2>$ZED_LOG &"
return 0
}
@@ -3431,7 +3434,9 @@ function zed_stop
log_note "Stopping ZED"
if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then
zedpid=$(cat ${ZEDLET_DIR}/zed.pid)
- log_must kill $zedpid
+ kill $zedpid
+ wait $zedpid
+ rm -f ${ZEDLET_DIR}/zed.pid
fi
return 0