[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] {master} cscope: is only expected to work with GNU make in VPATH
From: |
Stefano Lattarini |
Subject: |
[PATCH] {master} cscope: is only expected to work with GNU make in VPATH setup |
Date: |
Wed, 15 Feb 2012 10:28:00 +0100 |
The 'cscope' functionality does not properly handle VPATH rewrites;
so we explicitly document that, for now, it is only ensured to work
with GNU make when doing a VPATH build, and we adjust testsuite
requirements accordingly.
Issue revealed by a failure of 'cscope.test' with Solaris 10 CCS
make.
* doc/automake.texi (Tags): Document the limitations of the cscope
support. Couple of fixlets to formatting since we are at it.
* tests/cscope.test: Converted to TAP, and thus moved ...
* tests/cscope.tap: ... here. Only run tests with VPATH builds when
using GNU make. Adjust so that no C, C++, Fortran or Java compiler,
nor any Emacs program, will be required to run this test.
* tests/list-of-tests.mk: Adjust.
---
And this change fixes the last failure I was seeing with Solaris 10
CCS make. I will push shortly if there is no objcetion.
Regards,
Stefano
doc/automake.texi | 8 ++-
tests/cscope.tap | 168 ++++++++++++++++++++++++++++++++++++++++++++++++
tests/cscope.test | 107 ------------------------------
tests/list-of-tests.mk | 2 +-
4 files changed, 175 insertions(+), 110 deletions(-)
create mode 100755 tests/cscope.tap
delete mode 100755 tests/cscope.test
diff --git a/doc/automake.texi b/doc/automake.texi
index 9c148f9..164ac1b 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -10350,10 +10350,10 @@ is the name of the program to invoke (by default
@command{ctags});
@code{CTAGSFLAGS} can be used by the user to pass additional flags,
and @code{AM_CTAGSFLAGS} can be used by the @file{Makefile.am}.
address@hidden id
Automake will also generate an @code{ID} rule that will run
@command{mkid} on the source. This is only supported on a
directory-by-directory basis.
address@hidden id
Similarly, the @code{cscope} rule will create a list of all the source
files in the tree and run @command{cscope} to build an inverted index
@@ -10361,7 +10361,11 @@ database. The variable @code{CSCOPE} is the name of
the program to invoke
(by default @command{cscope}); @code{CSCOPEFLAGS} and
@code{CSCOPE_ARGS} can be used by the user to pass additional flags and
file names respectively, while @code{AM_CSCOPEFLAGS} can be used by the
address@hidden
address@hidden Note that, currently, the Automake-provided
address@hidden support, when used in a VPATH build, might not work well
+with non-GNU make implementations (especially with make implementations
+performing @xref{Automatic Rule Rewriting, , VPATH rewrites, autoconf,
+The Autoconf Manual}).
Finally, Automake also emits rules to support the
@uref{http://www.gnu.org/software/global/, GNU Global Tags program}.
diff --git a/tests/cscope.tap b/tests/cscope.tap
new file mode 100755
index 0000000..0269dff
--- /dev/null
+++ b/tests/cscope.tap
@@ -0,0 +1,168 @@
+#! /bin/sh
+# Copyright (C) 2009, 2010, 2011, 2012 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/>.
+
+# Test cscope functionality.
+
+. ./defs || Exit 1
+
+plan_ 18
+
+ocwd=`pwd` || fatal_ "getting top-level directory"
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_SUBST([CC], [who-cares])
+AC_SUBST([CXX], [who-cares])
+AC_SUBST([FC], [who-cares])
+AC_SUBST([GCJ], [who-cares])
+AM_PATH_LISPDIR
+AC_OUTPUT
+END
+
+mkdir sub sub/subsub
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c bar.cpp baz.f90
+lisp_LISP = foo.el
+EXTRA_DIST = foo.el
+END
+
+cat > sub/Makefile.am <<'END'
+bin_PROGRAMS = bar
+bar_SOURCES = subsub/dist.c
+nodist_bar_SOURCES = subsub/gen.c
+subsub/gen.c:
+ $(MKDIR_P) subsub
+ echo 'int generated_subsub () { return 0; }' > $@
+CLEANFILES = subsub/gen.c
+END
+
+echo 'int foo_func () { return 0; }' > foo.c
+echo 'int main () { return 0; }' > bar.cpp
+cat > baz.f90 <<'END'
+ subroutine baz
+ end
+END
+: > foo.el
+echo 'int main () { return 0; }' > sub/subsub/dist.c
+
+$ACLOCAL || fatal_ "aclocal failed"
+$AUTOCONF || fatal_ "autoconf failed"
+$AUTOMAKE -i -a || fatal_ "automake -i -a failed"
+
+# Sun cscope is interactive without redirection.
+if cscope --version </dev/null; then
+ have_cscope=yes
+else
+ have_cscope=no
+fi
+
+test_cleanup ()
+{
+ r=ok
+ if test -f configure; then
+ # In-tree build.
+ $MAKE distclean
+ else
+ # VPATH build.
+ $MAKE distcleancheck
+ fi \
+ && test ! -f cscope.files \
+ && test ! -f cscope.out \
+ && test ! -f cscope.in.out \
+ && test ! -f cscope.po.out \
+ || r='not ok'
+ result_ "$r" "[$pfx] make distcheck"
+}
+
+test_cscope ()
+{
+ r=ok
+ $MAKE -n cscope || r='not ok'
+ result_ "$r" "[$pfx] make -n cscope"
+
+ if test $have_cscope = no; then
+ # For later tests.
+ touch cscope.files cscope.out cscope.in.out cscope.po.out
+ skip_row_ 3 -r "no cscope program avaiable"
+ return 0
+ fi
+
+ r=ok
+ $MAKE cscope 2>stderr || r='not ok'
+ cat stderr >&2
+ grep 'cannot find file' stderr && r='not ok'
+ rm -f stderr
+ result_ "$r" "[$pfx] make cscope"
+
+ r=ok
+ test -f cscope.files \
+ && $FGREP foo.c cscope.files \
+ && $FGREP bar.cpp cscope.files \
+ && $FGREP sub/subsub/dist.c cscope.files \
+ && $FGREP sub/subsub/gen.c cscope.files \
+ || r='not ok'
+ result_ "$r" "[$pfx] cscope.files looks correct"
+
+ r=ok
+ # cscope.files might not exist of the earlier "make cscope" failed.
+ cp cscope.files cscope.files1 \
+ && $MAKE cscope \
+ && diff cscope.files cscope.files1 \
+ || r='not ok'
+ rm -f cscope.files1
+ result_ "$r" "[$pfx] second \"make cscope\" is consistent"
+}
+
+my_configure ()
+{
+ command_ok_ "[$pfx] configure" \
+ "$1"/configure EMACS=no --with-lispdir=/who/cares
+}
+
+if using_gmake; then
+
+ cd "$ocwd"
+ pfx="relative VPATH"
+ mkdir build
+ cd build
+ my_configure ..
+ test_cscope
+ test_cleanup
+
+ cd "$ocwd"
+ pfx="absolute VPATH"
+ mkdir build2
+ cd build2
+ my_configure "$ocwd"
+ test_cscope
+ test_cleanup
+
+else
+
+ skip_row_ 12 -r "cscope in VPATH required GNU make"
+
+fi
+
+cd "$ocwd"
+pfx="in-tree build"
+my_configure .
+test_cscope
+test_cleanup
+
+:
diff --git a/tests/cscope.test b/tests/cscope.test
deleted file mode 100755
index 859653b..0000000
--- a/tests/cscope.test
+++ /dev/null
@@ -1,107 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2009, 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/>.
-
-# Test cscope functionality.
-
-required=
-. ./defs || Exit 1
-
-cat >> configure.in << 'END'
-AC_CONFIG_FILES([sub/Makefile])
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_FC
-AM_PROG_GCJ
-AM_PATH_LISPDIR
-AC_OUTPUT
-END
-
-mkdir sub sub/subsub
-
-cat >Makefile.am <<'END'
-SUBDIRS = sub
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c bar.cpp baz.f90
-lisp_LISP = foo.el
-EXTRA_DIST = foo.el
-END
-
-cat >sub/Makefile.am <<'END'
-bin_PROGRAMS = bar
-bar_SOURCES = subsub/dist.c
-nodist_bar_SOURCES = subsub/gen.c
-subsub/gen.c:
- $(MKDIR_P) subsub
- echo 'int generated_subsub () { return 0; }' > $@
-CLEANFILES = subsub/gen.c
-END
-
-echo 'int foo_func () { return 0; }' > foo.c
-echo 'int main () { return 0; }' > bar.cpp
-cat > baz.f90 <<'END'
- subroutine baz
- end
-END
-: >foo.el
-echo 'int main () { return 0; }' > sub/subsub/dist.c
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
-
-mkdir build
-cd build
-../configure || Exit 77
-
-$MAKE -n cscope
-
-: ${CSCOPE=cscope}
-( $CSCOPE --version ) >/dev/null 2>&1 || Exit 77
-
-$MAKE cscope 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'cannot find file' stderr && Exit 1
-
-test -f cscope.files
-$FGREP foo.c cscope.files
-$FGREP bar.cpp cscope.files
-$FGREP sub/subsub/dist.c cscope.files
-$FGREP sub/subsub/gen.c cscope.files
-
-cp cscope.files cscope.files1
-$MAKE cscope
-diff cscope.files cscope.files1
-
-$MAKE distclean
-test ! -f cscope.files
-test ! -f cscope.out
-test ! -f cscope.in.out
-test ! -f cscope.po.out
-
-
-`pwd`/../configure || Exit 77
-
-$MAKE cscope 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'cannot find file' stderr && Exit 1
-$MAKE || Exit 77
-$MAKE distclean
-
-cd ..
-./configure
-$MAKE distcheck
-
-:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index c726bde..05264d7 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -287,7 +287,7 @@ confsub.test \
confvar.test \
confvar2.test \
copy.test \
-cscope.test \
+cscope.tap \
cscope2.test \
cscope3.test \
cxx.test \
--
1.7.7.3
- [PATCH] {master} cscope: is only expected to work with GNU make in VPATH setup,
Stefano Lattarini <=