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 # ident "@(#)kill_mountd.ksh    1.6     08/06/12 SMI"
  28 #
  29 
  30 #
  31 # oneoffs test cases
  32 #
  33 
  34 tet_startup="startup"
  35 tet_cleanup="cleanup"
  36 
  37 iclist="ic1"
  38 ic1="kill_mountd"
  39 
  40 #__stc_assertion_start
  41 #
  42 #ID: oneoff001
  43 #
  44 #DESCRIPTION:
  45 #
  46 #       If mountd is killed sharemgr gets in a bad state for
  47 #       certain commands.
  48 #
  49 #STRATEGY:
  50 #
  51 #       Setup:
  52 #               - Create share groups and shares.
  53 #       Test:
  54 #               - Kill mountd and make sure sharemgr can still do 
  55 #                 the following commands succesfully :
  56 #                       create
  57 #                       add-share
  58 #                       list
  59 #                       show
  60 #                       remove-share
  61 #                       delete
  62 #
  63 #       Cleanup:
  64 #               - Make sure to restart mounted
  65 #
  66 #       STRATEGY_NOTES:
  67 #
  68 #KEYWORDS:
  69 #
  70 #       kill mountd
  71 #
  72 #TESTABILITY: explicit
  73 #
  74 #AUTHOR: sean.wilcox@sun.com
  75 #
  76 #REVIEWERS: TBD
  77 #
  78 #TEST_AUTOMATION_LEVEL: automated
  79 #
  80 #CODING_STATUS: COMPLETE
  81 #
  82 #__stc_assertion_end
  83 function kill_mountd {
  84         tet_result PASS
  85         tc_id="kill_mountd"
  86         tc_desc="Kill mountd causes sharemgr problems"
  87         cmd_list=""
  88         unset GROUPS
  89         print_test_case $tc_id - $tc_desc
  90         #
  91         # Setup
  92         #
  93         create test_group_1
  94         add_share POS test_group_1 "" ${MP[0]}
  95         tet_infoline " - svcadm disable network/nfs/server"
  96         svcadm disable network/nfs/server
  97 
  98         remove_share POS test_group_1 "" ${MP[0]}
  99         create test_group_2
 100         add_share POS test_group_2 "" ${MP[1]}
 101         list POS
 102         show POS
 103         remove_share POS test_group_2 "" ${MP[1]}
 104         delete test_group_2
 105 
 106         #
 107         # Cleanup
 108         #
 109         delete_all_test_groups
 110         #
 111         # Restart mountd
 112         #
 113         tet_infoline " - svcadm enable network/nfs/server"
 114         svcadm enable network/nfs/server
 115         report_cmds $tc_id POS
 116 }
 117 
 118 function startup
 119 {
 120         tet_infoline "Checking environment and runability"
 121         share_startup
 122 }
 123 
 124 function cleanup
 125 {
 126         tet_infoline "Cleaning up after tests"
 127         share_cleanup
 128 }
 129 
 130 . ${TET_SUITE_ROOT}/sharefs-tests/lib/share_common
 131 
 132 . ${TET_ROOT}/common/lib/ctiutils.ksh
 133 . ${TET_ROOT}/lib/ksh/tcm.ksh