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 https://opensource.org/licenses/CDDL-1.0.
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 pools can be upgraded to known feature sets.
33#
34# STRATEGY:
35#	1. Create a pool with a known feature set.
36#	2. Verify only those features are active/enabled.
37#	3. Upgrade the pool to a newer feature set.
38#	4. Verify only those features are active/enabled.
39#
40
41verify_runnable "global"
42
43function cleanup
44{
45	datasetexists $TESTPOOL1 && log_must zpool destroy $TESTPOOL1
46	rm -f $FILEDEV
47}
48
49FILEDEV="$TEST_BASE_DIR/filedev.$$"
50
51log_onexit cleanup
52
53log_assert "verify pools can be upgraded to known feature sets."
54
55log_must truncate -s $MINVDEVSIZE $FILEDEV
56log_must zpool create -f -o compatibility=compat-2018 $TESTPOOL1 $FILEDEV
57check_feature_set $TESTPOOL1 compat-2018
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_must zpool upgrade $TESTPOOL1
64check_feature_set $TESTPOOL1 compat-2020
65log_mustnot check_pool_status $TESTPOOL1 "status" "features are not enabled"
66
67log_pass "verify pools can be upgraded to known feature sets."
68