1 #! /usr/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 2008 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 
  28 ###############################################################################
  29 # start __stf_assertion__
  30 #
  31 # ASSERTION: svcadm_refresh_006
  32 #
  33 # DESCRIPTION:
  34 #       svcadm refresh <without any arguments> should fail with exit 2.
  35 #       svcadm -v refresh <without any arguments> should fail with exit 2.
  36 # STRATEGY:
  37 #
  38 # COMMANDS: svcadm(1)
  39 #
  40 # end __stf_assertion__
  41 ################################################################################
  42 
  43 # First load up definitions of STF result variables like STF_PASS etc.
  44 . ${STF_TOOLS}/include/stf.kshlib
  45 
  46 # Load up definitions of shell functionality common to all smf sub-suites.
  47 . ${STF_SUITE}/include/gltest.kshlib
  48 
  49 # Define Variables
  50 readonly assertion=svcadm_refresh_006
  51 readonly ME=$(whence -p ${0})
  52 readonly MYLOC=$(dirname ${ME})
  53 
  54 # Extract and print assertion from this source script.
  55 extract_assertion_info $ME
  56 
  57 # Initialize test result to pass.
  58 typeset -i RESULT=${STF_UNRESOLVED}
  59 
  60 # Exit code for individual commands.
  61 typeset -i tmp_rc=0
  62 
  63 # Make sure we run as root
  64 if ! /usr/bin/id | grep "uid=0(root)" > /dev/null 2>&1
  65 then
  66         echo "--DIAG: [$assertion]
  67         This test must be run from root."
  68         print_result $RESULT
  69         exit $RESULT
  70 fi
  71 
  72 
  73 # Execute environmental sanity checks.
  74 check_gl_env
  75 tmp_rc=$?
  76 if [[ $tmp_rc -ne 0 ]]
  77 then
  78         echo "--DIAG: [$assertion]
  79         Invalid smf environment, quitting."
  80         print_result $RESULT
  81         exit $RESULT
  82 fi
  83 
  84 echo "--INFO: [${assertion}]
  85         Call svcadm refresh <no arguments>"
  86 
  87 svcadm refresh >/dev/null 2>&1
  88 ret=$?
  89 if [ $ret -ne 2 ]; then
  90         RESULT=$(update_result $STF_FAIL $RESULT)
  91         echo "--DIAG: [$assertion]
  92         EXPECTED: svcadm refresh <no arguments> should exit 2
  93         OBSERVED: svcadm refresh <no arguments> exited with $ret"
  94         print_result $RESULT
  95         exit $RESULT
  96 fi
  97 
  98 echo "--INFO: [${assertion}]
  99         Call svcadm -v refresh <no arguments>"
 100 
 101 svcadm -v refresh >/dev/null 2>&1
 102 ret=$?
 103 if [ $ret -ne 2 ]; then
 104         RESULT=$(update_result $STF_FAIL $RESULT)
 105         echo "--DIAG: [$assertion]
 106         EXPECTED: svcadm -v refresh <no arguments> should exit 2
 107         OBSERVED: svcadm -v refresh <no arguments> exited with $ret"
 108         print_result $RESULT
 109         exit $RESULT
 110 fi
 111 
 112 RESULT=$STF_PASS
 113 print_result $RESULT
 114 exit $RESULT
 115 
 116 #
 117 ### END
 118 #