regtest: Allow to run groups of tests individually

Now it's possible to pass more than one argument to run-tests command and
optionally the docs directory. When more than one test is passed and the
docs directory is not provided, the common base path of all passed tests
is used as docs directory. The tests passed can be documents or
directories, using absolute paths or paths relative to the docs
directory.
This also allows us to update the refs for a group of tests.
regtest: Limit the number of worker threads to the number of documents to test

We are always spawning all the threads even if the documents to test is
less than the worker threads. Also optimize the case of running only one
test to not spwn any thread.