From 9eb4c31eb78c28dd9f72d1cbb940270311be343c Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Thu, 30 Aug 2012 14:13:12 +0200 Subject: tests: add .sh and .pl suffixes to shell and perl tests, respectively Not only this shrinks the size of the generated Makefile (from > 6300 lines to ~3000), but will allow further simplifications in future changes. * tests/Makefile.am (TEST_EXTENSIONS): Add '.sh' and '.pl'. (PL_LOG_COMPILER, SH_LOG_COMPILER): New, still defined simply to $(LOG_COMPILER) for the time being. (TESTS, root_tests): Adjust as described. * All tests: Rename as described. --- tests/ln/backup-1 | 30 ------- tests/ln/backup-1.sh | 30 +++++++ tests/ln/hard-backup | 32 ------- tests/ln/hard-backup.sh | 32 +++++++ tests/ln/hard-to-sym | 77 ----------------- tests/ln/hard-to-sym.sh | 77 +++++++++++++++++ tests/ln/misc | 124 --------------------------- tests/ln/misc.sh | 124 +++++++++++++++++++++++++++ tests/ln/relative | 32 ------- tests/ln/relative.sh | 32 +++++++ tests/ln/sf-1 | 31 ------- tests/ln/sf-1.sh | 31 +++++++ tests/ln/slash-decorated-nonexistent-dest | 29 ------- tests/ln/slash-decorated-nonexistent-dest.sh | 29 +++++++ tests/ln/target-1 | 30 ------- tests/ln/target-1.sh | 30 +++++++ 16 files changed, 385 insertions(+), 385 deletions(-) delete mode 100755 tests/ln/backup-1 create mode 100755 tests/ln/backup-1.sh delete mode 100755 tests/ln/hard-backup create mode 100755 tests/ln/hard-backup.sh delete mode 100755 tests/ln/hard-to-sym create mode 100755 tests/ln/hard-to-sym.sh delete mode 100755 tests/ln/misc create mode 100755 tests/ln/misc.sh delete mode 100755 tests/ln/relative create mode 100755 tests/ln/relative.sh delete mode 100755 tests/ln/sf-1 create mode 100755 tests/ln/sf-1.sh delete mode 100755 tests/ln/slash-decorated-nonexistent-dest create mode 100755 tests/ln/slash-decorated-nonexistent-dest.sh delete mode 100755 tests/ln/target-1 create mode 100755 tests/ln/target-1.sh (limited to 'tests/ln') diff --git a/tests/ln/backup-1 b/tests/ln/backup-1 deleted file mode 100755 index ffd630bcf..000000000 --- a/tests/ln/backup-1 +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# Try to create a symlink with backup where the destination file exists -# and the backup file name is a hard link to the destination file. - -# Copyright (C) 1999-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Based on a problem report from Jamie Lokier. - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - -touch a b || framework_failure_ - -ln b b~ || fail=1 -ln -f --b=simple a b || fail=1 - -Exit $fail diff --git a/tests/ln/backup-1.sh b/tests/ln/backup-1.sh new file mode 100755 index 000000000..ffd630bcf --- /dev/null +++ b/tests/ln/backup-1.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Try to create a symlink with backup where the destination file exists +# and the backup file name is a hard link to the destination file. + +# Copyright (C) 1999-2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Based on a problem report from Jamie Lokier. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + +touch a b || framework_failure_ + +ln b b~ || fail=1 +ln -f --b=simple a b || fail=1 + +Exit $fail diff --git a/tests/ln/hard-backup b/tests/ln/hard-backup deleted file mode 100755 index bc38bbe5d..000000000 --- a/tests/ln/hard-backup +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Ensure that 'ln --backup F F' gives a proper diagnostic. - -# Copyright (C) 2006-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - -touch f || framework_failure_ - - -ln --backup f f 2> out && fail=1 -cat <<\EOF > exp || fail=1 -ln: 'f' and 'f' are the same file -EOF - -compare exp out || fail=1 - -Exit $fail diff --git a/tests/ln/hard-backup.sh b/tests/ln/hard-backup.sh new file mode 100755 index 000000000..bc38bbe5d --- /dev/null +++ b/tests/ln/hard-backup.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Ensure that 'ln --backup F F' gives a proper diagnostic. + +# Copyright (C) 2006-2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + +touch f || framework_failure_ + + +ln --backup f f 2> out && fail=1 +cat <<\EOF > exp || fail=1 +ln: 'f' and 'f' are the same file +EOF + +compare exp out || fail=1 + +Exit $fail diff --git a/tests/ln/hard-to-sym b/tests/ln/hard-to-sym deleted file mode 100755 index 358b93008..000000000 --- a/tests/ln/hard-to-sym +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh -# Tests for ln -L/-P. - -# Copyright (C) 2009-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - - -# =================================================== -# ensure -s silently overrides -L, -P -touch a || framework_failure_ -ln -L -s a symlink1 || fail=1 -ln -P -s symlink1 symlink2 || fail=1 -ln -s -L -P symlink2 symlink3 || fail=1 - -# =================================================== -# ensure that -L follows symlinks, and overrides -P -ln -P -L symlink3 hard-to-a || fail=1 -ls=$(ls -lG hard-to-a)x -case "$ls" in - *'hard-to-ax') ;; - *'hard-to-a -> '*x) fail=1 ;; - *) framework_failure_ ;; -esac - -# =================================================== -# ensure that -P links (or at least duplicates) symlinks, and overrides -L -ln -L -P symlink3 hard-to-3 || fail=1 -ls=$(ls -lG hard-to-3)x -case "$ls" in - *'hard-to-3 -> symlink2x') ;; - *'hard-to-3x') fail=1 ;; - *'hard-to-3 -> '*x) fail=1 ;; - *) framework_failure_ ;; -esac - -# =================================================== -# Create a hard link to a dangling symlink. -ln -s /no-such-dir || framework_failure_ -ln -L no-such-dir hard-to-dangle 2>err && fail=1 -case $(cat err) in - *" accessing 'no-such-dir'":*) ;; - *) fail=1 ;; -esac -ln -P no-such-dir hard-to-dangle || fail=1 - -# =================================================== -# Create a hard link to a symlink to a directory. -mkdir d || framework_failure_ -ln -s d link-to-dir || framework_failure_ -ln -L link-to-dir hard-to-dir-link 2>err && fail=1 -case $(cat err) in - *": 'link-to-dir': hard link not allowed for directory"*) ;; - *) fail=1 ;; -esac -ln -P link-to-dir/ hard-to-dir-link 2>err && fail=1 -case $(cat err) in - *": 'link-to-dir/': hard link not allowed for directory"*) ;; - *) fail=1 ;; -esac -ln -P link-to-dir hard-to-dir-link || fail=1 - -Exit $fail diff --git a/tests/ln/hard-to-sym.sh b/tests/ln/hard-to-sym.sh new file mode 100755 index 000000000..358b93008 --- /dev/null +++ b/tests/ln/hard-to-sym.sh @@ -0,0 +1,77 @@ +#!/bin/sh +# Tests for ln -L/-P. + +# Copyright (C) 2009-2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + + +# =================================================== +# ensure -s silently overrides -L, -P +touch a || framework_failure_ +ln -L -s a symlink1 || fail=1 +ln -P -s symlink1 symlink2 || fail=1 +ln -s -L -P symlink2 symlink3 || fail=1 + +# =================================================== +# ensure that -L follows symlinks, and overrides -P +ln -P -L symlink3 hard-to-a || fail=1 +ls=$(ls -lG hard-to-a)x +case "$ls" in + *'hard-to-ax') ;; + *'hard-to-a -> '*x) fail=1 ;; + *) framework_failure_ ;; +esac + +# =================================================== +# ensure that -P links (or at least duplicates) symlinks, and overrides -L +ln -L -P symlink3 hard-to-3 || fail=1 +ls=$(ls -lG hard-to-3)x +case "$ls" in + *'hard-to-3 -> symlink2x') ;; + *'hard-to-3x') fail=1 ;; + *'hard-to-3 -> '*x) fail=1 ;; + *) framework_failure_ ;; +esac + +# =================================================== +# Create a hard link to a dangling symlink. +ln -s /no-such-dir || framework_failure_ +ln -L no-such-dir hard-to-dangle 2>err && fail=1 +case $(cat err) in + *" accessing 'no-such-dir'":*) ;; + *) fail=1 ;; +esac +ln -P no-such-dir hard-to-dangle || fail=1 + +# =================================================== +# Create a hard link to a symlink to a directory. +mkdir d || framework_failure_ +ln -s d link-to-dir || framework_failure_ +ln -L link-to-dir hard-to-dir-link 2>err && fail=1 +case $(cat err) in + *": 'link-to-dir': hard link not allowed for directory"*) ;; + *) fail=1 ;; +esac +ln -P link-to-dir/ hard-to-dir-link 2>err && fail=1 +case $(cat err) in + *": 'link-to-dir/': hard link not allowed for directory"*) ;; + *) fail=1 ;; +esac +ln -P link-to-dir hard-to-dir-link || fail=1 + +Exit $fail diff --git a/tests/ln/misc b/tests/ln/misc deleted file mode 100755 index 4da0eda45..000000000 --- a/tests/ln/misc +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/sh -# Miscellaneous tests for "ln". - -# Copyright (C) 1998-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - -t=tln-symlink -d=tln-subdir -ld=tln-symlink-to-subdir -f=tln-file - -# Create a simple symlink with both source and destination files -# in current directory. -touch $f || framework_failure_ -rm -f $t || framework_failure_ -ln -s $f $t || fail=1 -test -f $t || fail=1 -rm $t $f - -# Create a symlink with source file and explicit destination directory/file. -touch $f || framework_failure_ -rm -rf $d || framework_failure_ -mkdir $d || framework_failure_ -ln -s ../$f $d/$t || fail=1 -test -f $d/$t || fail=1 -rm -rf $d $f - -# Create a symlink with source file and destination directory. -touch $f || framework_failure_ -rm -rf $d || framework_failure_ -mkdir $d || framework_failure_ -ln -s ../$f $d || fail=1 -test -f $d/$f || fail=1 -rm -rf $d $f - -# See whether a trailing slash is followed too far. -touch $f || framework_failure_ -rm -rf $d || framework_failure_ -mkdir $d $d/$f || framework_failure_ -ln $f $d/ 2> /dev/null && fail=1 -ln -s $f $d/ 2> /dev/null && fail=1 -rm -rf $d $f - -# Make sure we get a failure with existing dest without -f option -touch $t || framework_failure_ -# FIXME: don't ignore the error message but rather test -# it to make sure it's the right one. -ln -s $t $t 2> /dev/null && fail=1 -rm $t - -# Make sure -sf fails when src and dest are the same -touch $t || framework_failure_ -ln -sf $t $t 2> /dev/null && fail=1 -rm $t - -# Create a symlink with source file and no explicit directory -rm -rf $d || framework_failure_ -mkdir $d || framework_failure_ -touch $d/$f || framework_failure_ -ln -s $d/$f || fail=1 -test -f $f || fail=1 -rm -rf $d $f - -# Create a symlink with source file and destination symlink-to-directory. -rm -rf $d $f $ld || framework_failure_ -touch $f || framework_failure_ -mkdir $d || framework_failure_ -ln -s $d $ld -ln -s ../$f $ld || fail=1 -test -f $d/$f || fail=1 -rm -rf $d $f $ld - -# Create a symlink with source file and destination symlink-to-directory. -# BUT use the new --no-dereference option. -rm -rf $d $f $ld || framework_failure_ -touch $f || framework_failure_ -mkdir $d || framework_failure_ -ln -s $d $ld -af=$(pwd)/$f -ln --no-dereference -fs "$af" $ld || fail=1 -test -f $ld || fail=1 -rm -rf $d $f $ld - -# Try to create a symlink with backup where the destination file exists -# and the backup file name is a hard link to the destination file. -touch a b || framework_failure_ -ln b b~ || framework_failure_ -ln -f --b=simple a b || fail=1 - -# =================================================== - -# Make sure ln can make simple backups. -# This was fixed in 4.0.34. Broken in 4.0r. -for cmd in ln cp mv ginstall; do - rm -rf a x a.orig - touch a x || framework_failure_ - $cmd --backup=simple --suffix=.orig x a || fail=1 - test -f a.orig || fail=1 -done - -# =================================================== -# With coreutils-5.2.1, this would mistakenly access argv[1][-1]. -# I'm including it here, in case some day programs like valgrind detect that. -# Purify probably would have done so. -ln foo '' 2> /dev/null - -# =================================================== - -Exit $fail diff --git a/tests/ln/misc.sh b/tests/ln/misc.sh new file mode 100755 index 000000000..4da0eda45 --- /dev/null +++ b/tests/ln/misc.sh @@ -0,0 +1,124 @@ +#!/bin/sh +# Miscellaneous tests for "ln". + +# Copyright (C) 1998-2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + +t=tln-symlink +d=tln-subdir +ld=tln-symlink-to-subdir +f=tln-file + +# Create a simple symlink with both source and destination files +# in current directory. +touch $f || framework_failure_ +rm -f $t || framework_failure_ +ln -s $f $t || fail=1 +test -f $t || fail=1 +rm $t $f + +# Create a symlink with source file and explicit destination directory/file. +touch $f || framework_failure_ +rm -rf $d || framework_failure_ +mkdir $d || framework_failure_ +ln -s ../$f $d/$t || fail=1 +test -f $d/$t || fail=1 +rm -rf $d $f + +# Create a symlink with source file and destination directory. +touch $f || framework_failure_ +rm -rf $d || framework_failure_ +mkdir $d || framework_failure_ +ln -s ../$f $d || fail=1 +test -f $d/$f || fail=1 +rm -rf $d $f + +# See whether a trailing slash is followed too far. +touch $f || framework_failure_ +rm -rf $d || framework_failure_ +mkdir $d $d/$f || framework_failure_ +ln $f $d/ 2> /dev/null && fail=1 +ln -s $f $d/ 2> /dev/null && fail=1 +rm -rf $d $f + +# Make sure we get a failure with existing dest without -f option +touch $t || framework_failure_ +# FIXME: don't ignore the error message but rather test +# it to make sure it's the right one. +ln -s $t $t 2> /dev/null && fail=1 +rm $t + +# Make sure -sf fails when src and dest are the same +touch $t || framework_failure_ +ln -sf $t $t 2> /dev/null && fail=1 +rm $t + +# Create a symlink with source file and no explicit directory +rm -rf $d || framework_failure_ +mkdir $d || framework_failure_ +touch $d/$f || framework_failure_ +ln -s $d/$f || fail=1 +test -f $f || fail=1 +rm -rf $d $f + +# Create a symlink with source file and destination symlink-to-directory. +rm -rf $d $f $ld || framework_failure_ +touch $f || framework_failure_ +mkdir $d || framework_failure_ +ln -s $d $ld +ln -s ../$f $ld || fail=1 +test -f $d/$f || fail=1 +rm -rf $d $f $ld + +# Create a symlink with source file and destination symlink-to-directory. +# BUT use the new --no-dereference option. +rm -rf $d $f $ld || framework_failure_ +touch $f || framework_failure_ +mkdir $d || framework_failure_ +ln -s $d $ld +af=$(pwd)/$f +ln --no-dereference -fs "$af" $ld || fail=1 +test -f $ld || fail=1 +rm -rf $d $f $ld + +# Try to create a symlink with backup where the destination file exists +# and the backup file name is a hard link to the destination file. +touch a b || framework_failure_ +ln b b~ || framework_failure_ +ln -f --b=simple a b || fail=1 + +# =================================================== + +# Make sure ln can make simple backups. +# This was fixed in 4.0.34. Broken in 4.0r. +for cmd in ln cp mv ginstall; do + rm -rf a x a.orig + touch a x || framework_failure_ + $cmd --backup=simple --suffix=.orig x a || fail=1 + test -f a.orig || fail=1 +done + +# =================================================== +# With coreutils-5.2.1, this would mistakenly access argv[1][-1]. +# I'm including it here, in case some day programs like valgrind detect that. +# Purify probably would have done so. +ln foo '' 2> /dev/null + +# =================================================== + +Exit $fail diff --git a/tests/ln/relative b/tests/ln/relative deleted file mode 100755 index cfc34691e..000000000 --- a/tests/ln/relative +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Test "ln --relative". - -# Copyright (C) 2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - -mkdir -p usr/bin || framework_failure_ -mkdir -p usr/lib/foo || framework_failure_ -touch usr/lib/foo/foo || framework_failure_ - -ln -sr usr/lib/foo/foo usr/bin/foo -test $(readlink usr/bin/foo) = '../lib/foo/foo' || fail=1 - -ln -sr usr/bin/foo usr/lib/foo/link-to-foo -test $(readlink usr/lib/foo/link-to-foo) = 'foo' || fail=1 - -Exit $fail diff --git a/tests/ln/relative.sh b/tests/ln/relative.sh new file mode 100755 index 000000000..cfc34691e --- /dev/null +++ b/tests/ln/relative.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Test "ln --relative". + +# Copyright (C) 2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + +mkdir -p usr/bin || framework_failure_ +mkdir -p usr/lib/foo || framework_failure_ +touch usr/lib/foo/foo || framework_failure_ + +ln -sr usr/lib/foo/foo usr/bin/foo +test $(readlink usr/bin/foo) = '../lib/foo/foo' || fail=1 + +ln -sr usr/bin/foo usr/lib/foo/link-to-foo +test $(readlink usr/lib/foo/link-to-foo) = 'foo' || fail=1 + +Exit $fail diff --git a/tests/ln/sf-1 b/tests/ln/sf-1 deleted file mode 100755 index 824c22432..000000000 --- a/tests/ln/sf-1 +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# Test "ln -sf". - -# Copyright (C) 1997-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - -echo foo > a || framework_failure_ -ln -s . b || framework_failure_ - -ln -sf a b > err 2>&1 && fail=1 -case $(cat err) in - *'are the same file') ;; - *) fail=1 ;; -esac - -Exit $fail diff --git a/tests/ln/sf-1.sh b/tests/ln/sf-1.sh new file mode 100755 index 000000000..824c22432 --- /dev/null +++ b/tests/ln/sf-1.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Test "ln -sf". + +# Copyright (C) 1997-2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + +echo foo > a || framework_failure_ +ln -s . b || framework_failure_ + +ln -sf a b > err 2>&1 && fail=1 +case $(cat err) in + *'are the same file') ;; + *) fail=1 ;; +esac + +Exit $fail diff --git a/tests/ln/slash-decorated-nonexistent-dest b/tests/ln/slash-decorated-nonexistent-dest deleted file mode 100755 index 5da855e6c..000000000 --- a/tests/ln/slash-decorated-nonexistent-dest +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# ensure that touch f; ln -T f no-such-file/ does not mistakenly succeed - -# Copyright (C) 2009-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - -touch f || framework_failure_ - - -# Before coreutils-7.6, this would succeed on Solaris 10 -ln -T f no-such-file/ && fail=1 -test -e no-such-file && fail=1 - -Exit $fail diff --git a/tests/ln/slash-decorated-nonexistent-dest.sh b/tests/ln/slash-decorated-nonexistent-dest.sh new file mode 100755 index 000000000..5da855e6c --- /dev/null +++ b/tests/ln/slash-decorated-nonexistent-dest.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# ensure that touch f; ln -T f no-such-file/ does not mistakenly succeed + +# Copyright (C) 2009-2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + +touch f || framework_failure_ + + +# Before coreutils-7.6, this would succeed on Solaris 10 +ln -T f no-such-file/ && fail=1 +test -e no-such-file && fail=1 + +Exit $fail diff --git a/tests/ln/target-1 b/tests/ln/target-1 deleted file mode 100755 index 1d511e5e7..000000000 --- a/tests/ln/target-1 +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# Test "ln --target-dir" with one file. - -# Copyright (C) 2002-2012 Free Software Foundation, Inc. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Before coreutils-4.5.3, --target-dir didn't work with one file. -# It would create the desired link, but would fail with a diagnosis like this: -# ln: 'd/.': cannot overwrite directory -# Based on a test case from Dmitry V. Levin. - -. "${srcdir=.}/init.sh"; path_prepend_ ../src -print_ver_ ln - -mkdir d || framework_failure_ -ln -s --target-dir=d ../f || fail=1 - -Exit $fail diff --git a/tests/ln/target-1.sh b/tests/ln/target-1.sh new file mode 100755 index 000000000..1d511e5e7 --- /dev/null +++ b/tests/ln/target-1.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Test "ln --target-dir" with one file. + +# Copyright (C) 2002-2012 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Before coreutils-4.5.3, --target-dir didn't work with one file. +# It would create the desired link, but would fail with a diagnosis like this: +# ln: 'd/.': cannot overwrite directory +# Based on a test case from Dmitry V. Levin. + +. "${srcdir=.}/init.sh"; path_prepend_ ../src +print_ver_ ln + +mkdir d || framework_failure_ +ln -s --target-dir=d ../f || fail=1 + +Exit $fail -- cgit v1.2.3-54-g00ecf