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: svccfg_delprop_006
  32 #
  33 # DESCRIPTION:
  34 #       If no entity is selected then the 'delprop' subcommand will
  35 #       return a diagnostic message and a return value of 1.
  36 #
  37 # end __stf_assertion__
  38 ###############################################################################
  39 
  40 
  41 # First STF library
  42 . ${STF_TOOLS}/include/stf.kshlib
  43 
  44 # Load GL library
  45 . ${STF_SUITE}/include/gltest.kshlib
  46 
  47 
  48 readonly ME=$(whence -p ${0})
  49 readonly MYLOC=$(dirname ${ME})
  50 
  51 # Initialize test result 
  52 typeset -i RESULT=$STF_PASS
  53 
  54 
  55 function cleanup {
  56         
  57         rm -f $OUTFILE $ERRFILE $CMDFILE
  58 
  59         exit $RESULT
  60 }
  61 
  62 trap cleanup 0 1 2 15
  63 
  64 # make sure that the environment is sane - svc.configd is up and running
  65 check_gl_env
  66 [[ $? -ne 0 ]] && {
  67         echo "--DIAG: 
  68         Invalid test environment - svc.configd not available"
  69 
  70         RESULT=$STF_UNRESOLVED 
  71         exit $RESULT
  72 }
  73 
  74 # extract and print assertion information from this source script.
  75 extract_assertion_info $ME
  76 
  77 assertion=svccfg_delprop_006
  78 
  79 
  80 svccfg delprop $TEST_PROPERTY > $OUTFILE 2>$ERRFILE
  81 ret=$?
  82 
  83 # Verify that the return value is as expected - non-fatal error
  84 [[ $ret -ne 1 ]] &&  {
  85         echo "--DIAG: [${assertion}]
  86         svccfg delprop expected to return 1, got $ret"
  87 
  88         RESULT=$STF_FAIL
  89 }
  90 
  91 # Verify that nothing in stdout - non-fatal error
  92 [[ -s $OUTFILE ]] &&  {
  93         echo "--DIAG: [${assertion}]
  94         stdout not expected, but got $(cat $OUTFILE)"
  95 
  96         RESULT=$STF_FAIL
  97 }
  98 
  99 
 100 # Verify that message in stderr - non-fatal error
 101 if ! egrep -s "$NOT_SELECTED_ERRMSG" $ERRFILE
 102 then
 103         echo "--DIAG: [${assertion}]
 104         Expected error message \"$NOT_SELECTED_ERRMSG\"
 105         but got \"$(cat $ERRFILE)\""
 106 
 107         RESULT=$STF_FAIL
 108 fi
 109 
 110 rm -f $ERRFILE $OUTFILE $CMDFILE
 111 
 112 print_result $RESULT
 113 
 114 exit $RESULT