tests: factor 350 fail=0 initializations into test-lib.sh
[platform/upstream/coreutils.git] / tests / mv / part-hardlink
1 #!/bin/sh
2 # Ensure that hard links are preserved when moving between partitions
3 # and when the links are in separate command line arguments.
4 # For additional constraints, see the comment in copy.c.
5 # Before coreutils-5.2.1, this test would fail.
6
7 # Copyright (C) 2004-2009 Free Software Foundation, Inc.
8
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
22 if test "$VERBOSE" = yes; then
23   set -x
24   mv --version
25 fi
26
27 . $srcdir/test-lib.sh
28 cleanup_() { rm -rf "$other_partition_tmpdir"; }
29 . "$abs_srcdir/other-fs-tmpdir"
30
31 touch f || framework_failure
32 ln f g || framework_failure
33 mkdir a b || framework_failure
34 touch a/1 || framework_failure
35 ln a/1 b/1 || framework_failure
36
37
38 mv f g "$other_partition_tmpdir" || fail=1
39 mv a b "$other_partition_tmpdir" || fail=1
40
41 cd "$other_partition_tmpdir"
42 set `ls -Ci f g`
43 test $1 = $3 || fail=1
44 set `ls -Ci a/1 b/1`
45 test $1 = $3 || fail=1
46
47 Exit $fail