append-only \
tail-n0f \
big-4gb proc-ksyms start-middle assert assert-2
+
+include $(top_srcdir)/tests/check.mk
# Ensure that tail -f works on an append-only file
# Requires root access to do chattr +a, as well as an ext[23] or xfs file system
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
fi
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
+chattr_a_works=1
touch f
-chattr +a f 2>/dev/null || framework_failure=1
-( echo x > f ) 2>/dev/null && framework_failure=1
-echo x >> f || framework_failure=1
+chattr +a f 2>/dev/null || chattr_a_works=0
+( echo x > f ) 2>/dev/null && chattr_a_works=0
+echo x >> f || chattr_a_works=0
-if test $framework_failure = 1; then
+if test $chattr_a_works = 0; then
echo "$0: chattr +a doesn't work on this file system; skipping this test " 1>&2
(exit 77); exit 77
fi
#!/bin/sh
# Test for assertion failure in "test".
-# Copyright (C) 1999, 2000, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Not "expensive" per se, but sleeping for so long is annoying.
. $srcdir/../very-expensive
-
-tmp=tail-assert.$$
-pwd=`pwd`
-trap 'cd "$pwd" && rm -rf $tmp' 0 1 2 3 15
-
-test_failure=0
-mkdir $tmp || test_failure=1
-cd $tmp || test_failure=1
-
-if test $test_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+. $srcdir/../test-lib.sh
ok='ok ok ok'
# Due to a race condition in the test, the `assert' script would get
# the UMR on Solaris only some of the time, and not at all on Linux/GNU.
-# Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Not "expensive" per se, but sleeping for so long is annoying.
. $srcdir/../very-expensive
-
-tmp=tail-as2.$$
-pwd=`pwd`
-trap 'cd "$pwd" && rm -rf $tmp' 0 1 2 3 15
-
-test_failure=0
-mkdir $tmp || test_failure=1
-cd $tmp || test_failure=1
-
-if test $test_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+. $srcdir/../test-lib.sh
ok='ok ok ok'
# Demonstrate a bug in `tail -cN' when operating on files of size 4G and larger
# Fixed in coreutils-4.5.2.
-# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-. $srcdir/../expensive
-
if test "$VERBOSE" = yes; then
set -x
tail --version
fi
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../expensive
+. $srcdir/../test-lib.sh
# Create a file of size exactly 4GB (2^32) with 8 bytes
# at the beginning and another set of 8 bytes at the end.
# The rest will be NUL bytes. On most modern systems, the following
# creates a file that takes up only a few KB. Here, du -sh says 16K.
-echo abcdefgh | tr -d '\n' > big || framework_failure=1
-echo 87654321 | tr -d '\n' > tmp || framework_failure=1
+echo abcdefgh | tr -d '\n' > big || framework_failure
+echo 87654321 | tr -d '\n' > tmp || framework_failure
# Seek 4GB - 8
dd bs=1 seek=4294967288 if=tmp of=big 2> err || dd_failed=1
if test "$dd_failed" = 1; then
(exit 77); exit 77
fi
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
fail=0
tail -c1 big > out || fail=1
1
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# The problem was that using the solaris5.7 setvbuf function to turn off
# buffering doesn't flush stdout.
-# Copyright (C) 1999, 2000, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
tail --version
fi
-tmp=tail-flush.$$
-pwd=`pwd`
-trap 'cd "$pwd" && rm -rf $tmp' 0 1 2 3 15
-
-test_failure=0
-mkdir $tmp || test_failure=1
-cd $tmp || test_failure=1
-
-if test $test_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+. $srcdir/../test-lib.sh
echo fubar > in
tail -f in | cat > out &
#!/bin/sh
# This test would fail with tail from pre-1.22i textutils.
-# Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
tail --version
fi
-tmp=tail-inf1.$$
-pwd=`pwd`
-trap 'cd "$pwd" && rm -rf $tmp' 0 1 2 3 15
-
-test_failure=0
-mkdir $tmp || test_failure=1
-cd $tmp || test_failure=1
-
-if test $test_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
+. $srcdir/../test-lib.sh
yes > t &
yes_pid=$!
#!/bin/sh
# Prior to textutils-2.0.17, `tail /proc/ksyms' would segfault on Linux.
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
tail --version
fi
-pwd=`pwd`
-tmp=proc-ksyms.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
fail=0
# Verify that tail works even when it's reading from a file
# that is not at its beginning. Based on a report from John Roll.
-# Copyright (C) 2001, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
tail --version
fi
-pwd=`pwd`
-tmp=tail-mid.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-(echo 1; echo 2) > k || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+(echo 1; echo 2) > k || framework_failure
fail=0
2
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
# Make sure that `tail -n0 -f' and `tail -c0 -f' sleep
# rather than doing what amounted to a busy-wait.
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
# This bug was fixed for 5.0.91
# It skips the test if your system lacks a /proc/$pid/status
# file, or if its contents don't look right.
tail --version
fi
+. $srcdir/../test-lib.sh
+
sleep 2 &
pid=$!
sleep .5
}
kill $pid
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch empty || framework_failure=1
-echo anything > nonempty || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch empty || framework_failure
+echo anything > nonempty || framework_failure
fail=0