Adding a new test
To add a new test create a new cmake test file in the source directory under test/reg_test/run_tests/. Here we call it newTest.cmake for the sake of reference. In this file you need to set the following variables: TEST_NAME, TEST_TYPE, EXEC_NAME, NAMELIST_FILES and NC_OUTPUT_FILES.
- TEST_NAME is simply the name of the test you are creating.
- TEST_TYPE is the type of algorithm the test will run (preqx,sweqx,primdgx,swdgx, etc.).
- EXEC_NAME is the name of the specifically compiled executable that will be used to run the test. If what your test requires does not already exist see below under "Adding a new test executable".
- NAMELIST_FILES is the list of namelist files to be run through EXEC_NAME. This can be a list and a separate run will be created for each namelist file.
- NC_OUTPUT_FILES are the Netcdf output files created by this test (this is specified in the namelist file). These files will be compared to baseline results
You may also need to set variables designating other files required for this test: VCOORD_FILES, NCL_FILES, REFSOLN_FILES, and MESH_FILES. These files will get copied or linked to the correct place.
Once this file has been created, simply add the name of the file, here newTest.cmake, to the list of tests contained in test/reg_test/run_tests/test-list.cmake.
That's it. The next time run configure, the test files will be created in the build directory under tests/newTest. Be sure to see that everything required for the test is present in this directory.
The new test will be run with all of the tests during "make check" and can be run by itself with "make test-newTest".
Adding a new test executable
The above method for adding a test required the specification of a test executable in the variable EXEC_NAME. This represents a specifically compiled executable for the test case. This means that NP, PLEV, etc. have been set at compile time. A new test executable can be created as a subdirectory under test_execs.
Now edit the CMakeLists file in the newTestExec subdirectory (newTestExec/CMakeLists.txt) to specify the compile time variables for the test executable required for your test.
Finally add this subdirectory to the test_execs/CMakeLists.txt file under the appropriate section.
That's it. When you reconfigure this executable will be added as a target for make. It will be build by default when compiling and you can build only this target by running "make newTestExec".