Hash :
38e1b39d
Author :
Date :
2011-11-03T13:50:06
Merge branch 'msvc' into master Commits merged from msvc: - tests: few improvements to some `ar-lib' related tests - warnings: new 'extra-portability' category, for AM_PROG_AR - ar-lib: new 'AM_PROG_AR' macro, triggering the 'ar-lib' script Extra changes required by the testsuite: * tests/instspc-tests.sh: Adjust to new portability requirements due to the new AM_PROG_AR macro. * tests/libobj-basic.test: Likewise. * tests/libobj2.test: Likewise. * tests/libobj15a.test: Likewise. * tests/libobj15b.test: Likewise. * tests/libobj15c.test: Likewise. * tests/libobj16a.test: Likewise. * tests/libobj16b.test: Likewise. * tests/libobj17.test: Likewise. * tests/libobj18.test: Likewise. * tests/libobj19.test: Likewise. * tests/libobj20a.test: Likewise. * tests/libobj20b.test: Likewise. * tests/libobj20c.test: Likewise. * tests/canon6.test: Likewise. * tests/canon6.test: Likewise. * tests/canon7.tests: Likewise. * tests/extra9.test: Likewise. * tests/extradep.test: Likewise. * tests/extradep2.test: Likewise. * tests/posixsubst-ldadd.test: Likewise. * tests/posixsubst-libraries.test: Likewise. * tests/posixsubst-ltlibraries.test: Likewise. * tests/python-virtualenv.test: Likewise. * tests/vartypos.test: Likewise. * tests/vartypo2.test: Likewise. * tests/suffix.test: Update to take into account previous master-only changes. * tests/suffix2.test: Likewise. * tests/libobj7.test: Call automake with the `--add-missing' option, instead of creating a dummy `ar-lib' file, since this test now also runs "./configure" and "make". * tests/suffix5.test: Copy the real `ar-lib' script file, instead of creating a dummy one, since this test now also runs "./configure" and "make". * tests/extra-portability2.test: Fix this test not to rely on the older, faulty semantics of "strictness specification always reset warning level", which has been fixed in commit v1.11-623-g1609491 (see also automake bug#7669 a.k.a. PR/547). Since we are at it, throw inf few other minor unrelated improvements. * tests/extra-portability.test: Explicitly pass `-Wall' to automake calls, for clarity.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
#! /bin/sh
# Copyright (C) 2010, 2011 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 <http://www.gnu.org/licenses/>.
#
# Driver script to generate and run tests checking that building from,
# or installing to, directories with shell metacharacters succeed.
#
# Original report from James Amundson about file names with spaces.
# Other characters added by Paul Eggert.
#
# This script fulfills a threefold role:
# 1. It generates a Makefile.am snippet, containing the definition
# of proper lists of tests.
# 2. It sets up a directory containing some common data files and
# autotools-generated files used by said generated tests (this
# is done for speed reasons only).
# 3. It is sourced by said generated tests with proper parameters
# pre-set, to run the "meat" of the checks.
# This setup might seem a tricky and over-engineered abuse, but past
# (painful) experiences showed that it is indeed required, because
# the test generation code and test execution code tend to be
# inextricably coupled and intertwined.
#
# Be more Bourne compatible (snippet copied from `tests/defs').
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
set -e
# Sanity and usage checks.
if test x"$instspc_action" = x; then
if test "$#,$1" = "1,--generate-makefile"; then
instspc_action=generate-makefile
else
echo "$0: empty action and no proper command line" >&2
exit 99
fi
elif test $# -gt 0; then
echo "$0: action specified and command line arguments used" >&2
exit 99
fi
case $instspc_action in
generate-makefile|generate-data)
;;
test-build|test-install)
if test x"$instspc_test_name" = x; then
echo "$0: test name undefined for action '$instspc_action'" >&2
exit 99
fi
;;
*)
echo "$0: invalid action: '$instspc_action'"
exit 99
;;
esac
# Helper subroutine for test data definition.
# Usage: define_problematic_string NAME STRING
define_problematic_string ()
{
tst=$1
shift
eval "instspc__$tst=\$1" || exit 99
shift
instspc_names_list="$instspc_names_list $tst"
# Some of the "problematic" characters cannot be used in the name of
# a build or install directory on a POSIX host. These lists should
# be empty, but are not due to limitations in Autoconf, Automake, Make,
# M4, or the shell.
case " $* " in *' fail-build '*|*' build-fail '*)
instspc_xfail_builds_list="$instspc_xfail_builds_list $tst";;
esac
case " $* " in *' fail-install '*|*' install-fail '*)
instspc_xfail_installs_list="$instspc_xfail_installs_list $tst";;
esac
}
# Helper subroutines for creation of input data files.
create_input_data ()
{
mkdir sub
unindent > configure.in << 'EOF'
AC_INIT([instspc], [1.0])
AM_INIT_AUTOMAKE
AC_CONFIG_FILES([Makefile])
AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_AR
AC_OUTPUT
EOF
: > sub/base.h
: > sub/nobase.h
: > sub/base.dat
: > sub/nobase.dat
: > sub/base.sh
: > sub/nobase.sh
unindent > source.c << 'EOF'
int
main (int argc, char **argv)
{
return 0;
}
EOF
unindent > Makefile.am << 'EOF'
foodir = $(prefix)/foo
fooexecdir = $(prefix)/foo
foo_HEADERS = sub/base.h
nobase_foo_HEADERS = sub/nobase.h
dist_foo_DATA = sub/base.dat
nobase_dist_foo_DATA = sub/nobase.dat
dist_fooexec_SCRIPTS = sub/base.sh
nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
fooexec_PROGRAMS = sub/base
nobase_fooexec_PROGRAMS = sub/nobase
sub_base_SOURCES = source.c
sub_nobase_SOURCES = source.c
fooexec_LIBRARIES = sub/libbase.a
nobase_fooexec_LIBRARIES = sub/libnobase.a
sub_libbase_a_SOURCES = source.c
sub_libnobase_a_SOURCES = source.c
.PHONY: test-install-sep
test-install-sep: install
test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h'
test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h'
test -f '$(DESTDIR)/$(file)-prefix/foo/base.h'
test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat'
test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat'
test -f '$(DESTDIR)/$(file)-prefix/foo/base.dat'
test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh'
test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh'
test -f '$(DESTDIR)/$(file)-prefix/foo/base.sh'
test -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)'
test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)'
test -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)'
test -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a'
test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a'
test -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a'
EOF
$ACLOCAL
$AUTOCONF
$AUTOMAKE -a
: > success
}
# Be sure to avoid interferences from the environment.
instspc_names_list=''
instspc_xfail_builds_list=''
instspc_xfail_installs_list=''
# ================= #
# Test data begin #
# ----------------- #
# Some control characters that are white space.
bs='' # back space
cr='
' # carriage return
ff='' # form feed
ht=' ' # horizontal tab
lf='
' # line feed (aka newline)
# Hack to save typing and make code visually clearer.
def=define_problematic_string
$def squote \' fail-build fail-install
$def dquote '"' fail-build fail-install
$def bquote '`' fail-build fail-install
$def sharp '#' fail-build fail-install
$def dollar '$' fail-build fail-install
$def bang '!'
$def bslash '\' fail-build
$def ampersand '&' fail-build
$def percent '%'
$def leftpar '('
$def rightpar ')'
$def pipe '|'
$def caret '^'
$def tilde '~'
$def qmark '?'
$def star '*'
$def plus '+'
$def minus '-'
$def comma ','
$def colon ':'
$def semicol ';'
$def equal '='
$def less '<'
$def more '>'
$def at '@'
$def lqbrack '['
$def rqbrack ']'
$def lcbrack '{'
$def rcbrack '}'
$def space ' '
$def tab "$ht"
$def linefeed "$lf" fail-build fail-install
$def backspace "$bs"
$def formfeed "$ff"
$def carriageret "$cr"
$def quadrigraph0 '@&t@' fail-build
$def quadrigraph1 '@<:@'
$def quadrigraph2 '@:>@'
$def quadrigraph3 '@S|@'
$def quadrigraph4 '@%:@'
$def a_b 'a b'
$def a__b 'a b'
$def a_lf_b "a${lf}b" fail-build fail-install
$def dotdotdot '...'
$def dosdrive 'a:'
$def miscglob1 '?[a-z]*'
$def miscglob2 '.*?[0-9]'
unset def
# --------------- #
# Test data end #
# =============== #
if test x"$instspc_action" = x"generate-makefile"; then
# We must generate a makefile fragment on stdout. It must refer
# to all tests at once, hence the loop below.
echo '## Generated by instspc-tests.sh. DO NOT EDIT!'
echo 'instspc_tests ='
echo 'instspc_xfail_tests ='
for test_name in $instspc_names_list; do
echo "instspc_tests += instspc-$test_name-build.test"
echo "instspc_tests += instspc-$test_name-install.test"
done
for test_name in $instspc_xfail_builds_list; do
echo "instspc_xfail_tests += instspc-$test_name-build.test"
done
for test_name in $instspc_xfail_installs_list; do
echo "instspc_xfail_tests += instspc-$test_name-install.test"
done
exit 0
fi
# We'll need the full setup provided by `tests/defs'. Temporarily disable
# the errexit flag, since the setup code might not be prepared to deal
# with it.
set +e
. ./defs || Exit 99
set -e
# The directory set up by the `generate-data' action should contain all
# the files we need. So remove the other files created by ./defs. And
# check we really are in a temporary `*.dir' directory in the build tree,
# since the last thing we want is to remove some random user files!
test -f ../defs-static && test -f ../defs || Exit 99
case `pwd` in *.dir);; *) Exit 99;; esac
rm -f *
if test x"$instspc_action" = x"generate-data"; then
# We must *not* remove the test directory, since its contents must be
# used by following dependent tests.
keep_testdirs=yes
create_input_data
Exit 0
fi
### If we are still here, we have to run a test ...
eval "instspc_test_string=\${instspc__$instspc_test_name}" || Exit 99
if test x"$instspc_test_string" = x; then
echo "$me: invalid test name: '$instspc_test_name'" >&2
Exit 99
fi
test -f ../instspc-data.dir/success || {
echo "$me: setup by instspc-data.test failed" >&2
Exit 99
}
# Skip if this system doesn't support these characters in file names.
mkdir "./$instspc_test_string" || Exit 77
case $instspc_action in
test-build)
dest=`pwd`/_dest
relbuilddir=../..
cd "./$instspc_test_string"
;;
test-install)
dest=`pwd`/$instspc_test_string
relbuilddir=..
;;
*)
echo "$me: internal error: invalid action '$instspc_action'"
Exit 99
;;
esac
$relbuilddir/instspc-data.dir/configure \
--prefix "/$instspc_test_string-prefix"
$MAKE
# Some make implementations eliminate leading and trailing whitespace
# from macros passed on the command line, and some eliminate leading
# whitespace from macros set from environment variables, so prepend
# './' and use the latter here.
# Tru64 sh -e needs '|| Exit' in order to work correctly.
DESTDIR="$dest" file="./$instspc_test_string" $MAKE -e test-install-sep \
|| Exit 1
: