Skip to content

Commit cbf6373

Browse files
author
Damien Nadé
committed
Disable unix socket test if none found on filesystem
1 parent 3c2d6f1 commit cbf6373

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

unittest

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ declare -A types=(
265265
[file]="$file ${types[link]}"
266266
[directory]=". .. $dir $dir/linkdir"
267267
[pipe]="$fifo"
268-
[socket]=/dev/log
269268
[char]="c . 0 @"
270269
[unsignedint]=123
271270
[int]="1 123 0 -1 -938945349"
@@ -279,21 +278,27 @@ declare -A types=(
279278
[portnumber]=1234
280279
)
281280

281+
for socket in /dev/log
282+
do
283+
[[ -S $socket ]] || continue
284+
types[socket]=$socket
285+
done
286+
282287
# Look for a terminal
283288
for stdfd in 0 1 2
284289
do
285-
if [[ -t $stdfd ]]
290+
[[ -t $stdfd ]] || continue
291+
types[terminal]=$stdfd
292+
done
293+
294+
for t in terminal socket
295+
do
296+
if [[ ${types[$t]-unset} = unset ]]
286297
then
287-
types[terminal]=$stdfd
288-
break
298+
printf "No %s found: won't test.\n" "$t"
289299
fi
290300
done
291301

292-
if [[ ${types[terminal]-unset} = unset ]]
293-
then
294-
printf "No terminal found: won't test.\n"
295-
fi
296-
297302
# Test hostnames only if we can actually resolv.
298303
if host localhost >/dev/null 2>&1
299304
then

0 commit comments

Comments
 (0)