@@ -9,6 +9,7 @@ PATH="$PATH:."
99
1010shopt -s extdebug
1111errors=0
12+ disabled=0
1213
1314err_trap () {
1415 : $(( errors+= 1 ))
@@ -257,14 +258,11 @@ cumul_test() {
257258)
258259
259260dir=$( mktemp -d)
260- fifo=" $dir /fifo"
261261file=$( mktemp --tmpdir=" $dir " )
262- mkfifo " $fifo "
263262declare -A types=(
264263 [link]=" $dir /link1 $dir /link2"
265264 [file]=" $file ${types[link]} "
266265 [directory]=" . .. $dir $dir /linkdir"
267- [pipe]=" $fifo "
268266 [char]=" c . 0 @"
269267 [unsignedint]=123
270268 [int]=" 1 123 0 -1 -938945349"
@@ -278,14 +276,23 @@ declare -A types=(
278276 [portnumber]=1234
279277)
280278
279+ fifo=" $dir /fifo"
280+ if mkfifo " $fifo "
281+ then
282+ types[pipe]=$fifo
283+ else
284+ printf " Could not create persistent fifo. Disabling pipe type test.\n"
285+ : $(( disabled++ ))
286+ fi
287+
281288for socket in /dev/log
282289do
283290 [[ -S $socket ]] || continue
284291 types[socket]=$socket
285292done
286293
287294# Look for a terminal
288- for stdfd in 0 1 2
295+ for stdfd in 0
289296do
290297 [[ -t $stdfd ]] || continue
291298 types[terminal]=$stdfd
@@ -295,6 +302,7 @@ for t in terminal socket
295302do
296303 if [[ ${types[$t]-unset} = unset ]]
297304 then
305+ : $(( disabled++ ))
298306 printf " No %s found: won't test.\n" " $t "
299307 fi
300308done
306314 types[host]+=" ${types[hostname]} "
307315else
308316 printf " Cannot resolv localhost. Not testing hostname type.\n"
317+ : $(( disabled++ ))
309318fi
310319
311320(cd " $dir " && ln -s " $file " link1 && ln -s asdf link2 && ln -s . linkdir)
@@ -372,18 +381,22 @@ rm -Rf "$dir"
372381 TEST=failure parse_option_wrapper " custom type (2)" --option asdf
373382)
374383
384+ if [[ $disabled -ne 0 ]]
385+ then
386+ printf " %d disabled\n" " $disabled "
387+ fi
388+
375389if [[ $errors -ne 0 ]]
376390then
377391 printf " %d error(s) encountered. (See above)\n" " $errors "
378392 printf " Environment was:\n"
379- printf " bash is "
380- command -v bash
381- bash --version
382- printf " Bash settings were:\n"
383- printf shopt\\ n
384- shopt
385- printf ' set -o\n'
386- set -o
393+ set -x
394+ {
395+ command -v bash
396+ bash --version
397+ shopt
398+ set -o
399+ } 2>&1
387400 exit 1
388401else
389402 exit 0
0 commit comments