=head1 NAME B - Run xCAT test cases. =head1 SYNOPSIS B [B<-?|-h>] B [B<-f> I] [B<-b> I] [B<-l>] B [B<-f> I] [B<-t> I] B [B<-f> I] [B<-c> I] [B<-l>] =head1 DESCRIPTION The xcattest command runs test cases to verify the xCAT functionalities, it can be used when you want to verify the xCAT functionalities for whatever reason, for example, to ensure the code changes you made do not break the existing commands; to run acceptance test for new build you got; to verify the xCAT snapshot build or development build before putting it onto your production system. The xcattest command is part of the xCAT package xCAT-test. The root directory for the xCAT-test package is /opt/xcat/share/xcat/tools/autotest/. All test cases are in the sub directory I, indexed by the xCAT command, you can add your own test cases according to the test cases format below. The subdirectory I contains all the test cases bundles definition files, you can customize or create any test cases bundle file as required. The testing result information will be written into the subdirectory I, the timestamps are used as the postfixes for all the result files. xCAT-test package ships two configuration files template I and I for AIX and Linux environment, you can use the template files as the start point of making your own configuration file. =head1 OPTIONS =over 10 =item B<-?|-h> Display usage message. =item B<-f> I Specifies the configuration file, if not specified, the default configure file is /opt/xcat/share/xcat/tools/autotest/default.conf. =item B<-b> I Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. =item B<-t> I Comma separated list of test cases that will be run. =item B<-c> I Comma separated list of commands which will be tested, i.e., all the test cases under the command sub directory will be run. =item B<-l> Display the test cases names specified by the flag -b, -t or -c. =back =head1 RETURN VALUE 0 The command completed successfully. 1 An error has occurred. =head1 TEST CASE FORMAT The xCAT-test test cases are in flat text format, the testing framework will parse the test cases line by line, here is an example of the test case: #required, case name start:case name #optional, description of the test case description: what the test case is for? #optional, environment requirements os:AIX/Linux #optional, environment requirements arch:ppc/x86 #optional, environment requirements hcp:hmc/mm/bmc/fsp #required, command need to run cmd:comand #optional, check return code of last executed command check:rc == or != return code #optional, check output of last executed command check:output== or != or =~ or !~ output check string end B: Each test case can have more than one I sections and each I section can have more than one I sections and more than one I sections, the I can include regular expressions. =head1 EXAMPLES =over 4 1. To run all test cases related command rpower: xcattest -c /tmp/config -c rpower 2. To run customized bundle: xcattest -l > /tmp/custom.bundle Modify custom.bundle xcattest -b custom.bundle 3. To run specified test cases. xcattest -t lsdef_t_o_l_z 4. To add a new case to test chvm. In the example, we assume that the min_mem should not be equal to 16 in the lpar profile of computenode. The case name is chvm_custom. It create a test lpar named testnode firstly, that change the min_mem of the lpar to 16 using chvm, then check if min_mem have changed correctly. At last, the testnode be remove to ensure no garbage produced in the cases. add a new test case file in /opt/xcat/share/xcat/tools/autotest/chvm edit filename start:chvm_custom hcp:hmc cmd:lsvm $$CN > /tmp/autotest.profile check:rc==0 cmd:mkdef -t node -o testnode mgt=hmc groups=all cmd:mkvm testnode -i $$MaxLparID -l $$CN check:rc==0 cmd:perl -pi -e 's/min_mem=\d+/min_mem=16/g' /tmp/autotest.profile cmd:cat /tmp/autotest.profile|chvm testnode check:rc==0 cmd:lsvm testnode check:output=~min_mem=16 cmd:rmvm testnode cmd:rm -f /tmp/autotest.profile end =back =head1 INLINE FUNCTIONS The xCAT-test testing framework provides some inline functions. The inline functions can be called in test cases as __FUNCTIONNAME(PARAMTERLIST)__ to get some necessary attributes defined in the configuration file. The inline functions can be used in I section and the I section. 1. B To get the value of specified node's attribute 2. B To get value of digit+1. For example: To run rscan command against the hardware control point of compute node specified in configuration file cmd: rscan __GETNODEATTR($$CN, hcp)__ -z =head1 FILES /opt/xcat/bin/xcattest