Wednesday, October 17, 2012

CMake Updated For Test Programs

The old make file also built the various test programs residing in the test sub-directory.  The CMake build system was updated to also build these test programs.  This required quite a bit of experimentation to get working, but the final solution was rather simple.  First, each of the test programs an add_executable command was added to CmakeLists.txt with the list of the source files required to build the program along with any dependent header files.

To create the new make tests target required an add_custom_target command naming the target (tests) and specifying the test programs that this target is dependent on using the DEPENDS option.  However, there was a problem where the test programs were built with the standard make command (the same as make all) in addition to when the make tests command was issued.  This problem was resolved by adding the EXCLUDE_FROM_ALL option to each of the test programs add_executable command.

Each of the test programs were tested to verify that they produced the same output on all three platforms.  Several of the test programs were updated to achieve this, and the expected output files were updated accordingly.  Hit Continue... below for details on the changes made to the test programs.

Now that all the CMake issues have been resolved, it is time to make official release 0.1.16.  It's going to take a little time to prepare the release notes, merge branch0.1.16 to master, generate all the archive files for uploading, etc..  In the mean time, the latest changes have been pushed to GitHub and tagged v0.1.16‑pre‑2.  The should be close to the actual release, since none of the core program files are expected to change.



Test Numbers (test_nums): A compiler warning was corrected where the wrong format specifier was used for the result of the sizeof operator.  Integer range changes were added to the error range check so that the desired range error works properly on 64‑bit platforms.  The code used to output consistent number of exponent digits added to the main program was added.  The output was modified to not output the result from the string conversion to a number if a range error occurs (because different platforms produced different results, and since the result is indeterminate anyway, this is best).  And one of the test strings was changed from 1e‑308 to 1e‑324 to produce consistent results of all platforms.

Test Stack (test_stack) and Test String (test_string): Both of these programs were updated to not output any pointer values, which can differ between runs and will differ between platforms.  There was no expected test string output file, probably because of the pointer issue, so this file was added.

There is no script for running these tests, so they all have to be run manually.  This is not necessary since the tests for the main program basically accomplish the same testing.  These test programs were originally created to test various aspects before they were added to the main program.  They are being left in the project for now (and it was good experience learning how to create a separate target with CMake).

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)