>From 282ec20de8d715db3ae834f8282eea5488d4c20b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Tue, 10 May 2011 08:14:16 +0100 Subject: [PATCH] tests: refactor more tests to use mkfifo_or_skip_ * tests/cp/existing-perm-race: s/mkfifo/mkfifo_or_skip_/ * tests/cp/file-perm-race: Likewise. * tests/cp/parent-perm-race: Likewise. * tests/cp/special-f: Likewise. * tests/dd/reblock: Likewise. * tests/ls/file-type: Likewise. * tests/misc/cat-buf: Likewise. * tests/misc/mknod: Likewise. * tests/misc/printf-surprise: Likewise. * tests/misc/selinux: Likewise. * tests/misc/sort-spinlock-abuse: Likewise. * tests/misc/stdbuf: Likewise. * tests/misc/tac-continue: Likewise. * tests/init.cfg: Improve the error message when skipping. --- tests/cp/existing-perm-race | 3 +-- tests/cp/file-perm-race | 3 +-- tests/cp/parent-perm-race | 3 +-- tests/cp/special-f | 4 ++-- tests/dd/reblock | 2 +- tests/init.cfg | 2 +- tests/ls/file-type | 2 +- tests/misc/cat-buf | 2 +- tests/misc/mknod | 2 ++ tests/misc/printf-surprise | 2 +- tests/misc/selinux | 2 +- tests/misc/sort-spinlock-abuse | 2 +- tests/misc/stdbuf | 2 +- tests/misc/tac-continue | 2 +- 14 files changed, 16 insertions(+), 17 deletions(-) diff --git a/tests/cp/existing-perm-race b/tests/cp/existing-perm-race index 6afe1a2..a2a6493 100755 --- a/tests/cp/existing-perm-race +++ b/tests/cp/existing-perm-race @@ -30,8 +30,7 @@ g2=$2 umask 077 -mkfifo fifo || - skip_test_ "fifos not supported" +mkfifo_or_skip_ fifo touch fifo-copy && chgrp $g1 fifo && diff --git a/tests/cp/file-perm-race b/tests/cp/file-perm-race index 1e84b1e..41f01ef 100755 --- a/tests/cp/file-perm-race +++ b/tests/cp/file-perm-race @@ -23,8 +23,7 @@ print_ver_ cp require_local_dir_ umask 022 -mkfifo fifo || - skip_test_ "fifos not supported" +mkfifo_or_skip_ fifo # Copy a fifo's contents. That way, we can examine the # destination permissions before they're finalized. diff --git a/tests/cp/parent-perm-race b/tests/cp/parent-perm-race index 4af3b69..366efba 100755 --- a/tests/cp/parent-perm-race +++ b/tests/cp/parent-perm-race @@ -29,8 +29,7 @@ chmod g+s d 2>/dev/null # The cp test is valid either way. for attr in mode ownership do - mkfifo $attr/fifo || - skip_test_ "fifos not supported" + mkfifo_or_skip_ $attr/fifo # Copy a fifo's contents. That way, we can examine d/$attr's # state while cp is running. diff --git a/tests/cp/special-f b/tests/cp/special-f index fb75500..3f63921 100755 --- a/tests/cp/special-f +++ b/tests/cp/special-f @@ -20,8 +20,8 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ cp -mkfifo fifo || - skip_test_ "fifos not supported" +mkfifo_or_skip_ fifo + touch e || framework-failure diff --git a/tests/dd/reblock b/tests/dd/reblock index 01924a8..f66a9ba 100755 --- a/tests/dd/reblock +++ b/tests/dd/reblock @@ -39,7 +39,7 @@ EOF # until the consumer (dd) opens the fifo therefore # increasing the chance that dd will read the data # from each printf separately. -mkfifo dd.fifo || framework_failure +mkfifo_or_skip_ dd.fifo dd_reblock_1() { diff --git a/tests/init.cfg b/tests/init.cfg index 92f841f..b8feceb 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -347,7 +347,7 @@ mkfifo_or_skip_() # failure as a test failure. However, in this case, when running on a SunOS # system using a disk NFS mounted from OpenBSD, the above fails like this: # mkfifo: cannot make fifo `fifo-10558': Not owner - skip_test_ 'NOTICE: unable to create test prerequisites' + skip_test_ 'unable to create a fifo' fi } diff --git a/tests/ls/file-type b/tests/ls/file-type index e1643fe..b722290 100755 --- a/tests/ls/file-type +++ b/tests/ls/file-type @@ -31,7 +31,7 @@ mknod block b 20 20 2> /dev/null && block="block " mknod char c 10 10 2> /dev/null && char="char " -mkfifo fifo +mkfifo_or_skip_ fifo cd .. diff --git a/tests/misc/cat-buf b/tests/misc/cat-buf index 29343f7..348b414 100755 --- a/tests/misc/cat-buf +++ b/tests/misc/cat-buf @@ -24,7 +24,7 @@ print_ver_ cat # consumer (dd) opens the fifo therefore increasing # the chance that dd will read the data from each # write separately. -mkfifo fifo || framework_failure +mkfifo_or_skip_ fifo echo 1 > exp diff --git a/tests/misc/mknod b/tests/misc/mknod index 053f96f..c07b633 100755 --- a/tests/misc/mknod +++ b/tests/misc/mknod @@ -19,6 +19,8 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ mknod +# Ensure fifos are supported +mkfifo_or_skip_ fifo umask 777 diff --git a/tests/misc/printf-surprise b/tests/misc/printf-surprise index df781a9..ca0f8e4 100755 --- a/tests/misc/printf-surprise +++ b/tests/misc/printf-surprise @@ -48,7 +48,7 @@ require_ulimit_ # and to make an N-byte-allocating-printf require more than that, thus # triggering the printf(3) misbehavior -- which, btw, is required by ISO C99. -mkfifo fifo || framework_failure +mkfifo_or_skip_ fifo # Disable MALLOC_PERTURB_, to avoid triggering this bug # http://bugs.debian.org/481543#77 diff --git a/tests/misc/selinux b/tests/misc/selinux index c0bd42e..d1bc9ca 100755 --- a/tests/misc/selinux +++ b/tests/misc/selinux @@ -26,7 +26,7 @@ skip_if_mcstransd_is_running_ # Create a regular file, dir, fifo. touch f || framework_failure mkdir d s1 s2 || framework_failure -mkfifo p || framework_failure +mkfifo_or_skip_ p # special context that works both with and without mcstransd diff --git a/tests/misc/sort-spinlock-abuse b/tests/misc/sort-spinlock-abuse index c241c27..b5ca30f 100755 --- a/tests/misc/sort-spinlock-abuse +++ b/tests/misc/sort-spinlock-abuse @@ -24,7 +24,7 @@ grep '^#define HAVE_PTHREAD_T 1' "$CONFIG_HEADER" > /dev/null || skip_test_ 'requires pthreads' seq 100000 > in || framework_failure_ -mkfifo fifo || framework_failure_ +mkfifo_or_skip_ fifo # Arrange for sort to require 5.0+ seconds of wall-clock time, # while actually using far less than 1 second of CPU time. diff --git a/tests/misc/stdbuf b/tests/misc/stdbuf index 35b5710..80ad870 100755 --- a/tests/misc/stdbuf +++ b/tests/misc/stdbuf @@ -36,7 +36,7 @@ esac # consumer (dd) opens the fifo therefore increasing # the chance that dd will read the data from each # write separately. -mkfifo fifo || framework_failure +mkfifo_or_skip_ fifo # Verify input parameter checking diff --git a/tests/misc/tac-continue b/tests/misc/tac-continue index 912d2ce..5902805 100755 --- a/tests/misc/tac-continue +++ b/tests/misc/tac-continue @@ -53,7 +53,7 @@ seq 5 > in # Give tac a fifo command line argument. # This makes it try to create a temporary file in $TMPDIR. -mkfifo fifo +mkfifo_or_skip fifo seq 1000 > fifo & TMPDIR=$FULL_PARTITION_TMPDIR tac fifo in >out 2>err && fail=1 -- 1.7.4