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 <[email protected]>
> + sprintf(out, "%s/%s", path, fn);
> +
> +done:
> + free(resfile);
> + return out;
> +}
Jamey
signature.asc
Description: Digital signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
