Home | History | Annotate | Download | only in nfsgen
      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 2009 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 # ident	"@(#)README	1.1	09/04/27 SMI"
     27 #
     28 
     29 DESCRIPTION
     30 ===========
     31 
     32    This test suite contains common tests for different NFS versions
     33    (i.e., nfsv4, future 4.1, etc).
     34    
     35   
     36 TEST STRUCTURE
     37 ==============
     38 
     39       ${STF_SUITE_ROOT}
     40 	  |- config.vars
     41 	  |- checkenv_def
     42           |- configure.ksh
     43 	  |- unconfigure.ksh
     44 	  |- krb5_config.ksh
     45           |- bin
     46           |- lib
     47 	  |- include
     48           +- setup
     49           |     +- nfsv4
     50           |     |     |- checkenv_def
     51           |     |     |- configure.ksh
     52           |     |     |- unconfigure.ksh
     53           |    ...
     54           |  
     55           +- tests
     56                 +- delegation
     57                 +- openlock
     58 		+- acl
     59 		+- file_ops
     60 		+- recovery
     61 		+- stress
     62    
     63    - programs used by tests are put into STF_TEST_SUITE/bin
     64    - c function libs are put into STF_TEST_SUITE/lib
     65    - ksh script libs are put into STF_TEST_SUITE/include
     66    - test cases are grouped into 6 directories so far, more will
     67      be added in the later phases as needed:
     68 	- delegation: test nfs delegation feature.
     69 	- openlock: test nfs open/lock state management.
     70 	- acl: test nfs acl. 
     71 	- file_ops: test file/dir operations via nfs
     72 	- recovery: test nfs recovery feature.
     73 	- stress: stress on open/read/write/lock ops.
     74 
     75    To make it easy to write and deploy multiple setups, files for a
     76    specific setup are placed under a dedicated subdir.
     77 
     78    User needs to set SETUP env variable to specify which configuration
     79    files to use. If SETUP=none, there will be no setup, nor any 
     80    configuration files. If SETUP=nfsv4, top-level configuration files 
     81    will redirect call from STF to corresponding files in setup/nfsv4.
     82    
     83    Top-level configuration files also perform some common tasks required
     84    by all setups.
     85    
     86    
     87 INSTALLATION
     88 ============
     89    
     90    You can install the suite package, or install the suite source and
     91    build by yourself.
     92    
     93    1. Installing from Packages
     94      
     95       o In the majority of cases, the test suite can be installed from
     96         packages. To do that, you need to be as root. The package is
     97         called SUNWstc-nfs-nfsgen and installs into "/opt" by default.
     98    
     99         Installation is via the standard Solaris package installation
    100         tool pkgadd(1M). To install SUNWstc-nfs-nfsgen simply enter the
    101         following command line:
    102      
    103            # pkgadd -d <package location>  SUNWstc-nfs-nfsgen
    104      
    105         Where <package location> refers to the path containing the
    106         SUNWstc-nfs-nfsgen package directory.
    107      
    108         It is recommended that you install the packages from scratch,
    109         rather than on top of an existing installation.  Thus, if an
    110         old version of the tests is installed:
    111     
    112            # pkgrm SUNWstc-nfs-nfsgen
    113    
    114       o It is also acceptable to use an nfs accessible version of the
    115         SUNWstc-nfs-nfsgen package.
    116      
    117    2. Installing the Test Suite Source
    118      
    119       You can install the suite source locally as any user.
    120      
    121     
    122 UNINSTALLATION
    123 ==============
    124    
    125    Prior to uninstalling the test suite, you may want to run
    126    stf_unconfigure firstly. For more detail see UNCONFIGURATION.
    127     
    128    1. Uninstalling the Test Suite Package
    129    
    130       Use the standard Solaris package installation tool pkgrm(1M) to
    131       uninstall the package as root:
    132     
    133          # pkgrm SUNWstc-nfs-nfsgen
    134     
    135    2. Uninstalling the Test Suite Source
    136      
    137       You can remove the corresponding directory.
    138      
    139     
    140 BUILDING
    141 ========
    142    
    143    If the suite is installed from packages, you can skip this section.
    144    If the suite source is installed locally, first you need to build
    145    it. This method uses the standard STF techniques to create a Solaris
    146    package, which will be installed under the base directory
    147    "/opt/SUNWstc-nfs-nfsgen".
    148     
    149    Briefly, this build and installation is performed as follows:
    150     
    151       # set path to STF bin directory
    152       $ PATH=<path-to-STF>/bin/`uname -p`:$PATH
    153       $ export PATH
    154     
    155       $ cd <WS_ROOT>/usr/src/suites/nfs/nfsgen
    156       $ stf_build package
    157       $ cd <WS_ROOT>/packages/`uname -p`
    158       $ sudo pkgadd -d <WS_ROOT>/packages/`uname -p`/SUNWstc-nfs-nfsgen
    159 
    160     where WS_ROOT represents the root of the workspace under
    161     which the nfsgen test suite source resides. 
    162 
    163 
    164 PREREQUISITES
    165 =============
    166    
    167    Below are the requirements common to all setups:
    168    
    169    1. You must have at least two machines. One is test client where
    170       you run those tests, another one is NFS server which is accessed
    171       remotely. Some tests(recovery, delegation) need three machines,
    172       you should set variable 'CLIENT2" as the second client's name.
    173    
    174    2. All systems under testing (including the local system) must
    175       enable r* service (i.e., run the command "netservices open")
    176       and be able to do rcp/rsh to each other as root; (i.e., add
    177       "local_host_name root" to ~/.rhosts on server, and comment out
    178       CONSOLE entry in /etc/default/login).
    179    
    180    3. The suite requires the "root" password to do setup. You can
    181       either run the suite as root, or enter the root password when
    182       it asks on command line when you do 'stf_configure' as a regular
    183       user.
    184    
    185    4. Make sure STF tools be in your PATH.
    186    
    187    5. You must set SETUP env variable to specify the setup on which
    188       you want to run your tests. Currently it can have two values:
    189    
    190          nfsv4  -   run tests on NFSV4.0 protocol
    191          none   -   run tests on the environment user set up manually.
    192 
    193       "none" setup is a special setup. In this setup, the test suite
    194       won't do any setup. That means user should set up a workable 
    195       environment manually before he runs tests, and set up env 
    196       variables needed by tests correctly. If you want to use this 
    197       mode, see more details in "MANUAL SETUP" section below.
    198       
    199    6. Except SETUP=none, SERVER env variable must be set to specify
    200       server machine.
    201    
    202    7. If you run tests on TX, you must specify ZONE_PATH env variable
    203       to specify the pathname to labeled zone root file system.
    204 
    205    8. If user set SHROPT to "sec=krb5" (or "sec=krb5i", "sec=krb5p")
    206       Then test will setup kerberos environment in all machine. 
    207       In that case, STC krb5tools are required. This test suite
    208       can use either a local installation of the SUNWstc-krb5tools
    209       package, or a remote, NFS-mounted location of the tools.
    210       KRB5TOOLS_HOME points to its root directory. Its default value is
    211       /opt/SUNWstc-krb5tools. To use krb5tools from elsewhere, 
    212       simply set KRB5TOOLS_HOME in your environment, or use the '-c' option,
    213       for example:
    214 
    215 	$ stf_configure -c \
    216 		"KRB5TOOLS_HOME=/ws/stcnv-gate/proto/tools/krb5tools"
    217 
    218       Krb5 tests also uses four other env variables: DNS_DOMAIN,
    219       SRV_DNS_DOMAIN, CLT2_DNS_DOMAIN, DNS_SERVER:
    220 
    221 	DNS_DOMAIN     - client dns domain. Default value is
    222 			 sfbay.sun.com.
    223 	SRV_DNS_DOMAIN  CLT2_DNS_DOMAIN 
    224 		       - server dns domain and client2 dns domain. 
    225 		         If users don't specify them, the values are
    226 			 got from the following resources:
    227 			   - /etc/resolv.conf
    228 			   - default as DNS_DOMAIN
    229 			 So user needs to set them if the machine has
    230 			 a different DNS domain than client.
    231 	DNS_SERVER     - a dns server that can resolve client
    232 			 and server's dns names.
    233 
    234       Notes: 
    235       - Currently openlock tests don't support krb5 config.
    236       - DNS_DOMAIN, SRV_DNS_DOMAIN, CLT2_DNS_DOMAIN is used to construct
    237       full qualified domain name for client and server, so they
    238       cannot be, for example, "sun.com", instead they should
    239       be "sfbay.sun.com", "ireland.sun.com", etc. BTW, although
    240       test scripts can get client and server's full qualified
    241       domain name automatically from dns sever, that requires
    242       reverse dns lookup has been set up for machines being
    243       queried, which is not always true for lab machines.
    244 
    245    9. If not all systems participating in test execution are of a single
    246       architecture (a "cross-architecture" testing scenario), the user shall
    247       be prepared to pkgadd, install, mount or in some other manner make
    248       available the appropriate test binaries on all systems participating
    249       in the test. or install test suite for all architectures into the client.
    250       And make sure the root directory of test suite on all systems is
    251       the SAME path. For example, CLIENT2 - sparc; client - i386, if we have 
    252       a binary in client located under /opt/SUNWstc-suite/bin/386/foo,
    253       then we can also find a sparc binary in server or client under 
    254       /opt/SUNWstc-suite/bin/sparc/foo.
    255       
    256 
    257    Below are requirements specific to nfsv4 setup:
    258 
    259    1. By default, the test will detect automatically the filesystem type of
    260       $SHRDIR on SERVER. If filesystem type is ZFS, tests will run over ZFS;
    261       if filesystem type is UFS, tests will run over UFS.
    262 
    263       If SERVER is zfs boot, and you want to run the tests over UFS, you
    264       must provide a dir based on UFS and define it to SHRDIR variable;
    265       Similarly, if SERVER is ufs boot, and you also want to run the tests 
    266       over ZFS, you must provide a dir based on ZFS and define it to
    267       SHRDIR variable.
    268 
    269    
    270 OPTIONAL SETTINGS
    271 =================
    272    
    273    The following env variables(especially SHROPT and MNTOPT) may be
    274    useful when running tests:
    275    
    276       SHRDIR  -  shared directory on server (default is "/nfsgen_share")
    277       SHROPT  -  share options (default is anon=0 since ACL tests need it)
    278       MNTDIR  -  mount directory on client (default is "/nfsgen_mount"), 
    279 		 All tests are run in this directory
    280       MNTOPT  -  mount options (default is "rw")
    281       STRESS_TIMEOUT - By default, the stress test will return TIMEOUT if
    282 		execution time of single test exceeds 3 hours(10800s). If you
    283 		change the value of the variables in stress/stress.vars,
    284 		you may need to reset STRESS_TIMEOUT to your expected time.
    285       NFSGEN_DEBUG  - debug variable, which can be set with
    286                  1) "all" for whole suite,
    287                  2) the name of test scripts you want to debug(e.g. srv_setup),
    288                  3) name of function in test scripts(e.g. wait_now),
    289 		 4) "RUN_CHECK_CMD" or "RUN_CHECK_ALL" for commands 
    290 		    called by RUN_CHECK() function,
    291                  5) "RSH" to get output from the "RSH()" function
    292 		 6) combination of 2-5, separated by ":".
    293    
    294    The test suite provides many other env variables for customizing 
    295    test environment, but they should work out of box and are not 
    296    suggested to change. If you have any questions on them, feel
    297    free to send email to maintainer of this suite, which you can
    298    find in STC.INFO file under the test suite's root directory.
    299 
    300    
    301 CONFIGURATION
    302 =============
    303    
    304    You can choose one of the following ways to define the variables
    305    and configure your suite from the top level directory.
    306     
    307       1) define environment variables
    308    
    309          $ export SERVER=foo
    310          $ stf_configure
    311     
    312       2) use '-c" option
    313          $ stf_configure -c "SERVER=foo" -c ...
    314     
    315       3) use '-f' option
    316          $ stf_configure -f ./myconf
    317     
    318    
    319 EXECUTION
    320 =========
    321    
    322    At execution phase, you can only use 'stf_execute' to run whole suite or
    323    specified tests via '-r' option.
    324    
    325    Although stf_execute supports "-c" option to specify variables which 
    326    overrides those specified at configuration phase, you MUST NOT do that 
    327    for nfs suites, i.e., stf_execute -c "CLIENT2=client2" -c "SHRDIR=testdir",
    328    since the suite has done corresponding configuration against those variables,
    329    re-defining them at execution phase may cause confusing. But you can
    330    print debugging info into journal file via 'stf_execute -c "NFSGEN_DEBUG=:xx:"', 
    331    which is an exception.
    332     
    333    All results will be saved in the journal file under
    334    /var/tmp/nfsgen/results or the directory defined by 'STF_RESULTS'.
    335 
    336    Notes:
    337    - Some tests call ipfilter to block packets, but ipfilter doesn't work
    338      with RDMA configuration, so if you run the suite w/RDMA, those tests
    339      (clntrecov_rw_pos01,clntrecov_rw_pos02) may return TIMEOUT.
    340    
    341     
    342 UNCONFIGURATION
    343 ===============
    344    
    345    You can run the following command from the top level directory
    346    
    347       $ stf_unconfigure
    348    
    349    
    350 TEST DEVELOPMENT
    351 ================
    352 
    353    *NOTE*: This section is intended only for people who work on 
    354    this test suite. If you don't want to change the test suite, add 
    355    new setup or tests, you can skip this section.
    356    
    357    nfsgen test suite is unique in that it supports multiple setups,
    358    new setups, as well as new tests, can be added over time. For this
    359    purpose, it is important to define the interface between setup
    360    code and tests.
    361 
    362    Tests can make the following assumptions on the test execution
    363    environment:
    364    
    365       1) a test directory with read/write/search access($MNTDIR)
    366       2) both client and server have same nfs mapid domain($NFSMAPID_DOMAIN) 
    367       3) both client and server have a same local group($TGROUP),
    368       4) both client and server have two same local users($TUSER01 and $TUSER02),
    369          they MUST be in $TGROUP and can be any valid user known by both client
    370 	 and server. If SETUP!=none, the suite configuration will 
    371 	 create in locally in both client and server.
    372 
    373    All setup "plugins" should provide this, and tests are not
    374    expected to change them during execution. 
    375 
    376 
    377 MANUAL SETUP
    378 ============
    379 
    380    As we mentioned before, when user sets SETUP variable, he can
    381    set it to "none". This means user will set up the whole test
    382    environment manually and let the test suite skip configuration
    383    phase(however, user still needs to run stf_configure, which is
    384    a step required by STF. It is just that stf_configure will
    385    effectively do nothing in term of test environment setup.) This
    386    feature is believed to be useful in some cases.
    387 
    388    It should be noted that in this case, user is required to not
    389    only set up a workable test environment, but also to set those
    390    env variables correctly which compose of the interface between
    391    setup code and tests(see "TEST ENVIRONMENT INTERFACE" section).
    392 
    393    These variables are:
    394 
    395       MNTDIR           -  test directory
    396       NFSMAPID_DOMAIN  -  nfs mapid domain
    397       TGROUP           -  a regular group on both client and server
    398       TUSER01          -  a regular user in TGROUP on both client and server
    399       TUSER02          -  a regular user in TGROUP on both client and server
    400       TestZFS          -  If exported filesystem on the server is ZFS,
    401                           the variable should be set to 1.
    402       CLIENT2 	       -  Optional, if you set it, you should make sure
    403 			  the machine can be access via rsh/rcp as root.
    404 
    405 
    406    In this case, if you want to run acl tests, you still refer to
    407    the README file under tests/acl to do more manual setup.
    408 
    409    When SETUP variable is not set to none, the tests under open and 
    410    lock directories run separately with delegation on and off. But
    411    if the variable is set to none, these tests only run with current
    412    delegation configuration on the server.
    413