The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/tests/zfs-tests/include/zpool_script.shlib

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #
    2 # Common functions used by the zpool_status and zpool_iostat tests for running
    3 # scripts with the -c option.
    4 #
    5 # Copyright (c) 2017 Lawrence Livermore National Security, LLC.
    6 #
    7 
    8 . $STF_SUITE/include/libtest.shlib
    9 
   10 function test_zpool_script {
   11         script="$1"
   12         testpool="$2"
   13         cmd="$3"
   14         wholecmd="$cmd $script $testpool"
   15         out="$($wholecmd)"
   16 
   17         # Default number of columns that get printed without -c
   18         if [ "$cmd" != "${cmd/iostat/_/}" ]; then
   19                 # iostat
   20                 dcols=7
   21         else
   22                 
   23                 # status
   24                 dcols=5
   25         fi
   26                 
   27         # Get the new column name that the script created
   28         col="$(echo "$out" | \
   29             awk '/^pool +alloc +free +read +write +/ {print $8} \
   30             /NAME +STATE +READ +WRITE +CKSUM/ {print $6}')"
   31 
   32         if [ -z "$col" ] ; then
   33                 log_fail "'$wholecmd' created no new columns"
   34         fi
   35 
   36         # Count the number of columns for each vdev.  Each script should produce
   37         # at least one new column value.  Even if scripts return blank, zpool
   38         # will convert the blank to a '-' to make things awk-able.  Normal
   39         # zpool iostat -v output is 7 columns, so if the script ran correctly
   40         # we should see more than that.
   41         if ! newcols=$(echo "$out" | \
   42                 awk '/\/dev/ {print NF-'$dcols'; if (NF <= '$dcols') {exit 1}}' | \
   43                 head -n 1)
   44   then
   45                 log_fail "'$wholecmd' didn't create a new column value"
   46         else
   47                 log_note "'$wholecmd' passed ($newcols new columns)"
   48         fi
   49 }

Cache object: 97b4df362a490c16d47c77cbe6a70516


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.