tests: adjust memory limits in head-c.sh
[coreutils.git] / tests / ln / relative.sh
blob35ce99817188be4ca8371210564d7768c44bf280
1 #!/bin/sh
2 # Test "ln --relative".
4 # Copyright (C) 2012-2016 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ ln
22 mkdir -p usr/bin || framework_failure_
23 mkdir -p usr/lib/foo || framework_failure_
24 touch usr/lib/foo/foo || framework_failure_
26 ln -sr usr/lib/foo/foo usr/bin/foo
27 test $(readlink usr/bin/foo) = '../lib/foo/foo' || fail=1
29 ln -sr usr/bin/foo usr/lib/foo/link-to-foo
30 test $(readlink usr/lib/foo/link-to-foo) = 'foo' || fail=1
32 # Correctly update an existing link, which was broken in <= 8.21
33 ln -s dir1/dir2/f existing_link
34 ln -srf here existing_link
35 test $(readlink existing_link) = 'here' || fail=1
37 # Demonstrate resolved symlinks used to generate relative links
38 # so here, 'web/latest' will not be linked to the intermediate 'latest' link.
39 # You'd probably want to use realpath(1) in conjunction
40 # with ln(1) without --relative to give greater control.
41 ln -s release1 alpha
42 ln -s release2 beta
43 ln -s beta latest
44 mkdir web
45 ln -sr latest web/latest
46 test $(readlink web/latest) = '../release2' || fail=1
48 # Expect this to fail with exit status 1, or to succeed quietly (freebsd).
49 # Prior to coreutils-8.23, it would segfault.
50 ln -sr '' F
51 case $? in [01]) ;; *) fail=1;; esac
53 Exit $fail