[PATCH wayland] tests: Use unique XDG_RUNTIME_DIR

Pekka Paalanen ppaalanen at gmail.com
Thu Nov 10 11:34:52 UTC 2016


On Thu, 10 Nov 2016 11:14:03 +0000
Daniel Stone <daniels at collabora.com> wrote:

> Rather than using a hardcoded 'wayland-tests' directory under
> the existing XDG_RUNTIME_DIR to use as the new runtime dir, use mkdtemp
> to guarantee uniqueness. This fixes make -jN check, as well as just
> happening to run 'make check' twice from the same session.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Reported-by: Pekka Paalanen <pekka.paalanen at collabora.com>
> ---
>  tests/test-runner.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/test-runner.c b/tests/test-runner.c
> index 4aa6667..82a0a7b 100644
> --- a/tests/test-runner.c
> +++ b/tests/test-runner.c
> @@ -226,10 +226,11 @@ set_xdg_runtime_dir(void)
>  
>  	xrd_env = getenv("XDG_RUNTIME_DIR");
>  	/* if XDG_RUNTIME_DIR is not set in environ, fallback to /tmp */
> -	assert((snprintf(xdg_runtime_dir, PATH_MAX, "%s/wayland-tests",
> +	assert((snprintf(xdg_runtime_dir, PATH_MAX, "%s/wayland-tests-XXXXXX",
>  			 xrd_env ? xrd_env : "/tmp") < PATH_MAX)
>  		&& "test error: XDG_RUNTIME_DIR too long");
>  
> +	assert(mkdtemp(xdg_runtime_dir) && "test error: mkdtemp failed");
>  	if (mkdir(xdg_runtime_dir, 0700) == -1)
>  		if (errno != EEXIST) {
>  			perror("Creating XDG_RUNTIME_DIR");

Seems to work! \o/

Pushed:
   b802108..23d3c67  master -> master


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20161110/491c2a0f/attachment.sig>


More information about the wayland-devel mailing list