From 6863925ddd92c8f4b44556a2bb32d958d00325ff Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 25 Dec 2013 17:07:11 +0100 Subject: tests: more significant names for some tests * t/insh2.sh: Rename... * t/dist-install-sh.sh: ... like this. * t/instsh.sh: Rename... * t/add-missing-install-sh.sh: ... like this. * t/instsh2.sh: Rename... * t/install-sh-unittests.sh: ... like this. * t/instsh3.sh: Rename... * t/install-sh-option-C.sh: ... like this. * t/list-of-tests.mk: Adjust. Signed-off-by: Stefano Lattarini --- t/add-missing-install-sh.sh | 41 +++++++++++++++ t/dist-install-sh.sh | 40 +++++++++++++++ t/insh2.sh | 40 --------------- t/install-sh-option-C.sh | 45 +++++++++++++++++ t/install-sh-unittests.sh | 118 ++++++++++++++++++++++++++++++++++++++++++++ t/instsh.sh | 41 --------------- t/instsh2.sh | 118 -------------------------------------------- t/instsh3.sh | 45 ----------------- t/list-of-tests.mk | 8 +-- 9 files changed, 248 insertions(+), 248 deletions(-) create mode 100644 t/add-missing-install-sh.sh create mode 100644 t/dist-install-sh.sh delete mode 100644 t/insh2.sh create mode 100644 t/install-sh-option-C.sh create mode 100644 t/install-sh-unittests.sh delete mode 100644 t/instsh.sh delete mode 100644 t/instsh2.sh delete mode 100644 t/instsh3.sh diff --git a/t/add-missing-install-sh.sh b/t/add-missing-install-sh.sh new file mode 100644 index 000000000..33cf5f5aa --- /dev/null +++ b/t/add-missing-install-sh.sh @@ -0,0 +1,41 @@ +#! /bin/sh +# Copyright (C) 1996-2013 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 2, 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 . + +# Test for this bug: +# automake: Makefile.am: required file "../../install-sh" not found; installing +# This also makes sure that install-sh is created in the correct directory. + +. test-init.sh + +: > Makefile.am +rm -f install-sh + +# Since the default path includes '../..', we must run this test in +# yet another subdir. +mkdir frob +mv Makefile.am configure.ac frob/ +cd frob + +$ACLOCAL +$AUTOMAKE --add-missing >output 2>&1 || { cat output; exit 1; } +cat output + +# Only one '/' should appear in the output. +grep '/.*/' output && exit 1 + +test -f install-sh + +: diff --git a/t/dist-install-sh.sh b/t/dist-install-sh.sh new file mode 100644 index 000000000..de453f289 --- /dev/null +++ b/t/dist-install-sh.sh @@ -0,0 +1,40 @@ +#! /bin/sh +# Copyright (C) 1996-2013 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 2, 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 . + +# Test for bug where install-sh not included in distribution. + +. test-init.sh + +echo AC_OUTPUT >> configure.ac + +cat > Makefile.am << 'END' +pkgdata_DATA = +.PHONY: test +test: distdir + find $(distdir) ;: For debugging. + echo ' ' $(DISTFILES) ' ' | grep '[ /]install-sh ' + echo ' ' $(DIST_COMMON) ' ' | grep '[ /]install-sh ' + test -f $(distdir)/install-sh +END + +$ACLOCAL +$AUTOMAKE +$AUTOCONF + +./configure +$MAKE test + +: diff --git a/t/insh2.sh b/t/insh2.sh deleted file mode 100644 index de453f289..000000000 --- a/t/insh2.sh +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# Copyright (C) 1996-2013 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 2, 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 . - -# Test for bug where install-sh not included in distribution. - -. test-init.sh - -echo AC_OUTPUT >> configure.ac - -cat > Makefile.am << 'END' -pkgdata_DATA = -.PHONY: test -test: distdir - find $(distdir) ;: For debugging. - echo ' ' $(DISTFILES) ' ' | grep '[ /]install-sh ' - echo ' ' $(DIST_COMMON) ' ' | grep '[ /]install-sh ' - test -f $(distdir)/install-sh -END - -$ACLOCAL -$AUTOMAKE -$AUTOCONF - -./configure -$MAKE test - -: diff --git a/t/install-sh-option-C.sh b/t/install-sh-option-C.sh new file mode 100644 index 000000000..a53e21df7 --- /dev/null +++ b/t/install-sh-option-C.sh @@ -0,0 +1,45 @@ +#! /bin/sh +# Copyright (C) 2006-2013 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 2, 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 . + +# More install-sh checks: check -C. + +am_create_testdir=empty +required=non-root +. test-init.sh + +# Solaris /usr/ucb/touch does not accept -t. +touch -t "$old_timestamp" foo \ + || skip_ "touch utility doesn't accept '-t' option" + +get_shell_script install-sh + +./install-sh -d d1 + +# Do not change the timestamps when using -C. +echo foo >file +./install-sh -C file d1 +TZ=UTC0 touch -t $old_timestamp d1/file +./install-sh -C file d1 +is_newest file d1/file +echo foo1 >file +./install-sh -C file d1 +diff file d1/file +# Rights must be updated. +./install-sh -C -m 444 file d1 +test -r d1/file +test ! -w d1/file + +: diff --git a/t/install-sh-unittests.sh b/t/install-sh-unittests.sh new file mode 100644 index 000000000..8a60d7435 --- /dev/null +++ b/t/install-sh-unittests.sh @@ -0,0 +1,118 @@ +#! /bin/sh +# Copyright (C) 2002-2013 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 2, 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 . + +# Various install-sh checks. + +am_create_testdir=empty +. test-init.sh + +get_shell_script install-sh + +# Basic errors. +./install-sh && exit 1 +./install-sh -m 644 dest && exit 1 + +# Directories. + +# It should be OK to create no directory. We sometimes need +# this when directory are conditionally defined. +./install-sh -d +# One directory. +./install-sh -d d0 +test -d d0 +# Multiple directories (for make installdirs). +./install-sh -d d1 d2 d3 d4 +test -d d1 +test -d d2 +test -d d3 +test -d d4 +# Subdirectories. +./install-sh -d p1/p2/p3 p4//p5//p6// +test -d p1/p2/p3 +test -d p4/p5/p6 + +# Files. +: > x +./install-sh -c -m 644 x y +test -f x +test -f y +./install-sh -m 644 y z +test -f y +test -f z +# Multiple files. +./install-sh -m 644 -c x z d1 +test -f x +test -f z +test -f d1/x +test -f d1/z +./install-sh -m 644 x z d2// +test -f x +test -f z +test -f d2/x +test -f d2/z +./install-sh -t d3 -m 644 x z +test -f x +test -f z +test -f d3/x +test -f d3/z +./install-sh -t d4// -m 644 x z +test -f x +test -f z +test -f d4/x +test -f d4/z +./install-sh -T x d3/y +test -f x +test -f d3/y +./install-sh -T x d3 && exit 1 +./install-sh -T x d4// && exit 1 + +# Ensure that install-sh works with names that include spaces. +touch 'a b' +mkdir 'x y' +./install-sh 'a b' 'x y' +test -f x\ \ y/a\ \ b +test -f 'a b' + +# Ensure we do not run into 'test' operator precedence bugs with Tru64 sh. +for c in = '(' ')' '!'; do + ./install-sh $c 2>stderr && { cat stderr >&2; exit 1; } + cat stderr >&2 + grep 'test: ' stderr && exit 1 + # Skip tests if the file system is not capable. + mkdir ./$c || continue + rmdir ./$c + ./install-sh -d $c/$c/$c + rm -rf ./$c + ./install-sh -d $c d5/$c/$c + test -d ./$c + test -d d5/$c/$c + ./install-sh x $c + test -f ./$c/x + rm -f ./$c/x + ./install-sh -t $c x + test -f ./$c/x + rm -rf ./$c + ( : > ./$c ) || continue + ./install-sh $c x d5/$c/$c + test -f d5/$c/$c/x + test -f d5/$c/$c/$c + rm -f d5/$c/$c/? + ./install-sh -t d5/$c/$c $c x + test -f d5/$c/$c/x + test -f d5/$c/$c/$c +done + +: diff --git a/t/instsh.sh b/t/instsh.sh deleted file mode 100644 index 33cf5f5aa..000000000 --- a/t/instsh.sh +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh -# Copyright (C) 1996-2013 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 2, 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 . - -# Test for this bug: -# automake: Makefile.am: required file "../../install-sh" not found; installing -# This also makes sure that install-sh is created in the correct directory. - -. test-init.sh - -: > Makefile.am -rm -f install-sh - -# Since the default path includes '../..', we must run this test in -# yet another subdir. -mkdir frob -mv Makefile.am configure.ac frob/ -cd frob - -$ACLOCAL -$AUTOMAKE --add-missing >output 2>&1 || { cat output; exit 1; } -cat output - -# Only one '/' should appear in the output. -grep '/.*/' output && exit 1 - -test -f install-sh - -: diff --git a/t/instsh2.sh b/t/instsh2.sh deleted file mode 100644 index 8a60d7435..000000000 --- a/t/instsh2.sh +++ /dev/null @@ -1,118 +0,0 @@ -#! /bin/sh -# Copyright (C) 2002-2013 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 2, 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 . - -# Various install-sh checks. - -am_create_testdir=empty -. test-init.sh - -get_shell_script install-sh - -# Basic errors. -./install-sh && exit 1 -./install-sh -m 644 dest && exit 1 - -# Directories. - -# It should be OK to create no directory. We sometimes need -# this when directory are conditionally defined. -./install-sh -d -# One directory. -./install-sh -d d0 -test -d d0 -# Multiple directories (for make installdirs). -./install-sh -d d1 d2 d3 d4 -test -d d1 -test -d d2 -test -d d3 -test -d d4 -# Subdirectories. -./install-sh -d p1/p2/p3 p4//p5//p6// -test -d p1/p2/p3 -test -d p4/p5/p6 - -# Files. -: > x -./install-sh -c -m 644 x y -test -f x -test -f y -./install-sh -m 644 y z -test -f y -test -f z -# Multiple files. -./install-sh -m 644 -c x z d1 -test -f x -test -f z -test -f d1/x -test -f d1/z -./install-sh -m 644 x z d2// -test -f x -test -f z -test -f d2/x -test -f d2/z -./install-sh -t d3 -m 644 x z -test -f x -test -f z -test -f d3/x -test -f d3/z -./install-sh -t d4// -m 644 x z -test -f x -test -f z -test -f d4/x -test -f d4/z -./install-sh -T x d3/y -test -f x -test -f d3/y -./install-sh -T x d3 && exit 1 -./install-sh -T x d4// && exit 1 - -# Ensure that install-sh works with names that include spaces. -touch 'a b' -mkdir 'x y' -./install-sh 'a b' 'x y' -test -f x\ \ y/a\ \ b -test -f 'a b' - -# Ensure we do not run into 'test' operator precedence bugs with Tru64 sh. -for c in = '(' ')' '!'; do - ./install-sh $c 2>stderr && { cat stderr >&2; exit 1; } - cat stderr >&2 - grep 'test: ' stderr && exit 1 - # Skip tests if the file system is not capable. - mkdir ./$c || continue - rmdir ./$c - ./install-sh -d $c/$c/$c - rm -rf ./$c - ./install-sh -d $c d5/$c/$c - test -d ./$c - test -d d5/$c/$c - ./install-sh x $c - test -f ./$c/x - rm -f ./$c/x - ./install-sh -t $c x - test -f ./$c/x - rm -rf ./$c - ( : > ./$c ) || continue - ./install-sh $c x d5/$c/$c - test -f d5/$c/$c/x - test -f d5/$c/$c/$c - rm -f d5/$c/$c/? - ./install-sh -t d5/$c/$c $c x - test -f d5/$c/$c/x - test -f d5/$c/$c/$c -done - -: diff --git a/t/instsh3.sh b/t/instsh3.sh deleted file mode 100644 index a53e21df7..000000000 --- a/t/instsh3.sh +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh -# Copyright (C) 2006-2013 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 2, 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 . - -# More install-sh checks: check -C. - -am_create_testdir=empty -required=non-root -. test-init.sh - -# Solaris /usr/ucb/touch does not accept -t. -touch -t "$old_timestamp" foo \ - || skip_ "touch utility doesn't accept '-t' option" - -get_shell_script install-sh - -./install-sh -d d1 - -# Do not change the timestamps when using -C. -echo foo >file -./install-sh -C file d1 -TZ=UTC0 touch -t $old_timestamp d1/file -./install-sh -C file d1 -is_newest file d1/file -echo foo1 >file -./install-sh -C file d1 -diff file d1/file -# Rights must be updated. -./install-sh -C -m 444 file d1 -test -r d1/file -test ! -w d1/file - -: diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 66b1220c6..54afd8f56 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -514,12 +514,12 @@ t/hfs.sh \ t/implicit.sh \ t/init.sh \ t/init2.sh \ -t/insh2.sh \ +t/dist-install-sh.sh \ t/dist-with-unreadable-makefile-fails.sh \ t/installdir.sh \ -t/instsh.sh \ -t/instsh2.sh \ -t/instsh3.sh \ +t/add-missing-install-sh.sh \ +t/install-sh-unittests.sh \ +t/install-sh-option-C.sh \ t/instdat.sh \ t/instdat2.sh \ t/instdir.sh \ -- cgit v1.2.1