How to test unit test infrastructure changes
From Second Life Wiki
The test infrastructure has changed!
If you're making test infrastructure changes or otherwise need to test those changes, how do you know unit testing still works? Use tests. You need tests along the different build types:
- Test on an app target
- Test on a library target
- Test on an app target that links the library target
- Test on an app target that uses the library functionality on the component under test
There is existing code that has each of these types of build concerns, the "chewbacca, what a wookie" project.
The "Chewbacca! What a wookie!" project implements a simple app and library. It's trivial code that uses the different compile and link boundaries. The CMakeLists.txt files show the important parts - setting up unit tests for the different kinds of circumstances, and verifying the builds work as expected.
You can get the files from source control here: http://bitbucket.org/poppy_linden/unit-testing-infrastructure-test/ - There's a README.txt that should tell you how to setup. (Short version: copy or symlink the wookie and chewbacca directories into your project's indra/ dir, and add them to the indra/CMakeLists.txt subdirs commands.)
What do I do after that setup?
To run, you need to configure the build as usual, then build the project "chewbacca". That project should cause the building of
- llcommon (for now)
- llmath (for now)
- wookie (library)
- chewbacca (application)
in that order. If any of those targets aren't built, the unit testing infrastructure doesn't work. Easy!
Additional / manual testing
You don't get off scot-free, unless you think the positive case covers everything. We gotta break it! Unfortunately we can't check that in, because then... the build breaks.
Open indra/chewbacca/CMakeLists.txt - you should see a bunch of points labeled TEST.
More tests forthcoming... (generally, look for the TEST flag in the code and do what it says!)
Write a test from scratch
Because this is infrastructure / workflow changing, the documentation needs to be checked. The path starts here: http://wiki.secondlife.com/wiki/Unit_tests - see if you can write a unit test using just that.