gparted/tests/Makefile.am

38 lines
1.0 KiB
Makefile
Raw Normal View History

AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/gtest/include \
$(GTEST_CPPFLAGS)
AM_CXXFLAGS = -Wall $(GTEST_CXXFLAGS)
AM_LDFLAGS = $(GTEST_LDFLAGS)
LDADD = \
Fix make distcheck failure from missing libgtest_main.la (#781978) Running 'make distcheck' fails like this: [...] make[3]: Entering directory `[...]/gparted/gparted-0.28.1-git/_build/tests' [...] /bin/sh ../libtool --tag=CXX --mode=link g++ [...] ../../lib/gtest/lib/libgtest_main.la ../../lib/gtest/lib/libgtest.la [...] libtool: link: cannot find the library `../../lib/gtest/lib/libgtest_main.la' or unhandled argument `../../lib/gtest/lib/libgtest_main.la' make[3]: *** [test_dummy] Error 1 make[3]: Leaving directory `[...]/gparted/gparted-0.28.1-git/_build/tests' [...] make[1]: Leaving directory `[...]/gparted/gparted-0.28.1-git/_build' make: *** [distcheck] Error 1 What is happening is that distcheck [1] performs a VPATH build which uses separate read-only source and read-write build trees. Shipped source files, such as .h and .cc, are located in the source tree and the built files, such as .o and .la, are compiled into the build tree. In this case the absolute path to libgtest_main.la is specified using $(top_srcdir) for the source tree, rather than $(top_builddir) for the build tree, hence the cannot find file type error. This error doesn't occur when just performing a 'make check' because that builds in the source tree so $(top_builddir) is the same as $(top_srcdir). Fix by correctly specifying the absolute path to the libgtest*.la files using $(top_builddir). [1] Automake Manual, 14.4 Checking the Distribution https://www.gnu.org/software/automake/manual/automake.html#Checking-the-Distribution Note that for VPATH builds the Automake Manual [2] also recommends using a pair of -I options to specify header files are found in both the build and source trees, something like: AM_CPPFLAGS = -I$(top_builddir)/some/subdir -I$(top_srcdir)/some/subdir This is unnecessary for GParted as all header files are shipped as part of the source archive and no header files are created as part of the build process. Therefore adding -I options specifying $(top_builddir) include directories would just be specifying empty or non-existent include directories in the build tree. [2] Automake Manual, 8.7 Variables used when building a program https://www.gnu.org/software/automake/manual/automake.html#Program-Variables Bug 781978 - Add Google Test C++ test framework
2017-05-10 04:00:59 -06:00
$(GTEST_LIBS) \
$(top_builddir)/lib/gtest/lib/libgtest_main.la \
$(top_builddir)/lib/gtest/lib/libgtest.la
# Programs to be built by "make check"
check_PROGRAMS = \
test_dummy \
test_BlockSpecial \
test_PasswordRAMStore \
test_PipeCapture
# Test cases to be run by "make check"
TESTS = $(check_PROGRAMS)
test_dummy_SOURCES = test_dummy.cc
Fix make distcheck build failing with missing *.Po files (#785308) Make distcheck is failing like: <snip> Make distcheck Making distclean in tests make[2]: Entering directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:658: ../src/.deps/BlockSpecial.Po: No such file or directory Makefile:659: ../src/.deps/PipeCapture.Po: No such file or directory make[2]: *** No rule to make target '../src/.deps/PipeCapture.Po'. Stop. make[2]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:596: recipe for target 'distclean-recursive' failed make[1]: *** [distclean-recursive] Error 1 make[1]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub' Makefile:805: recipe for target 'distcheck' failed make: *** [distcheck] Error 1 Make distcheck started failing like this with this commit: f31808989ab7562ad411911c8b2dc16958708be8 Silence subdir-objects warning from automake 1.14 (#781978) However, also need to be referring to source files from a sibling directory like this from tests/Makefile.am: test_BlockSpecial_SOURCES = test_BlockSpecial.cc ../src/BlockSpecial.cc ^^^^^^^ First introduced by this commit: c37be28148ec6c6b2b9be4cf097f4d20513c9a14 Add unit tests for BlockSpecial constructors and internal caching (#781978) This failure, if not exactly common, has been seen a number of times before. Using this hint from a GNU Automake forum post: converting to subdir-objects http://gnu-automake.7480.n7.nabble.com/converting-to-subdir-objects-td21724.html "I had the same issue and wouldn't care unless Automake 1.15 started to warn about "source file in a subdirectory". In my case 'bar.o' is also built from 'foo/Makefile' so I decided to skip using 'bar.c' as SOURCE and instead link in 'foo/bar.o'. http://dev.thep.lu.se/svndigest/changeset/1581 Cheers, Peter " Fix by avoiding referring to source files from a sibling directory when building the unit test programs, instead refer to object files instead. Note that the automake subdir-objects option is still required to silence the warning because of the use of source files in subdirectories by lib/gtest/Makefile.am. Bug 785308 - make distcheck fails with *.Po: No such file or directory
2017-07-23 04:08:39 -06:00
test_BlockSpecial_SOURCES = test_BlockSpecial.cc
test_BlockSpecial_LDADD = \
$(top_builddir)/src/BlockSpecial.$(OBJEXT) \
$(LDADD)
test_PasswordRAMStore_SOURCES = test_PasswordRAMStore.cc
test_PasswordRAMStore_LDADD = \
$(top_builddir)/src/PasswordRAMStore.$(OBJEXT) \
$(LDADD)
Fix make distcheck build failing with missing *.Po files (#785308) Make distcheck is failing like: <snip> Make distcheck Making distclean in tests make[2]: Entering directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:658: ../src/.deps/BlockSpecial.Po: No such file or directory Makefile:659: ../src/.deps/PipeCapture.Po: No such file or directory make[2]: *** No rule to make target '../src/.deps/PipeCapture.Po'. Stop. make[2]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests' Makefile:596: recipe for target 'distclean-recursive' failed make[1]: *** [distclean-recursive] Error 1 make[1]: Leaving directory '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub' Makefile:805: recipe for target 'distcheck' failed make: *** [distcheck] Error 1 Make distcheck started failing like this with this commit: f31808989ab7562ad411911c8b2dc16958708be8 Silence subdir-objects warning from automake 1.14 (#781978) However, also need to be referring to source files from a sibling directory like this from tests/Makefile.am: test_BlockSpecial_SOURCES = test_BlockSpecial.cc ../src/BlockSpecial.cc ^^^^^^^ First introduced by this commit: c37be28148ec6c6b2b9be4cf097f4d20513c9a14 Add unit tests for BlockSpecial constructors and internal caching (#781978) This failure, if not exactly common, has been seen a number of times before. Using this hint from a GNU Automake forum post: converting to subdir-objects http://gnu-automake.7480.n7.nabble.com/converting-to-subdir-objects-td21724.html "I had the same issue and wouldn't care unless Automake 1.15 started to warn about "source file in a subdirectory". In my case 'bar.o' is also built from 'foo/Makefile' so I decided to skip using 'bar.c' as SOURCE and instead link in 'foo/bar.o'. http://dev.thep.lu.se/svndigest/changeset/1581 Cheers, Peter " Fix by avoiding referring to source files from a sibling directory when building the unit test programs, instead refer to object files instead. Note that the automake subdir-objects option is still required to silence the warning because of the use of source files in subdirectories by lib/gtest/Makefile.am. Bug 785308 - make distcheck fails with *.Po: No such file or directory
2017-07-23 04:08:39 -06:00
test_PipeCapture_SOURCES = test_PipeCapture.cc
test_PipeCapture_LDADD = \
$(top_builddir)/src/PipeCapture.$(OBJEXT) \
$(LDADD)