1 #!/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 "@(#)tc_fs_dynamic.ksh  1.2     08/12/19 SMI"
  28 #
  29 
  30 . ${TET_SUITE_ROOT}/lofi-tests/lib/startup_cleanup_common
  31 
  32 tet_startup=startup
  33 tet_cleanup=cleanup
  34 
  35 reference_tree=$SCRATCH_DIR/$$_ref_tree
  36 
  37 function startup {
  38         cti_report "In startup"
  39 
  40         typical_startup_checks
  41         if (( $? != 0 )); then
  42                 exit 1
  43         fi
  44 
  45         cti_report "Building 'reference tree' $reference_tree"
  46         build_reference_tree $reference_tree
  47         if (( $? != 0 )); then
  48                 exit 1
  49         fi
  50 }
  51 
  52 
  53 function cleanup {
  54         cti_report "In cleanup"
  55         if [[ -d $reference_tree ]]; then
  56                 cti_report "Deleting 'reference tree' $reference_tree"
  57                 cti_execute "FAIL" "$RM -rf $reference_tree"
  58                 if (( $? != 0 )); then
  59                         exit 1
  60                 fi
  61         fi
  62 
  63         # cleanup /dev/lofi to prepare for the next test
  64         if [ -d /dev/lofi ]; then
  65                 rm -rf /dev/lofi
  66         fi
  67 }
  68 
  69 # Build the dynamic configuration files for tp_fs_dynamic
  70 dynamic_config_file="$CTI_LOGDIR/tc_lofi_compress_create.cfg"
  71 cat /dev/null > $dynamic_config_file
  72 
  73 # This is the full list.
  74 file_size_pos_params="65m 100m 1g"
  75 filesystem_pos_params="zfs ufs hsfs"
  76 
  77 first_file_size_pos_param=`echo $file_size_pos_params | awk ' { print $1 } ' `
  78 
  79 # This value keeps track of the number of dynamic fs tests that
  80 # will be created.
  81 ic_num=1
  82 num_comp_tests=0
  83 
  84 # This blocks builds the set of all possible combinations of all positive
  85 # test case parameters for dynamic fs tests.
  86 typeset skip_arg
  87 for file_size_pos_param in $file_size_pos_params
  88 do
  89         #
  90         # Any tests involving large (1g) file sizes should be skipped
  91         # if the run mode is 'short'
  92         #
  93         if [[ "$RUNMODE" = "short" && "$file_size_pos_param" = "1g" ]]; then
  94                 skip_arg="skip=$RUNMODE"
  95         else
  96                 skip_arg=""
  97         fi
  98 
  99         for filesystem_pos_param in $filesystem_pos_params
 100         do
 101                 echo "pos $file_size_pos_param" \
 102                     "$file_type_pos_param" \
 103                     "$filesystem_pos_param $skip_arg" >>\
 104                     $dynamic_config_file
 105                 ((ic_num = $ic_num + 1))
 106 
 107         done
 108 done
 109 
 110 # Build the 'icN' and 'iclist' variables to add to the iclist.
 111 iclist=""
 112 counter=1
 113 while (( $counter < $ic_num )); do
 114         eval ic$counter=\"tp_fs_dynamic\"
 115         eval iclist=\"$iclist ic$counter\"
 116         ((counter = $counter + 1))
 117 done
 118 
 119 . ./tp_fs_dynamic       # Contains dyamic fs test purpose
 120 
 121 . ${TET_ROOT:?}/common/lib/ctiutils.ksh
 122 . ${TET_ROOT}/lib/ksh/tcm.ksh
 123 . ${TET_SUITE_ROOT}/src/lib/ksh/fs_common.ksh