How to Add a Test to roottest

The Short Answer

In an existing roottest directory create one of:

   assertMyTest.C  assertMyTest.cxx
   execMyTest.C    execMyTest.cxx

and run make or specifically to test only your new test:

   cd <directory_where_you_added_it>
   make assertMyTest
Also to see what commands are really issued do:
   make V=t assertMyTest
where V stands for VERBOSE (which can also be used).

The assert will test the return/exit code and the content of stderr. The exec will test the return/exit code and the content of both stdout and stderr. The .C uses CINT. The .cxx uses ACLiC.

It is Quick and Easy to Add a Test

The roottest Makefile contains rules to make it trivial to add a test for which only the return/exit code and the output of standard error will be tested. To add such a test simply create a file named assertMytest.C (for interpreted tests) or assertMytest.cxx (for tests compiled via ACLiC) then run make ... that's it .... (well don't forget to "svn add" and "svn ci" your file).

The output on standard error will, by default, be compared with an empty file, if you have output to standard error that is expected (for example you are testing the error conditions) then you should create a file named assertMytest.ref. The easiest is to run the test and then do

   cp assertMytest.elog assertMytest.ref
or
   cp assertMytest.eclog assertMytest.ref

Adding a Test That Checks Both stdout, stderrr and the Exit Code

If you want both the output streams to be checked, instead of using the assert file names, use the names

   execMytest.C   execMytest.cxx
After running the test (successfully) once, you will need to copy the log file over to the ref file as the standard output is never empty.

Traditional Way of Adding a Test and Best Way to Add a Directory.

As a reminder, the traditional way of adding a test to roottest (besides hand editing the Makefile) is to call the

   addtest
script that is in the top directory of roottest. For example from the top directory of roottest do:
   ./addtest pathname_of_my_test_dir  testname
   cd pathname_of_my_test_dir
and start editing runtestname.C.

Calling addtest is also the best (and only) way to create a sub-directory in roottest (it will create the Makefile and do the svn add for you.