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) 2022, Klara Inc.
25#
26
27. $STF_SUITE/include/libtest.shlib
28. $STF_SUITE/tests/functional/cli_root/zpool_get/vdev_get.cfg
29
30#
31# DESCRIPTION:
32#
33# zpool get <pool> root works as expected
34#
35# STRATEGY:
36#
37# 1. use zpool get to retrieve properties from root vdev
38# 2. verify expected properties match detected properties
39#
40
41log_assert "zpool get all on root vdev"
42
43EXPECT="$(zpool get -H all ${TESTPOOL} root | wc -l)"
44if [ $? -ne 0 ]; then
45    log_fail "cannot retrieve properties from root vdev"
46fi
47
48i=0;
49while [ $i -lt "${#properties[@]}" ]
50do
51	log_must zpool get -H "${properties[$i]}" "$TESTPOOL" root
52	i=$(($i+1))
53done
54
55EXPECT=$((EXPECT))
56if [ $i -gt $EXPECT ]; then
57	log_fail "found vdev properties not in vdev_get.cfg: $i/$EXPECT."
58elif [ $i -lt $EXPECT ]; then
59    log_fail "expected properties not found in vdev_get.cfg: $i/$EXPECT."
60fi
61
62log_pass "zpool get all on root vdev"
63