[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 01/23] iotests: Introduce $SOCK_DIR
From: |
Max Reitz |
Subject: |
[PATCH v2 01/23] iotests: Introduce $SOCK_DIR |
Date: |
Thu, 17 Oct 2019 15:31:33 +0200 |
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.)
Use mkdir -p to create the directory (because it seems right), and do
the same for $TEST_DIR (because there is no reason for that to be
created in any different way).
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/check | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 588c453a94..71fe38834e 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -97,6 +97,7 @@ IMGFMT -- $FULL_IMGFMT_DETAILS
IMGPROTO -- $IMGPROTO
PLATFORM -- $FULL_HOST_DETAILS
TEST_DIR -- $TEST_DIR
+SOCK_DIR -- $SOCK_DIR
SOCKET_SCM_HELPER -- $SOCKET_SCM_HELPER
EOF
@@ -116,10 +117,14 @@ set_prog_path()
if [ -z "$TEST_DIR" ]; then
TEST_DIR=$PWD/scratch
fi
+mkdir -p "$TEST_DIR" || _init_error 'Failed to create TEST_DIR'
-if [ ! -e "$TEST_DIR" ]; then
- mkdir "$TEST_DIR"
+tmp_sock_dir=false
+if [ -z "$SOCK_DIR" ]; then
+ SOCK_DIR=$(mktemp -d)
+ tmp_sock_dir=true
fi
+mkdir -p "$SOCK_DIR" || _init_error 'Failed to create SOCK_DIR'
diff="diff -u"
verbose=false
@@ -534,6 +539,7 @@ if [ -z "$SAMPLE_IMG_DIR" ]; then
fi
export TEST_DIR
+export SOCK_DIR
export SAMPLE_IMG_DIR
if [ -s $tmp.list ]
@@ -716,6 +722,11 @@ END { if (NR > 0) {
rm -f "${TEST_DIR}"/*.out "${TEST_DIR}"/*.err "${TEST_DIR}"/*.time
rm -f "${TEST_DIR}"/check.pid "${TEST_DIR}"/check.sts
rm -f $tmp.*
+
+ if $tmp_sock_dir
+ then
+ rm -rf "$SOCK_DIR"
+ fi
}
trap "_wrapup; exit \$status" 0 1 2 3 15
--
2.21.0
- [PATCH v2 00/23] iotests: Add and use $SOCK_DIR, Max Reitz, 2019/10/17
- [PATCH v2 01/23] iotests: Introduce $SOCK_DIR,
Max Reitz <=
- [PATCH v2 02/23] iotests.py: Store socket files in $SOCK_DIR, Max Reitz, 2019/10/17
- [PATCH v2 03/23] iotests.py: Add @base_dir to FilePaths etc., Max Reitz, 2019/10/17
- [PATCH v2 04/23] iotests: Filter $SOCK_DIR, Max Reitz, 2019/10/17
- [PATCH v2 06/23] iotests/083: Create socket in $SOCK_DIR, Max Reitz, 2019/10/17
- [PATCH v2 05/23] iotests: Let common.nbd create socket in $SOCK_DIR, Max Reitz, 2019/10/17