2 # Test basic --backup functionality for both cp and mv.
4 if test "$VERBOSE" = yes; then
9 # Ensure that ls sorts the same way for everyone.
10 . $srcdir/../lang-default
12 . $srcdir/../envvar-check
16 # Be careful to close $actual before removing the containing directory.
17 # Use `1>&2' rather than `1<&-' since the latter appears not to work
18 # with /bin/sh from powerpc-ibm-aix4.2.0.0.
21 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
22 trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $t0 && exit $status' 0
23 trap '(exit $?); exit' 1 2 13 15
26 mkdir -p $tmp || framework_failure=1
27 cd $tmp || framework_failure=1
29 if test $framework_failure = 1; then
30 echo "$0: failure in testing framework" 1>&2
41 for initial_files in 'x' 'x y' 'x y y~' 'x y y.~1~' 'x y y~ y.~1~'; do
42 for opt in none off numbered t existing nil simple never; do
44 $prog --backup=$opt x y || fail=1
45 echo $initial_files $opt: `ls [xy]*`; rm -f x y y~ y.~?~
50 cat <<\EOF > $expected-tmp
61 x y numbered: x y y.~1~
69 x y y~ numbered: x y y.~1~ y~
70 x y y~ t: x y y.~1~ y~
71 x y y~ existing: x y y~
75 x y y.~1~ none: x y y.~1~
76 x y y.~1~ off: x y y.~1~
77 x y y.~1~ numbered: x y y.~1~ y.~2~
78 x y y.~1~ t: x y y.~1~ y.~2~
79 x y y.~1~ existing: x y y.~1~ y.~2~
80 x y y.~1~ nil: x y y.~1~ y.~2~
81 x y y.~1~ simple: x y y.~1~ y~
82 x y y.~1~ never: x y y.~1~ y~
83 x y y~ y.~1~ none: x y y.~1~ y~
84 x y y~ y.~1~ off: x y y.~1~ y~
85 x y y~ y.~1~ numbered: x y y.~1~ y.~2~ y~
86 x y y~ y.~1~ t: x y y.~1~ y.~2~ y~
87 x y y~ y.~1~ existing: x y y.~1~ y.~2~ y~
88 x y y~ y.~1~ nil: x y y.~1~ y.~2~ y~
89 x y y~ y.~1~ simple: x y y.~1~ y~
90 x y y~ y.~1~ never: x y y.~1~ y~
93 sed 's/: x/:/' $expected-tmp |cat $expected-tmp - > $expected
95 cmp $expected $actual || fail=1
97 # Uncomment this if you see a failure and want to try to diagnose it.
98 test $fail = 1 && diff -c $expected $actual 1>&2
100 (exit $fail); exit $fail