From a669dfdabb3fa1be2e1367d53a797d495e7bd5c9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 12 Sep 2007 14:52:26 +0200 Subject: More misc, test-related changes. (some to allow running tests as root) --- tests/rm/ir-1 | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'tests/rm/ir-1') diff --git a/tests/rm/ir-1 b/tests/rm/ir-1 index 6bd278d47..c3af0acc1 100755 --- a/tests/rm/ir-1 +++ b/tests/rm/ir-1 @@ -1,7 +1,7 @@ #!/bin/sh # Test "rm -ir". -# Copyright (C) 1997, 1998, 2002, 2004, 2006 Free Software Foundation, +# Copyright (C) 1997, 1998, 2002, 2004, 2006, 2007 Free Software Foundation, # Inc. # This program is free software: you can redistribute it and/or modify @@ -24,21 +24,13 @@ 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 $tmp/a $tmp/b $tmp/c || test_failure=1 -> $tmp/a/a || test_failure=1 -> $tmp/b/bb || test_failure=1 -> $tmp/c/cc || test_failure=1 - -if test $test_failure = 1; then - echo 'failure in testing framework' - exit 1 -fi +t=t +mkdir -p $t $t/a $t/b $t/c || framework_failure +> $t/a/a || framework_failure +> $t/b/bb || framework_failure +> $t/c/cc || framework_failure cat < $test.I y @@ -58,17 +50,15 @@ EOF # determine which one was removed based on order of dir entries. # This is a good argument for switching to a dejagnu-style test suite. fail=0 -rm --verbose -i -r $tmp < $test.I > /dev/null 2>&1 || fail=1 +rm --verbose -i -r $t < $test.I > /dev/null 2>&1 || fail=1 -# $tmp should not have been removed. -test -d $tmp || fail=1 +# $t should not have been removed. +test -d $t || fail=1 # There should be only one directory left. -case `echo $tmp/*` in - $tmp/[abc]) ;; +case `echo $t/*` in + $t/[abc]) ;; *) fail=1 ;; esac -rm -rf $tmp $test.I - (exit $fail); exit $fail -- cgit v1.2.3-54-g00ecf