|
| 1 | +#!/bin/ksh -p |
| 2 | +# SPDX-License-Identifier: CDDL-1.0 |
| 3 | +# |
| 4 | +# CDDL HEADER START |
| 5 | +# |
| 6 | +# The contents of this file are subject to the terms of the |
| 7 | +# Common Development and Distribution License (the "License"). |
| 8 | +# You may not use this file except in compliance with the License. |
| 9 | +# |
| 10 | +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
| 11 | +# or https://opensource.org/licenses/CDDL-1.0. |
| 12 | +# See the License for the specific language governing permissions |
| 13 | +# and limitations under the License. |
| 14 | +# |
| 15 | +# When distributing Covered Code, include this CDDL HEADER in each |
| 16 | +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
| 17 | +# If applicable, add the following below this CDDL HEADER, with the |
| 18 | +# fields enclosed by brackets "[]" replaced with your own identifying |
| 19 | +# information: Portions Copyright [yyyy] [name of copyright owner] |
| 20 | +# |
| 21 | +# CDDL HEADER END |
| 22 | +# |
| 23 | + |
| 24 | +# Copyright (c) 2025, Klara Inc. |
| 25 | +# |
| 26 | +# This software was developed by |
| 27 | +# Mariusz Zaborski <[email protected]> |
| 28 | +# under sponsorship from Wasabi Technology, Inc. and Klara Inc. |
| 29 | + |
| 30 | +. $STF_SUITE/include/libtest.shlib |
| 31 | +. $STF_SUITE/tests/functional/cli_root/zpool_events/zpool_events.kshlib |
| 32 | + |
| 33 | +# |
| 34 | +# DESCRIPTION: |
| 35 | +# Verify that using “zpool scrub -C” correctly generates events. |
| 36 | +# |
| 37 | +# STRATEGY: |
| 38 | +# 1. Run an initial “zpool scrub” on the test pool to generate a txg. |
| 39 | +# 2. Clear existing pool events. |
| 40 | +# 3. Run “zpool scrub -C” to scrub from the last txg. |
| 41 | +# 4. Capture the event log and confirm it contains both “scrub_start” and |
| 42 | +# “scrub_finish” entries. |
| 43 | +# |
| 44 | + |
| 45 | +verify_runnable "global" |
| 46 | + |
| 47 | +function cleanup |
| 48 | +{ |
| 49 | + rm -f $EVENTS_FILE |
| 50 | +} |
| 51 | + |
| 52 | +EVENTS_FILE="$TESTDIR/zpool_events.$$" |
| 53 | +log_onexit cleanup |
| 54 | + |
| 55 | +log_assert "Verify scrub -C events." |
| 56 | + |
| 57 | +# Run an initial “zpool scrub” |
| 58 | +log_must zpool scrub -w $TESTPOOL |
| 59 | + |
| 60 | +# Clear existing pool events. |
| 61 | +log_must zpool events -c |
| 62 | + |
| 63 | +# Generate new scrub events. |
| 64 | +log_must zpool scrub -Cw $TESTPOOL |
| 65 | + |
| 66 | +# Verify events. |
| 67 | +log_must eval "zpool events -H > $EVENTS_FILE" |
| 68 | +log_must grep "scrub_start" $EVENTS_FILE |
| 69 | +log_must grep "scrub_finish" $EVENTS_FILE |
| 70 | + |
| 71 | +log_pass "Verified scrub -C generate correct events." |
0 commit comments