Select tests by a parent directory as well as the full path.
Optimise finding test input files.

We need to use a glob to inspect each test directory to avoid including
output files as input files in the tests if the input filename contains
a glob.  This was being done in a very dumb fashion which caused the
config parser to grind to a halt if there are a large number of testcode
outputs in the test directories.  This is needless---we should only do
it once per directory rather than once per input file (oops!).  A quick
re-ordering has, on a trivial test, shaved 2s off parsing the jobconfig
file and setting up all tests.