The structure and execution of Trafodion test suites varies by component.
The DCS (Database Connectivity Services) code is written in Java, and is built and unit tested using Maven. The test suite organization and use follow Maven standards.
The core components are written in a combination of C++ and Java. Each time you add a new feature to SQL or modify an existing feature, you want to ensure that the current set of regression tests pass. You may want to ensure coverage for your new feature by ensuring your new feature is covered or may want to add to an existing test. Below are some details on running the developer regression tests.
Location of the tests :
$MY_SQROOT/../sql/regress
Under this directory you will find several component directories eg : core, qat, compGeneral and executor. Under directory $MY_SQROOT/../sql/regress/tools, you find the driver scripts that run each of these suites. "runallsb" is the driver script that runs all the regressions suits. The script uses the sqlci command interface to run SQL commands.
To run the regression test suite, do the following:
cd $MY_SQROOT/../sql/regress tools/runallsb
(The above assumes that you have already run the sqenv.sh script, which sets the $MY_SQROOT environment variable.)
This suite tests the SQL engine (Compiler and Executor) as well as the transaction and foundation layers. On completion, it prints out a test summary. All tests should pass, or pass with known diffs.
Another way to check the test results after the fact is:
cd $MY_SQROOT/rundir grep FAIL */runregr-sb.log
Under each component directory you will see a file called runregr-sb.log where that component's regress result is stored. What you see on your terminal at the end of a regression run is a "cat" of all these component files.
A successful test run shows no failures.
cd $MY_SQROOT/../sql/regress tools/runallsb <suite1> <suite2>
cd $MY_SQROOT/../sql/regress/<suite> export rundir=$MY_SQROOT/rundir export scriptsdir=$MY_SQROOT/../sql/regress (you can add the 2 exports into your .bashrc for convenience) cd $rundir/<suite> $scriptsdir/<suite>/runregr -sb <test>
eg : cd $rundir/executor $scriptsdir/executor/runregr -sb TEST130
mkdir $rundir, cd $rundir mkdir <suitename > // suitename should match the name of each directory in $scriptsdir
Then continue on with steps as listed above in 1.
If you see failures in any of your tests, you want to try running that suite or test individually as detailed above.
Open up the DIFF file and correlate them to the LOG and EXPECTED files.
To narrow down the failure, open up the testfile eg TEST130 on $scriptsdir/executor. Recreate the problem with a smaller set of SQL commands and create a script to run from sqlci. If it's an issue that can be recreated only by running the whole suite, you can add a line to the test just before the command that fails to include a "wait" or a "sleep" "sh sleep 60" will make the test pause and give you time to attach the sqlci process to the debugger. (You can find the pid of the sqlci process using sqps on the command line)
Introducing a "wait" in the test will wait forever until you enter a character. This is another way to make the test pause to attach the debugger to the sqlci process.
If you would like to add coverage for your new change, you can modify an existing test. Run the test after your modifications. If you are satisfied with your results, you need to modify the EXPECTED<test number> file to reflect your new change. Standard way to do it is to copy the LOG<test number> file to EXPECTED< test number> file.
The Phoenix tests were originally adapted from their counterpart at Salesforce.com. The Trafodion architects in the early days felt that we could use this set of basic functional tests to iron out functional issues in Trafodion.
Just like its original Salesforce.com version, our Trafodion version of Phoenix tests are also open-sourced (bearing both Salesforce.com and HP copyright headers). They can be downloaded by anyone who wants to run them. The tests are executed using maven with a python wrapper; both are standard test execution mechanisms in the open-source world. But you really don’t need to know either of them to run phoenix tests. You can run them the same way on your own workstation instance just like the way Jenkins runs them. Here are the simple 1-2-3 steps:
cd tests/phx
phoenix_test.py --target=<host>:<port> --user=dontcare --pw=dontcare --targettype=TR --javahome=<jdk> --jdbccp=<jdir>/jdbcT4.jar
<host>: your workstation name or IP address
<port>: your DCS master port number
<jdk>: the directory containing the jdk1.7.0_21_64 or later version of the JDK
<jdir>: the directory containing your JDBC T4 jar file (export/lib if you downloaded a Trafodion binary package)
If you only need to run a particular test, README.rst also has instructions on how to do that.
The code is written in Java, and is built and unit tested using Maven. The test suite organization and use follow Maven standards. Instructions for setting up and running the test can be found in source tree at dcs/src/test/jdbc_test
The code is written for the Python 2.7 unittest framework. It is run via the Testr and Tox. Instructions for setting up and running the test can be found in source tree at dcs/src/test/pytests