1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # ident "@(#)tp_create_002.ksh  1.3     08/06/11 SMI"
  27 #
  28 
  29 #
  30 # create-share test case
  31 #
  32 
  33 #__stc_assertion_start
  34 #
  35 #ID: create002
  36 #
  37 #DESCRIPTION:
  38 #
  39 #       Create a group and make sure that legacy shares that are 
  40 #       in existence are not removed.
  41 #
  42 #STRATEGY:
  43 #
  44 #       Setup:
  45 #               - create a share using legacy method (if it still
  46 #                 exists) if not this test will be skipped.
  47 #       Test:
  48 #               - create a test group 
  49 #               - verify the create succeeds.
  50 #               - verify the legacy share exists
  51 #       Cleanup:
  52 #               - Delete any groups created
  53 #               - Delete any shares created
  54 #               - Make sure to unshare the legacy share
  55 #
  56 #       STRATEGY_NOTES:
  57 #
  58 #KEYWORDS:
  59 #
  60 #       create legacy
  61 #
  62 #TESTABILITY: explicit
  63 #
  64 #AUTHOR: sean.wilcox@sun.com
  65 #
  66 #REVIEWERS: TBD
  67 #
  68 #TEST_AUTOMATION_LEVEL: automated
  69 #
  70 #CODING_STATUS: COMPLETE
  71 #
  72 #__stc_assertion_end
  73 function create002 {
  74         tet_result PASS
  75         tc_id="create002"
  76         tc_desc="Sharemgr should not kill old shares"
  77         cmd_list=""
  78         unset GROUPS
  79         print_test_case $tc_id - $tc_desc
  80         if [ ! "$LEGACYSHARE" ]
  81         then
  82                 tet_infoline "UNTESTED - Legacy share commands do not exist"
  83                 tet_result UNTESTED
  84                 return
  85         fi
  86 
  87         #
  88         # Share a path with the legacy command.
  89         #
  90         tet_infoline " - $LEGACYSHARE ${MP[0]}"
  91         $LEGACYSHARE ${MP[0]}
  92         sharecnt_before=`$LEGACYSHARE | wc -l`
  93         tet_infoline " $sharecnt_before shares found"
  94         #
  95         # Create a share group.  (Dry run then for real.)
  96         #
  97         create ${TG[0]} -n
  98         create ${TG[0]}
  99         #
 100         # Check the legacy share still exists
 101         #
 102         sharecnt_after=`$LEGACYSHARE | wc -l`
 103         tet_infoline " $sharecnt_after shares found"
 104         if [ $sharecnt_before -ne $sharecnt_after ]
 105         then
 106                 tet_infoline "FAIL - legacy share was lost"
 107                 tet_result FAIL
 108         else
 109                 if [ $verbose ]
 110                 then
 111                         tet_infoline "PASS - legacy share still shared"
 112                 fi
 113         fi
 114 
 115         #
 116         # Cleanup
 117         #
 118         tet_infoline " - $LEGACYUNSHARE ${MP[0]}"
 119         $LEGACYUNSHARE ${MP[0]} > /dev/null 2>&1
 120         delete_all_test_groups
 121         report_cmds $tc_id POS
 122 }