From fbcf6aa641e5827da48a3b6776c9897de123b405 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 15 Nov 2011 16:32:12 -0800 Subject: tests: try to set a shorter path for Unix domain sockets We're only allowed 108 bytes for Unix domain sockets. mktemp(1) usually generates path names of reasonable length and we rely on it anyways. --- t/test-lib.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index cab2cc3..7979111 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -38,20 +38,29 @@ rtmpfiles () { for id in "$@" do name=$id - _tmp=$t_pfx.$id - eval "$id=$_tmp" case $name in *fifo) + _tmp=$t_pfx.$id + eval "$id=$_tmp" rm -f $_tmp mkfifo $_tmp T_RM_LIST="$T_RM_LIST $_tmp" ;; *socket) + _tmp="$(mktemp -t $id.$$.XXXXXXXX)" + if test $(printf "$_tmp" |wc -c) -gt 108 + then + echo >&2 "$_tmp too long, tests may fail" + echo >&2 "Try to set TMPDIR to a shorter path" + fi + eval "$id=$_tmp" rm -f $_tmp T_RM_LIST="$T_RM_LIST $_tmp" ;; *) + _tmp=$t_pfx.$id + eval "$id=$_tmp" > $_tmp T_OK_RM_LIST="$T_OK_RM_LIST $_tmp" ;; -- cgit v1.2.3-24-ge0c7