qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/23] iotests: Introduce $SOCK_DIR


From: Eric Blake
Subject: Re: [PATCH 01/23] iotests: Introduce $SOCK_DIR
Date: Thu, 10 Oct 2019 13:18:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0

On 10/10/19 10:24 AM, Max Reitz wrote:
Unix sockets generally have a maximum path length.  Depending on your
$TEST_DIR, it may be exceeded and then all tests that create and use
Unix sockets there may fail.

Circumvent this by adding a new scratch directory specifically for
Unix socket files.  It defaults to a temporary directory (mktemp -d)
that is completely removed after the iotests are done.

(By default, mktemp -d creates a /tmp/tmp.XXXXXXXXXX directory, which
should be short enough for our use cases.)

Signed-off-by: Max Reitz <address@hidden>
---
  tests/qemu-iotests/check | 17 +++++++++++++++++

+tmp_sock_dir=false
+if [ -z "$SOCK_DIR" ]; then
+    SOCK_DIR=$(mktemp -d)
+    tmp_sock_dir=true
+fi
+
+if [ ! -d "$SOCK_DIR" ]; then
+    mkdir "$SOCK_DIR"
+fi

Should this use mkdir -p, in case two parallel processes compete with the same SOCK_DIR?

What if SOCK_DIR is set to something that is not a directory (say a file), at which point mkdir fails, but you don't seem to be catching that failure.

Otherwise looks good.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]