[PATCH xts] Write results directly to results directory
Jamey Sharp
jamey at minilop.net
Mon Jun 3 14:49:26 PDT 2013
Seems like a smart idea and solid patch. I have a couple suggestions you
can do with as you please:
On Mon, Jun 03, 2013 at 04:33:35PM -0400, Peter Harris wrote:
> If an installed xtest is run, the user does not normally have write
> access to the test directory. Writing intermediate files and results
> directly to the results directory avoids a number of spurious FAILs and
> UNRESOLVEDs.
...
> +const char *
> +outfile(const char *fn)
> +{
> + char *out = (char *)fn;
This assignment to out is dead; I'd delete the initializer.
> + const char *path;
> + char *resfile = getenv("TET_RESFILE");
> + if (!resfile)
> + return fn;
> +
> + resfile = strdup(resfile);
> + if (!resfile)
> + return fn;
> +
> + path = dirname(resfile);
> + if (!path)
> + goto done;
> +
> + out = malloc(strlen(path) + strlen(fn) + 2);
> + if (!out) {
> + out = (char *)fn;
> + goto done;
> + }
> + regid(NULL, (union regtypes *)&out, REG_MALLOC);
I don't know the XTS codebase (and don't want to, but...): Does regid
register a resource to be freed at the end of the current test?
- If so, this patch seems clearly correct and a good idea. A comment at
the declaration of outfile() about the lifetime of the result would be
nice though.
- If not, meh, it won't leak so much it's a serious problem.
Either way:
Reviewed-by: Jamey Sharp <jamey at minilop.net>
> + sprintf(out, "%s/%s", path, fn);
> +
> +done:
> + free(resfile);
> + return out;
> +}
Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20130603/71280343/attachment.pgp>
More information about the xorg-devel
mailing list