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 2006 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # NFSv4 LINK operation test - negative tests
  27 #       test server to return MLINK error when links to a file
  28 #       is more than numlinks.
  29 # NOTE: this test takes long time to run, ~1 hour to complete
  30 #       due to the time in setup/cleanup maxlinks.
  31 
  32 # include all test enironment
  33 source LINK.env
  34 
  35 # connect to the test server
  36 Connect
  37 
  38 # setting local variables
  39 set TNAME $argv0
  40 set bfh [get_fh "$BASEDIRS"]
  41 set ffh [get_fh "$BASEDIRS $env(TEXTFILE)"]
  42 
  43 
  44 # Start testing
  45 # --------------------------------------------------------------
  46 # a: try Link when obj has maxlinks, expect MLINK
  47 #    This test may take a while to run as it will try to maxlink an object
  48 set expcode "MLINK"
  49 set ASSERTION "try Link when obj has maxlinks, expect $expcode"
  50 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
  51 # create a tmp dir for links 
  52 set tmpd "tmp.[pid]"
  53 set res [compound {Putfh $bfh; Create $tmpd {{mode 0711}} d; Getfh}]
  54 set tdfh [lindex [lindex $res 2] 2]
  55 set maxl [set_maxlink $ffh $tdfh]
  56 set res [compound {Putfh $ffh; Getattr numlinks; Savefh;
  57         Putfh $bfh; Link "mlinkh"}]
  58 set cont [ckres "Link" $status $expcode $res $FAIL]
  59 set lcnt1 [lindex [lindex [lindex [lindex $res 1] 2] 0] 1]
  60 linkcnt_equal $lcnt1 $ffh $cont $PASS
  61 set cont [cleanup_links $maxl $tdfh $cont]
  62 
  63 
  64 # --------------------------------------------------------------
  65 # disconnect and exit
  66 Disconnect
  67 exit $PASS