>From 5cf501dd932b4aabcc60b489e4f19c2ad8a757cc Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Thu, 13 Apr 2017 14:19:15 +0200 Subject: [PATCH 2/3] Test that should pass. The test ensures that programs with equal names get unique object files even if object file name truncation is in effect. --- t/list-of-tests.mk | 1 + t/subobj-objname-clash.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 t/subobj-objname-clash.sh diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 1e9f86f48..1a8302805 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -1063,6 +1063,7 @@ t/subobjname.sh \ t/subobj-clean-pr10697.sh \ t/subobj-clean-lt-pr10697.sh \ t/subobj-indir-pr13928.sh \ +t/subobj-objname-clash.sh \ t/subobj-vpath-pr13928.sh \ t/subobj-pr13928-more-langs.sh \ t/subpkg.sh \ diff --git a/t/subobj-objname-clash.sh b/t/subobj-objname-clash.sh new file mode 100644 index 000000000..e747037f0 --- /dev/null +++ b/t/subobj-objname-clash.sh @@ -0,0 +1,58 @@ +#! /bin/sh +# Copyright (C) 1996-2017 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 . + +# Make sure that object names don't clash when using subdir-objects. + +. test-init.sh + +mkdir -p src + +cat >> configure.ac << 'END' +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects foreign +noinst_PROGRAMS = foo +foo_SOURCES = src/foo.c +foo_CPPFLAGS = -DVAL=0 +include src/local.mk +END + +cat > src/local.mk << 'END' +noinst_PROGRAMS += src/foo +src_foo_CPPFLAGS = -DVAL=1 +src_foo_SOURCES = src/foo.c +END + +cat > src/foo.c << 'END' +int +main () +{ + return VAL; +} +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE --add-missing + +./configure +$MAKE +./foo || fail_ "./foo should return 0" +./src/foo && fail_ "./src/foo should return 1" +$MAKE clean -- 2.12.2