test-lib: allow prefixing a custom string before "ok N" etc.

This is not really meant for external use, but allows the next commit
to neatly distinguish between sub-tests and the main run.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
test-lib: support running tests under valgrind in parallel

With the new --valgrind-parallel=<n> option, we support running the
tests in a single test script under valgrind in parallel using 'n'
processes.

This really follows the dumbest approach possible, as follows:

* First we run through the test script normally, mostly to establish
  how many tests there are.  This should eventually be fixed, but this
  way is much simpler.

* Then we spawn the test script 'n' times, using a throw-away
  TEST_OUTPUT_DIRECTORY.  Each of the instances is given options that
  ensures that it only runs every n-th test, but together they cover
  the entire range.

* Finally we add up the numbers from the individual tests.

This is really a gross hack at this point, and should be improved on
various points:

* We should not have to run once just to count tests.

* We should nicely format the results from the sub-tests so that
  records of valgrind failures are kept somewhere.

Nevertheless, this is already workable and gives a speedup of more
than 2 on a dual-core (hyperthreaded) machine, using n=4.  This is
expected since the overhead of valgrind is so big (on the order of 20x
under good conditions, and a large startup overhead at every git
invocation) that redundantly running the non-valgrind tests in between
is not that expensive.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>