summaryrefslogtreecommitdiff
path: root/tests/rm/i-1
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-09-12 14:52:26 +0200
committerJim Meyering <jim@meyering.net>2007-09-15 08:40:39 +0200
commita669dfdabb3fa1be2e1367d53a797d495e7bd5c9 (patch)
treec88d6414649f7f4f5571138e193c72da44a03876 /tests/rm/i-1
parent0539705768992ebcc290bc859f64e27898c7f958 (diff)
downloadcoreutils-a669dfdabb3fa1be2e1367d53a797d495e7bd5c9.tar.xz
More misc, test-related changes. (some to allow running tests as root)
Diffstat (limited to 'tests/rm/i-1')
-rwxr-xr-xtests/rm/i-134
1 files changed, 13 insertions, 21 deletions
diff --git a/tests/rm/i-1 b/tests/rm/i-1
index 14ba0dc38..b0d939c2a 100755
--- a/tests/rm/i-1
+++ b/tests/rm/i-1
@@ -1,7 +1,7 @@
#!/bin/sh
# Test "rm -i".
-# Copyright (C) 1997, 1998, 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 1997-1998, 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
@@ -23,33 +23,25 @@ if test "$VERBOSE" = yes; then
rm --version
fi
-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
+. $srcdir/../test-lib.sh
-test_failure=0
-mkdir -p $tmp || test_failure=1
-echo > $tmp/a || test_failure=1
-test -f $tmp/a || test_failure=1
+t=t
+mkdir -p $t || framework_failure
+echo > $t/a || framework_failure
+test -f $t/a || framework_failure
-if test $test_failure = 1; then
- echo 'failure in testing framework'
- exit 1
-fi
-
-echo y > $tmp/$test.Iy
-echo n > $tmp/$test.In
+echo y > $t/$test.Iy
+echo n > $t/$test.In
fail=0
-rm -i $tmp/a < $tmp/$test.In > /dev/null 2>&1 || fail=1
+rm -i $t/a < $t/$test.In > /dev/null 2>&1 || fail=1
# The file should not have been removed.
-test -f $tmp/a || fail=1
+test -f $t/a || fail=1
-rm -i $tmp/a < $tmp/$test.Iy > /dev/null 2>&1 || fail=1
+rm -i $t/a < $t/$test.Iy > /dev/null 2>&1 || fail=1
# The file should have been removed this time.
-test -f $tmp/a && fail=1
+test -f $t/a && fail=1
-rm -rf $tmp
+rm -rf $t
(exit $fail); exit $fail