How to test unit test infrastructure changes

From Second Life Wiki
Jump to: navigation, search

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.

Chewbacca! What a wookie!

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: - 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)
  • PROJECT_wookie_TEST_wookie
  • wookie_tests
  • wookie (library)
  • PROJECT_chewbacca_TEST_person
  • PROJECT_chewbacca_TEST_chewbacca
  • chewbacca_tests
  • 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: - see if you can write a unit test using just that.