1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-06-07 10:16:46 +02:00
Files
coreutils/tests/touch/fail-diag
T

43 lines
851 B
Bash
Raw Normal View History

2001-09-15 17:07:54 +00:00
#!/bin/sh
# make sure touch gives reasonable diagnostics
if test "$VERBOSE" = yes; then
set -x
touch --version
fi
. $srcdir/../envvar-check
. $srcdir/../lang-default
PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
pwd=`pwd`
tmp=fail-diag.$$
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
2003-01-07 15:34:34 +00:00
d1=no-$$
2002-12-09 09:41:53 +00:00
dir=/$d1/such-dir
# Ensure that $d1 doesn't already exist.
2003-01-07 14:44:45 +00:00
ls -d $d1 2> /dev/null && framework_failure=1
2002-12-09 09:41:53 +00:00
2001-09-15 17:07:54 +00:00
if test $framework_failure = 1; then
echo 'failure in testing framework' 1>&2
(exit 1); exit
fi
fail=0
2003-01-07 15:34:34 +00:00
touch $dir > out 2>&1 && fail=1
cat <<EOF > exp
touch: cannot touch \`$dir': No such file or directory
2001-09-15 17:07:54 +00:00
EOF
2003-01-07 15:34:34 +00:00
cmp out exp || fail=1
2001-09-15 17:07:54 +00:00
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit