2 # make sure --update works as advertised
4 if test "$VERBOSE" = yes; then
10 . $srcdir/../envvar-check
11 . $srcdir/../lang-default
15 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
16 trap '(exit $?); exit' 1 2 13 15
19 mkdir $tmp || framework_failure=1
20 cd $tmp || framework_failure=1
21 echo old > old || framework_failure=1
22 touch -d yesterday old || framework_failure=1
23 echo new > new || framework_failure=1
25 if test $framework_failure = 1; then
26 echo 'failure in testing framework' 1>&2
32 for cp_or_mv in cp mv; do
34 $cp_or_mv --update old new || fail=1
35 case "`cat new`" in new) ;; *) fail=1 ;; esac
36 case "`cat old`" in old) ;; *) fail=1 ;; esac
39 # This will actually perform the rename.
40 mv --update new old || fail=1
42 case "`cat old`" in new) ;; *) fail=1 ;; esac
44 # Restore initial conditions.
45 echo old > old || fail=1
46 touch -d yesterday old || fail=1
47 echo new > new || fail=1
49 # This will actually perform the copy.
50 cp --update new old || fail=1
51 case "`cat old`" in new) ;; *) fail=1 ;; esac
52 case "`cat new`" in new) ;; *) fail=1 ;; esac
54 (exit $fail); exit $fail