[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/23] iotests: Introduce $SOCK_DIR
From: |
Max Reitz |
Subject: |
Re: [PATCH 01/23] iotests: Introduce $SOCK_DIR |
Date: |
Fri, 11 Oct 2019 09:51:50 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
On 10.10.19 20:18, Eric Blake wrote:
> 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?
I would have used mkdir -p, but I saw we used this construct for
TEST_DIR, so I thought I‘d just go for the same.
> 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.
Well, the same applies to TEST_DIR. And technically, as long as we
don’t use mkdir -p for either, not catching the error at least helps
circumvent the potential race. O:-)
(I’ll convert both to mkdir -p with error handling.)
Max
> Otherwise looks good.
signature.asc
Description: OpenPGP digital signature
- [PATCH 00/23] iotests: Add and use $SOCK_DIR, Max Reitz, 2019/10/10
- [PATCH 01/23] iotests: Introduce $SOCK_DIR, Max Reitz, 2019/10/10
- [PATCH 02/23] iotests.py: Store socket files in $SOCK_DIR, Max Reitz, 2019/10/10
- [PATCH 03/23] iotests.py: Add @base_dir to FilePaths etc., Max Reitz, 2019/10/10
- [PATCH 04/23] iotests: Filter $SOCK_DIR, Max Reitz, 2019/10/10
- Re: [PATCH 04/23] iotests: Filter $SOCK_DIR, Eric Blake, 2019/10/10