Print this page
4620 Add OmniOS as a runnable usr/src/test distro
   1 #!/usr/bin/ksh
   2 
   3 #
   4 # This file and its contents are supplied under the terms of the
   5 # Common Development and Distribution License ("CDDL"), version 1.0.
   6 # You may only use this file in accordance with the terms of version
   7 # 1.0 of the CDDL.
   8 #
   9 # A full copy of the text of the CDDL should have accompanied this
  10 # source.  A copy of the CDDL is also available via the Internet at
  11 # http://www.illumos.org/license/CDDL.
  12 #
  13 
  14 #
  15 # Copyright (c) 2012 by Delphix. All rights reserved.

  16 #
  17 
  18 export STF_SUITE="/opt/zfs-tests"
  19 export STF_TOOLS="/opt/test-runner/stf"
  20 runner="/opt/test-runner/bin/run"
  21 auto_detect=false
  22 
  23 function fail
  24 {
  25         echo $1
  26         exit ${2:-1}
  27 }
  28 
  29 function find_disks
  30 {
  31         typeset all_disks=$(echo '' | sudo /usr/sbin/format | awk \
  32             '/c[0-9]/ {print $2}')
  33         typeset used_disks=$(/sbin/zpool status | awk \
  34             '/c[0-9]*t[0-9a-f]*d[0-9]/ {print $1}' | sed 's/s[0-9]//g')
  35 


  41                 [[ -n $avail_disks ]] && avail_disks="$avail_disks $disk"
  42                 [[ -z $avail_disks ]] && avail_disks="$disk"
  43         done
  44 
  45         echo $avail_disks
  46 }
  47 
  48 function find_rpool
  49 {
  50         typeset ds=$(/usr/sbin/mount | awk '/^\/ / {print $3}')
  51         echo ${ds%%/*}
  52 }
  53 
  54 function find_runfile
  55 {
  56         typeset distro=
  57         if [[ -d /opt/delphix && -h /etc/delphix/version ]]; then
  58                 distro=delphix
  59         elif [[ 0 -ne $(grep -c OpenIndiana /etc/release 2>/dev/null) ]]; then
  60                 distro=openindiana


  61         fi
  62 
  63         [[ -n $distro ]] && echo $STF_SUITE/runfiles/$distro.run
  64 }
  65 
  66 function verify_id
  67 {
  68         [[ $(id -u) = "0" ]] && fail "This script must not be run as root."
  69 
  70         sudo -n id >/dev/null 2>&1
  71         [[ $? -eq 0 ]] || fail "User must be able to sudo without a password."
  72 
  73         typeset -i priv_cnt=$(ppriv $$ | egrep -v \
  74             ": basic$|  L:| <none>|$$:" | wc -l)
  75         [[ $priv_cnt -ne 0 ]] && fail "User must only have basic privileges."
  76 }
  77 
  78 function verify_disks
  79 {
  80         typeset disk


   1 #!/usr/bin/ksh
   2 
   3 #
   4 # This file and its contents are supplied under the terms of the
   5 # Common Development and Distribution License ("CDDL"), version 1.0.
   6 # You may only use this file in accordance with the terms of version
   7 # 1.0 of the CDDL.
   8 #
   9 # A full copy of the text of the CDDL should have accompanied this
  10 # source.  A copy of the CDDL is also available via the Internet at
  11 # http://www.illumos.org/license/CDDL.
  12 #
  13 
  14 #
  15 # Copyright (c) 2012 by Delphix. All rights reserved.
  16 # Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved.
  17 #
  18 
  19 export STF_SUITE="/opt/zfs-tests"
  20 export STF_TOOLS="/opt/test-runner/stf"
  21 runner="/opt/test-runner/bin/run"
  22 auto_detect=false
  23 
  24 function fail
  25 {
  26         echo $1
  27         exit ${2:-1}
  28 }
  29 
  30 function find_disks
  31 {
  32         typeset all_disks=$(echo '' | sudo /usr/sbin/format | awk \
  33             '/c[0-9]/ {print $2}')
  34         typeset used_disks=$(/sbin/zpool status | awk \
  35             '/c[0-9]*t[0-9a-f]*d[0-9]/ {print $1}' | sed 's/s[0-9]//g')
  36 


  42                 [[ -n $avail_disks ]] && avail_disks="$avail_disks $disk"
  43                 [[ -z $avail_disks ]] && avail_disks="$disk"
  44         done
  45 
  46         echo $avail_disks
  47 }
  48 
  49 function find_rpool
  50 {
  51         typeset ds=$(/usr/sbin/mount | awk '/^\/ / {print $3}')
  52         echo ${ds%%/*}
  53 }
  54 
  55 function find_runfile
  56 {
  57         typeset distro=
  58         if [[ -d /opt/delphix && -h /etc/delphix/version ]]; then
  59                 distro=delphix
  60         elif [[ 0 -ne $(grep -c OpenIndiana /etc/release 2>/dev/null) ]]; then
  61                 distro=openindiana
  62         elif [[ 0 -ne $(grep -c OmniOS /etc/release 2>/dev/null) ]]; then
  63                 distro=omnios
  64         fi
  65 
  66         [[ -n $distro ]] && echo $STF_SUITE/runfiles/$distro.run
  67 }
  68 
  69 function verify_id
  70 {
  71         [[ $(id -u) = "0" ]] && fail "This script must not be run as root."
  72 
  73         sudo -n id >/dev/null 2>&1
  74         [[ $? -eq 0 ]] || fail "User must be able to sudo without a password."
  75 
  76         typeset -i priv_cnt=$(ppriv $$ | egrep -v \
  77             ": basic$|  L:| <none>|$$:" | wc -l)
  78         [[ $priv_cnt -ne 0 ]] && fail "User must only have basic privileges."
  79 }
  80 
  81 function verify_disks
  82 {
  83         typeset disk