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 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27 28# 29# Copyright (c) 2013 by Delphix. All rights reserved. 30# 31 32# 33# Copyright (c) 2016-2017 by Lawrence Livermore National Security, LLC. 34# 35 36# DESCRIPTION: 37# Verify zpool status command mode (-c) works for all pre-baked scripts. 38# 39# STRATEGY: 40# 1. Make sure each script creates at least one new column. 41# 2. Make sure the new column values exist. 42# 3. Make sure we can run multiple scripts in one -c line 43 44. $STF_SUITE/include/libtest.shlib 45. $STF_SUITE/include/zpool_script.shlib 46 47verify_runnable "both" 48 49typeset testpool 50if is_global_zone ; then 51 testpool="$TESTPOOL" 52else 53 testpool="${TESTPOOL%%/*}" 54fi 55 56files="$(ls $ZPOOL_SCRIPT_DIR)" 57scripts="" 58for i in $files ; do 59 if [ ! -x "$ZPOOL_SCRIPT_DIR/$i" ] ; then 60 # Skip non-executables 61 continue 62 fi 63 64 # Collect executable script names 65 scripts="$scripts $i" 66 67 # Run each one with -c 68 test_zpool_script "$i" "$testpool" "zpool status -P -c" 69done 70 71# Test that we can run multiple scripts separated with a comma by running 72# all the scripts in a single -c line. 73allscripts="$(echo $scripts | sed -r 's/[[:blank:]]+/,/g')" 74test_zpool_script "$allscripts" "$testpool" "zpool status -P -c" 75 76exit 0 77