1#!/bin/ksh -p
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License (the "License").
7# You may not use this file except in compliance with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22
23#
24# Copyright (c) 2021 Lawrence Livermore National Security, LLC.
25#
26
27. $STF_SUITE/include/libtest.shlib
28. $STF_SUITE/tests/functional/cli_root/zpool_create/zpool_create.shlib
29
30#
31# DESCRIPTION:
32#	Verify zpool status only recommends upgrading the pool when
33#	the enabled features don't match those in the feature set.
34#
35# STRATEGY:
36#	1. Create a pool with a known feature set.
37#	2. Verify there is no `zpool status` notice to upgrade the pool.
38#	3. Set the pool compatibility to a newer feature set.
39#	4. Verify there is a `zpool status` notice to upgrade the pool.
40#
41
42verify_runnable "global"
43
44function cleanup
45{
46	datasetexists $TESTPOOL1 && log_must zpool destroy $TESTPOOL1
47	rm -f $FILEDEV
48}
49
50FILEDEV="$TEST_BASE_DIR/filedev.$$"
51
52log_onexit cleanup
53
54log_assert "check 'zpool status' upgrade notice"
55
56log_must truncate -s $MINVDEVSIZE $FILEDEV
57log_must zpool create -f -o compatibility=compat-2018 $TESTPOOL1 $FILEDEV
58log_mustnot check_pool_status $TESTPOOL1 "status" "features are not enabled"
59
60log_must zpool set compatibility=compat-2020 $TESTPOOL1
61log_must check_pool_status $TESTPOOL1 "status" "features are not enabled"
62
63log_pass "check 'zpool status' upgrade notice"
64