bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7833: automake uses two different values for DejaGNU srcdir


From: Stefano Lattarini
Subject: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Sat, 5 Mar 2011 02:24:50 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Friday 04 March 2011, Ralf Wildenhues wrote:
> Hello Peter, all, and sorry for the delay,
> 
> * Peter Breitenlohner wrote on Sat, Jan 15, 2011 at 04:22:32PM CET:
> > On Fri, 14 Jan 2011, Ralf Wildenhues wrote:
> > 
> > >Through testing I found out again that DejaGNU does not cope with white
> > >space in absolute directory names anyway, regardless of srcdir being
> > >relative or absolute.  That obviates my first point.  Remains only the
> > >fairly minor src+build-tree relocatability point.
> 
> > I remember a problem with gcc's 'make check' that could be related.  Some
> > tests failed when `pwd -L` was different from `pwd -P`, presumably due to
> > the two different srcdir's.
> > 
> > I could avoid this problem by first doing 'cd `pwd -P`'.
> 
> Thanks for mentioning this.  I asked on the bug-dejagnu list back then,
> and have an answer now:
> http://thread.gmane.org/gmane.comp.sysutils.dejagnu.bugs/345/focus=348
> 
> I think we should change Automake semantics here and provide a relative
> srcdir only.  That would mean, the first patch I suggested in
> http://thread.gmane.org/gmane.comp.sysutils.automake.bugs/5230/focus=5464
> 
> Stefano, would you like to rewrite your testsuite addition for this?
>
I've adjusted my patch accordingly.  Please find the new attempt attached.
Is that ok for master?

Thanks,
  Stefano
From 20b42d43279aef4cf8a35d86b0ae28cf6b7eee0f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Thu, 13 Jan 2011 20:33:26 +0100
Subject: [PATCH] dejagnu: ensure 'srcdir' is defined as a relative directory

This change fixes automake bug#7833.

* lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
over calculating and using the absolute path of $(srcdir).
* tests/dejagnu-relative-srcdir.test: New test.
* tests/dejagnu-absolute-builddir.test: Likewise.
* tests/Makefile.am (TESTS): Update.

Report by Ian Lance Taylor.  Suggestions by Ralf Wildenhues.
---
 ChangeLog                            |   11 ++++
 lib/am/dejagnu.am                    |    4 +-
 tests/Makefile.am                    |    2 +
 tests/Makefile.in                    |    1 +
 tests/dejagnu-absolute-builddir.test |   62 ++++++++++++++++++++++++
 tests/dejagnu-relative-srcdir.test   |   85 ++++++++++++++++++++++++++++++++++
 6 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100755 tests/dejagnu-absolute-builddir.test
 create mode 100755 tests/dejagnu-relative-srcdir.test

diff --git a/ChangeLog b/ChangeLog
index 991ed0b..c774f7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-03-05  Stefano Lattarini  <address@hidden>
+
+       dejagnu: ensure 'srcdir' is defined as a relative directory
+       This change fixes automake bug#7833.
+       * lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
+       over calculating and using the absolute path of $(srcdir).
+       * tests/dejagnu-relative-srcdir.test: New test.
+       * tests/dejagnu-absolute-builddir.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       Report by Ian Lance Taylor.  Suggestions by Ralf Wildenhues.
+
 2011-03-04  Stefano Lattarini  <address@hidden>
 
        tests: fix bug (comments-in-var-defn.test + autoconf 2.62)
diff --git a/lib/am/dejagnu.am b/lib/am/dejagnu.am
index 08de45c..5c5da50 100644
--- a/lib/am/dejagnu.am
+++ b/lib/am/dejagnu.am
@@ -44,7 +44,7 @@ endif ! %?CYGNUS%
 .PHONY: check-DEJAGNU
 check-DEJAGNU: site.exp
 ## Life is easiest with an absolute srcdir, so do that.
-       srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+       srcdir='$(srcdir)'; export srcdir; \
        EXPECT=$(EXPECT); export EXPECT; \
 ## Allow this to work when expect and DejaGnu are in tree.
 ## Only required when --cygnus in force.
@@ -77,7 +77,7 @@ site.exp: Makefile
        @echo '## these variables are automatically generated by make ##' 
>site.tmp
        @echo '# Do not edit here.  If you wish to override these values' 
>>site.tmp
        @echo '# edit the last section' >>site.tmp
-       @echo 'set srcdir $(srcdir)' >>site.tmp
+       @echo 'set srcdir "$(srcdir)"' >>site.tmp
        @echo "set objdir `pwd`" >>site.tmp
 ## Quote the *_alias variables because they might be empty.
 ?BUILD?        @echo 'set build_alias "$(build_alias)"' >>site.tmp
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3fdb90a..b51b52d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -266,6 +266,8 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index cd00833..3b327ca 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -536,6 +536,7 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-dirs.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
diff --git a/tests/dejagnu-absolute-builddir.test 
b/tests/dejagnu-absolute-builddir.test
new file mode 100755
index 0000000..ad9578f
--- /dev/null
+++ b/tests/dejagnu-absolute-builddir.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that DejaGnu testsuites have 'objdir' defined (as a TCL variable)
+# to an absolute path.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = tcl.test/tcl.exp
+END
+
+mkdir tcl.test
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_objdir: $objdir\n"
+if { [ regexp "^/" $objdir ] } {
+    pass "test_tcl_objdir"
+} else {
+    fail "test_tcl_objdir"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
diff --git a/tests/dejagnu-relative-srcdir.test 
b/tests/dejagnu-relative-srcdir.test
new file mode 100755
index 0000000..14ddbc6
--- /dev/null
+++ b/tests/dejagnu-relative-srcdir.test
@@ -0,0 +1,85 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that DejaGnu testsuites have 'srcdir' defined to a relative path
+# (both as TCL variable and as environment variable).
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
+END
+
+mkdir env.test tcl.test lib
+
+# DejaGnu can change $srcdir behind our backs, so we have to
+# save its original value.
+cat > lib/tcl.exp << 'END'
+send_user "tcl_lib_srcdir: $srcdir\n"
+set orig_srcdir $srcdir
+END
+
+cat > env.test/env.exp << 'END'
+set env_srcdir $env(srcdir)
+send_user "env_srcdir: $env_srcdir\n"
+if { [ regexp "^\.\.?$" $env_srcdir ] } {
+    pass "test_env_src"
+} else {
+    fail "test_env_src"
+}
+END
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_srcdir: $srcdir\n"
+if { [ regexp "^\.\.?$" $srcdir ] } {
+    pass "test_tcl_src"
+} else {
+    fail "test_tcl_src"
+}
+send_user "tcl_orig_srcdir: $orig_srcdir\n"
+if { [ regexp "^\.\.?$" $orig_srcdir ] } {
+    pass "test_tcl_orig_src"
+} else {
+    fail "test_tcl_orig_src"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --srcdir=.
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
-- 
1.7.2.3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]