'Creates an output directory for a test to run it.
:param subdir: The subdirectory of the test. Generally computed by
_build_tagged_test_name.
:returns: A job_directory instance corresponding to the outputdir of
the test.
:raises: class:`TestError` If the output directory is invalid.'

def _make_test_outputdir(self, subdir):

    path = os.path.join(self.resultdir, subdir)
    if os.path.exists(path):
        msg = ('%s    already    exists;    multiple    tests    cannot    run    with    the    same    subdirectory' % subdir)
        raise error.TestError(msg)
    try:
        outputdir = self._job_directory(path, True)
        return outputdir
    except self._job_directory.JobDirectoryException as e:
        logging.exception('%s    directory    creation    failed    with    %s', subdir, e)
        raise error.TestError(('%s    directory    creation    failed' % subdir))
