3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2017, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
17 . $STF_SUITE/include/libtest.shlib
18 . $STF_SUITE/tests/functional/cli_root/zpool_events/zpool_events.kshlib
22 # 'zpool events poolname' should only display events from the chosen pool.
25 # 1. Create an additional pool
26 # 2. Clear all ZFS events
27 # 3. Generate some ZFS events on both pools
28 # 4. Verify 'zpool events poolname' successfully display events
31 verify_runnable "both"
39 log_assert "'zpool events poolname' should only display events from poolname."
43 DISK="$TEST_BASE_DIR/$NEWPOOL.dat"
45 # 1. Create an additional pool
46 log_must truncate -s $MINVDEVSIZE $DISK
47 log_must zpool create $NEWPOOL $DISK
49 # 2. Clear all ZFS events
50 log_must zpool events -c
52 # 3. Generate some ZFS events on both pools
53 for i in `seq 1 $EVENTS_NUM`; do
54 log_must zpool clear $TESTPOOL
56 for i in `seq 1 $EVENTS_NUM`; do
57 log_must zpool clear $NEWPOOL
59 # wait a bit to allow the kernel module to process new events
62 # 4. Verify 'zpool events poolname' successfully display events
63 zpool events -v $TESTPOOL |
64 awk -v POOL=$TESTPOOL '/pool = / {if ($3 != "\""POOL"\"") exit 1}'
65 if [[ $? -ne 0 ]]; then
66 log_fail "Unexpected events for pools other than $TESTPOOL"
68 zpool events -v $NEWPOOL |
69 awk -v POOL=$NEWPOOL '/pool = / {if ($3 != "\""POOL"\"") exit 1}'
70 if [[ $? -ne 0 ]]; then
71 log_fail "Unexpected events for pools other than $NEWPOOL"
74 log_pass "'zpool events poolname' display events only from the chosen pool."