arch --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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
fail=0
arch > out || fail=1
uname -m > exp || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
cat --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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
f=/proc/cpuinfo
test -f $f \
cat -E $f | sed 's/[0-9][0-9]*/D/g' | tr -d '$' > out || fail=1
cat $f | sed 's/[0-9][0-9]*/D/g' | tr -d '$' > exp || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
-
-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
-mkdir -p d/sub/s2 || framework_failure=1
-touch f g d/sub/1 d/sub/2 || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+mkdir -p d/sub/s2 || framework_failure
+touch f g d/sub/1 d/sub/2 || framework_failure
fail=0
f|-ttmp_t|root:object_r:tmp_t:SystemLow-SystemHigh
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
fi
. $srcdir/../lang-default
-
-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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
# Ensure that several programs work fine, even with stdout initially closed.
# This is effectively a test of closeout.c's close_stdout function.
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
rm --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
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
-PATH="$pwd/../..:$PATH"
-export PATH
+p="$abs_top_builddir"
fail=0
rmdir e >&- || fail=1
touch e >&- || fail=1
sleep 0 >&- || fail=1
-"$pwd/../../src/true" >&- || fail=1
-"$pwd/../../src/printf" '' >&- || fail=1
+"$p/src/true" >&- || fail=1
+"$p/src/printf" '' >&- || fail=1
# If >&- works, ensure these fail, because stdout is closed and they
# *do* generate output. >&- apparently does not work in HP-UX 11.23.
# This test is ineffective unless /dev/stdout also works.
-if "$pwd/../../src/test" -w /dev/stdout >/dev/null &&
- "$pwd/../../src/test" ! -w /dev/stdout >&-; then
- "$pwd/../../src/printf" 'foo' >&- 2>/dev/null && fail=1
+if "$p/src/test" -w /dev/stdout >/dev/null &&
+ "$p/src/test" ! -w /dev/stdout >&-; then
+ "$p/src/printf" 'foo' >&- 2>/dev/null && fail=1
cp --verbose a b >&- 2>/dev/null && fail=1
fi
# Likewise for /dev/full, if /dev/full works.
if test -w /dev/full && test -c /dev/full; then
- "$pwd/../../src/printf" 'foo' >/dev/full 2>/dev/null && fail=1
+ "$p/src/printf" 'foo' >/dev/full 2>/dev/null && fail=1
cp --verbose a b >/dev/full 2>/dev/null && fail=1
fi
#!/bin/sh
# various csplit tests
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 2006 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001-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
. $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=csplit.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
0
2
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
rm -f in out exp
# Ensure that xx02 contains just two newlines.
# This would fail due to reading from freed buffer with coreutils-5.0.91.
printf '\n\n' > exp
cp xx02 out || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
rm -f in out exp
# csplit would infloop
0
3
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
rm -f in out exp
# `echo |csplit - 1 1' used to abort.
0
1
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
cat <<\EOF > experr
csplit: warning: line number `1' is the same as preceding line number
EOF
-cmp err experr || fail=1
-test $fail = 1 && diff err experr 2> /dev/null
+compare err experr || fail=1
rm -f in out exp err experr
# make sure `csplit FILE 0' fails.
csplit: warning: line number `3' is the same as preceding line number
csplit: `3': line number out of range
EOF
-cmp err experr || fail=1
-test $fail = 1 && diff err experr 2> /dev/null
+compare err experr || fail=1
# Ensure that lines longer than the initial buffer length don't cause
# trouble (e.g. reading from freed memory, resulting in corrupt output).
rm -f in out exp err experr xx??
printf 'x%8199s\nx\n%8199s\nx\n' x x > in
csplit in '/x\{1\}/' '{*}' > /dev/null || fail=1
-cat xx?? | cmp - in || fail=1
+cat xx?? | compare - in || fail=1
(exit $fail); exit $fail
date --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
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
fail=0
df --version
fi
+. $srcdir/../test-lib.sh
+
case `df .` in
*'
'*)
df --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
-
-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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
head -n1 t1 > exp || fail=1
head -n1 t2 > out || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# ensure that false exits nonzero even with --help or --version
-# 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
false --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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
-
false --version > /dev/null && fail=1
false --help > /dev/null && fail=1
#!/bin/sh
# make sure fmt -s works even on long lines
-# Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
fmt --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
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-(echo ' '; yes) | head -n1000 | tr '\n' ' ' > in || framework_failure=1
+(echo ' '; yes) | head -n1000 | tr '\n' ' ' > in || framework_failure
-cat <<\EOF > exp || framework_failure=1
+cat <<\EOF > exp || framework_failure
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
y y
EOF
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
fail=0
fmt -s in > out || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
fi
. $srcdir/../lang-default
-
-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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
-
groups --version | sed 's/^groups/id/; /^$/q' > out || fail=1
id --version | sed '/^$/q' > exp || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# exercise the fix of 2001-08-18, based on test case from Ian Bruce
-# 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
head --version
fi
-pwd=`pwd`
-tmp=head-c.$$
-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 abc > in || framework_failure=1
-
-if test $framework_failure = 1; then
- echo 'failure in testing framework' 1>&2
- (exit 1); exit 1
-fi
+echo abc > in || framework_failure
fail=0
-
(head -c1; head -c1) < in > out || fail=1
case "`cat out`" in
ab) ;;
# When reading a specified number of lines, ensure that the output
# file pointer is positioned just after those lines.
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
head --version
fi
-pwd=`pwd`
-tmp=head-pos.$$
-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 a; echo b) > in || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+(echo a; echo b) > in || framework_failure
fail=0
(head -n 1 >/dev/null; cat) < in > out || fail=1
b
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
ls --version
fi
-. $srcdir/../envvar-check
-
-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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
# Avoid any possible glitches due to daylight-saving changes near the
# time stamps used during the test.
TZ=UTC0
export TZ
-tmp=t-ls.$$
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
t1='1998-01-15 21:00'
t2='1998-01-15 22:00'
t3='1998-01-15 23:00'
u2='1998-01-14 12:00'
u3='1998-01-14 13:00'
-touch -m -d "$t3" a || framework_failure=1
-touch -m -d "$t2" b || framework_failure=1
-touch -m -d "$t1" c || framework_failure=1
+touch -m -d "$t3" a || framework_failure
+touch -m -d "$t2" b || framework_failure
+touch -m -d "$t1" c || framework_failure
-touch -a -d "$u3" c || framework_failure=1
-touch -a -d "$u2" b || framework_failure=1
+touch -a -d "$u3" c || framework_failure
+touch -a -d "$u2" b || framework_failure
# Make sure A has ctime at least 1 second more recent than C's.
sleep 2
-touch -a -d "$u1" a || framework_failure=1
+touch -a -d "$u1" a || framework_failure
fail=0
sleep 2
# Create a link, updating c's ctime.
-ln c d || framework_failure=1
+ln c d || framework_failure
# Before we go any further, verify that touch's -m option works.
set -- `ls --full -l a`
EOF
#`
ls --full -l a
- framework_failure=1
+ framework_failure
;;
esac
;;
esac
-if test $framework_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
set `ls -ut a b c`
test "$*" = 'c b a' && : || fail=1
test $fail = 1 && ls -l --full-time --time=access a b c
#!/bin/sh
# Ensure that mknod, mkfifo, mkdir -m MODE work with a restrictive umask
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
mknod --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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
#! /bin/sh
# Test "nice".
-# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005-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 script takes no arguments.
-
-if test -n "$DJDIR"; then
- echo "$0: cannot test nice on DJGPP" >&2
- exit 77
+if test "$VERBOSE" = yes; then
+ set -x
+ nice --version
fi
+. $srcdir/../test-lib.sh
+
tests='
0 empty 10
1 -1 1
#!/bin/sh
# exercise nl functionality
-# 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
nl --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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
$
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# test nohup
-# 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
nohup --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
-
-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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
fi
echo 'stderr' >> exp || fail=1
-cmp exp err || fail=1
-test $fail = 1 && diff exp err 2> /dev/null
+compare exp err || fail=1
rm -f nohup.out err exp
# ----------------------
nohup: cannot run command `no-such-command': No such file or directory
EOF
# Disable these comparisons. Too much variation in 2nd line.
-# cmp exp err || fail=1
-# test $fail = 1 && diff exp err 2> /dev/null
+# compare exp err || fail=1
rm -f nohup.out err exp
# ----------------------
nohup: cannot run command `./k': Permission denied
EOF
# Disable these comparisons. Too much variation in 2nd line.
-# cmp exp err || fail=1
-# test $fail = 1 && diff exp err 2> /dev/null
+# compare exp err || fail=1
# Make sure it fails with exit status of 127 when given too few arguments.
nohup >/dev/null 2>&1
#!/bin/sh
# pathchk tests
-# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005, 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-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && 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 file || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch file || framework_failure
fail=0
: ${PERL=perl}
: ${srcdir=.}
-. $srcdir/../envvar-check
$PERL -e 1 > /dev/null 2>&1 || {
echo 1>&2 "$0: configure didn't find a usable version of Perl," \
#!/bin/sh
# basic tests for printf
-# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-prog=`pwd`/../../src/printf
+prog="$abs_top_builddir/src/printf"
if test "$VERBOSE" = yes; then
set -x
"$prog" --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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
foo
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
rm -f out exp
# Until coreutils-4.5.10, this would elicit a segfault.
11 x
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff -au out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# make sure that only two hex. digits are consumed in a \xHHH sequence
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-prog=`pwd`/../../src/printf
+prog="$abs_top_builddir/src/printf"
if test "$VERBOSE" = yes; then
set -x
"$prog" --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
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
fail=0
~3
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
exit 77
}
-framework_failure=0
-pwd=`"${BUILD_SRC_DIR?}"/pwd` || framework_failure=1
-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
-
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
ARGV_0=$0
export ARGV_0
-CWD=$pwd/$tmp
-export CWD
-
+# Don't use CuTmpdir here, since File::Temp's use of rmtree can't
+# remove the deep tree we create.
$PERL -Tw -- - <<\EOF
# Show that pwd works even when the length of the resulting
readlink --version
fi
+. $srcdir/../test-lib.sh
+
test $host_os != linux-gnu &&
{
echo 1>&2 "$0: vendor getcwd may be inadequate; skipping this test"
(exit 77); exit 77
}
-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
-
-mkdir -p a/b || framework_failure=1
-cd a/b || framework_failure=1
-chmod a=x .. || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir -p a/b || framework_failure
+cd a/b || framework_failure
+chmod a=x .. || framework_failure
-pwd_exe=$pwd/../../src/pwd
+pwd_exe="$abs_top_builddir/src/pwd"
fail=0
$pwd_exe > exp || fail=1
readlink -ev . > out || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
fi
. $srcdir/../lang-default
+. $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
-
-cat <<\EOF > exp || framework_failure=1
+cat <<\EOF > exp || framework_failure
runcon: runcon may be used only on a SELinux kernel
EOF
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
fail=0
# This test works even on systems without SELinux.
# about -j being an invalid option.
runcon -t unconfined_t true -j 2> out && : > exp
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
stat --version
fi
-. $srcdir/../envvar-check
. $srcdir/../lang-default
. $srcdir/../selinux
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-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/../test-lib.sh
# Create a regular file, dir, fifo.
-touch f || framework_failure=1
-mkdir d s1 s2 || framework_failure=1
-mkfifo p || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch f || framework_failure
+mkdir d s1 s2 || framework_failure
+mkfifo p || framework_failure
fail=0
shuf --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
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-seq 100 > in || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+seq 100 > in || framework_failure
fail=0
-
shuf in >out || fail=1
# Fail if the input is the same as the output.
# This is a probabilistic test :-)
# However, the odds of failure are very low: 1 in 100! (~ 1 in 10^158)
-cmp in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
+compare in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
# Fail if the sorted output is not the same as the input.
sort -n out > out1
-cmp in out1 || { fail=1; echo "not a permutation" 1>&2; }
+compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
# Exercise shuf's -i option.
shuf -i 1-100 > out || fail=1
-cmp in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
+compare in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
sort -n out > out1
-cmp in out1 || { fail=1; echo "not a permutation" 1>&2; }
+compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
# Exercise shuf's -e option.
t=`shuf -e a b c d e | sort | fmt`
sort --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
-seq -w 2000 > exp || framework_failure=1
-tac exp > in || framework_failure=1
-SORT=$abs_top_builddir/src/sort
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
+seq -w 2000 > exp || framework_failure
+tac exp > in || framework_failure
+SORT="$abs_top_builddir/src/sort"
# Ensure that $TMPDIR is valid.
TMPDIR=.; export TMPDIR
# This should force the use of temp files compressed with the default gzip
sort -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
# Create our own gzip program that will be used as the default
cat <<\EOF > gzip || fail=1
# This will find our new gzip in PATH
PATH=.:$PATH sort -S 1k --compress-program=gzip in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
test -f ok || fail=1
rm -f ok
# This is to make sure it works with no compression.
PATH=.:$PATH sort -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
test -f ok && fail=1
# This is to make sure we can use something other than gzip
mv gzip dzip || fail=1
sort --compress-program=./dzip -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
test -f ok || fail=1
rm -f ok
# Make sure it can find other programs in PATH correctly
PATH=.:$PATH sort --compress-program=dzip -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
test -f ok || fail=1
rm -f dzip ok
# This is to make sure sort functions if it can't find the default gzip
PATH=. "$SORT" -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
(exit $fail); exit $fail
#!/bin/sh
# Ensure that sort --sort-random doesn't sort.
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2005-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
sort --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
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-seq 100 > in || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+seq 100 > in || framework_failure
fail=0
# Fail if the input is the same as the output.
# This is a probabilistic test :-)
# However, the odds of failure are very low: 1 in 100! (~ 1 in 10^158)
-cmp in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
+compare in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
# Fail if the sorted output is not the same as the input.
sort -n out > out1
-cmp in out1 || { fail=1; echo "not a permutation" 1>&2; }
+compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
# If locale is available then use it to find a random non-C locale.
if (locale --version) > /dev/null 2>&1; then
LC_ALL=$locale sort --random-sort in > out2 || fail=1
# Fail if the output "randomly" is the same twice in a row.
- cmp out1 out2 > /dev/null && { fail=1; echo "not random with LC_ALL=$locale" 1>&2; }
+ compare out1 out2 > /dev/null && { fail=1; echo "not random with LC_ALL=$locale" 1>&2; }
# Fail if the sorted output is not the same as the input.
sort -n out > out1
- cmp in out1 || { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; }
+ compare in out1 || { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; }
fi
(exit $fail); exit $fail
#!/bin/sh
# Show that split -a works.
-# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002-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
. $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=split-a.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
fail=0
creating file `xba'
EOF
-cmp err exp || fail=1
-test $fail = 1 && diff err exp 2> /dev/null
+compare err exp || fail=1
(exit $fail); exit $fail
fi
. $srcdir/../lang-default
+. $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
-touch in || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+touch in || framework_failure
fail=0
cat <<\EOF > exp
split: line count option -99*... is too large
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
(exit $fail); exit $fail
#!/bin/sh
# show that `split --lines=2' works.
-# Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
ln --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
+. $srcdir/../test-lib.sh
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-printf '1\n2\n3\n4\n5\n' > in || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+printf '1\n2\n3\n4\n5\n' > in || framework_failure
fail=0
-
split --lines=2 in > out || fail=1
cat <<\EOF > exp-1
1
5
EOF
-cmp xaa exp-1 || fail=1
-test $fail = 1 && diff xaa exp 2> /dev/null
-cmp xab exp-2 || fail=1
-test $fail = 2 && diff xab exp 2> /dev/null
-cmp xac exp-3 || fail=1
-test $fail = 3 && diff xac exp 2> /dev/null
+compare xaa exp-1 || fail=1
+compare xab exp-2 || fail=1
+compare xac exp-3 || fail=1
test -f xad && fail=1
(exit $fail); exit $fail
stat --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
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
fail=0
# when it encounters an error with say the first one.
# With coreutils-5.2.1 and earlier, this test would fail.
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 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
fi
. $srcdir/../lang-default
+. $srcdir/../test-lib.sh
# See if the envvar is defined.
if test x = "x$FULL_PARTITION_TMPDIR"; then
(exit 1); exit 1
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
fp_tmp="$FULL_PARTITION_TMPDIR/tac-cont-$$"
-t0="$t0 $fp_tmp"
# Make sure we can create an empty file there (i.e. no shortage of inodes).
if ! touch $fp_tmp; then
echo "$0: $fp_tmp: cannot create empty file" 1>&2
seq 5 > in
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
-
fail=0
# Give tac a fifo command line argument.
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
#!/bin/sh
# Show that wc's new --files0-from option works.
-# 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
. $srcdir/../lang-default
+. $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
-
-echo 2 > 2b || framework_failure=1
-echo 2 words > 2w || framework_failure=1
-printf '2b\n2w\n' |tr '\n' '\0' > names || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+echo 2 > 2b || framework_failure
+echo 2 words > 2w || framework_failure
+printf '2b\n2w\n' |tr '\n' '\0' > names || framework_failure
fail=0
2 3 10 total
EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
if test "$fail" = ''; then
# Repeat the above test, but read the file name list from stdin.
rm -f out
wc --files0-from=- < names > out || fail=1
- cmp out exp || fail=1
- test $fail = 1 && diff out exp 2> /dev/null
+ compare out exp || fail=1
fi
(exit $fail); exit $fail
: ${PERL=perl}
: ${srcdir=.}
-. $srcdir/../envvar-check
PROG=`echo $0|sed 's,.*/,,'`; export PROG
pr --version
fi
-. $srcdir/../envvar-check
-
: ${PERL=perl}
: ${srcdir=.}