]> git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_status/zpool_status_003_pos.ksh
Prebaked scripts for zpool status/iostat -c
[mirror_zfs.git] / tests / zfs-tests / tests / functional / cli_root / zpool_status / zpool_status_003_pos.ksh
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 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
47 verify_runnable "both"
48
49 typeset testpool
50 if is_global_zone ; then
51 testpool="$TESTPOOL"
52 else
53 testpool="${TESTPOOL%%/*}"
54 fi
55
56 files="$(ls $ZPOOLSCRIPTDIR)"
57 scripts=""
58 for i in $files ; do
59 if [ ! -x "$ZPOOLSCRIPTDIR/$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"
69 done
70
71 # Test that we can run multiple scripts separated with a commma by running
72 # all the scripts in a single -c line.
73 allscripts="$(echo $scripts | sed -r 's/[[:blank:]]+/,/g')"
74 test_zpool_script "$allscripts" "$testpool" "zpool status -P -c"
75
76 exit 0