automake-patches
[Top][All Lists]
Advanced

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

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


From: Stefano Lattarini
Subject: Re: bug#7833: automake uses two different values for DejaGNU srcdir
Date: Wed, 19 Oct 2011 10:41:45 +0200
User-agent: KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; )

Reference:
  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7873>

I've rebased my patch on the "fixup" commit `v1.11-250-g0c0b402', and
I will merge it to maint (and push) in a couple of days if there is
no objection by then.  The updated patch is attached, for reference.

Regards,
  Stefano
From ded01c88c9579656cc138ce7e0b55dcf025b1a5a Mon Sep 17 00:00:00 2001
Message-Id: <address@hidden>
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                    |    2 +
 tests/dejagnu-absolute-builddir.test |   62 ++++++++++++++++++++++++
 tests/dejagnu-relative-srcdir.test   |   86 ++++++++++++++++++++++++++++++++++
 6 files changed, 165 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 8884b59..bcee2a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-10-19  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.
+
 2010-12-13  Ralf Wildenhues  <address@hidden>
 
        Fix testsuite failure of check12.test without DejaGNU.
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 3f40361..e83f06b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -255,6 +255,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 40b4697..880bfbe 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -523,6 +523,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/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..8a70d58
--- /dev/null
+++ b/tests/dejagnu-relative-srcdir.test
@@ -0,0 +1,86 @@
+#! /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.  Thanks to Ian Lance Taylor for the
+# suggestion.
+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]