29 September 2013

Build Tests, Improved Documentation and more

Build Tests

The team over at Intelligent Artefacts recently asked if I could help them add build tests for their continuous integration testing. These tests are needed to ensure that they know if they'd added code which would breaks runtime compilation. This is a really good addition to the library, and I'm thankful to them for sponsoring the work and allowing me to include the changes under the standard RCC++ zlib license so that anyone can use and modify the code.


There are two new test functions added to IRuntimeObjectSystem and implemented in RuntimeObjectSystem:


struct IRuntimeObjectSystem
{
    // other functions...

    // tests one by one touching each runtime modifiable source file

    // returns the number of errors - 0 if all passed.
   virtual int TestBuildAllRuntimeSourceFiles(
                 ITestBuildNotifier* callback, bool bTestFileTracking ) = 0;

    // tests touching each header which has RUNTIME_MODIFIABLE_INCLUDE.

    // returns the number of errors - 0 if all passed.
    virtual int TestBuildAllRuntimeHeaders(
                 ITestBuildNotifier* callback, bool bTestFileTracking ) = 0;

};


For the most simple use case, the following should be sufficient to perform the required tests:

pRuntimeObjectSystem->CleanObjectFiles();
pRuntimeObjectSystem->TestBuildAllRuntimeSourceFiles( NULL, false );

Have a look at the SimpleTest application example in the source file Game.cpp for a more complete example. This updates the GUI and permits cancelling mid test by closing the application normally. The tests are performed using the Options menu.

Note that the bTestFileTracking  parameter should be false for most circumstances. When true this also tests the file change notification system in RCC++ by changing the modification times on the files. This will then require a full rebuild of these when you next come to normally compiling the code. The TestBuildAllRuntimeHeaders function will test the header file tracking code in RCC++. Both of these tests are mainly for those modifying The RuntimeObjectSystem or RuntimeCompiler libraries.

Running these alongside any normal compilation checks on a build server after check-ins is a great way to ensure you don't break RCC++ by accident without realizing.

The changeset for these changes is here.

Improved Documentation

I've been making some effort to increase the documentation. If you're curious head over to the wiki and take a look. As always feedback appreciated. In future I plan to move to using Doxygen so everything is part of the git repository.

An alternative Windows file watcher

Márton Tamás spotted an issue with the current Windows file watcher, in that it's incompatible with an alternate API, making integration with libraries using that API difficult. Márton has contributed an alternative solution using this API, which can be enabled with the define WIN32_FW_USE_FINDFIRST_API.

And more...

  • Matthew Jack at Intelligent Artefacts (and a founder of RCC++) discovered an issue when using code on machine with no development environment. I've submitted the fix here.
  • Ethan Trịnh has contributed a compile fix for VS2013.
  • Some further fixes, added missing license files for included dependencies and the alternate Windows file watcher API are all listed here.