From 6dd1aabba015d9d865f31acf8da4b7bdac6863c1 Mon Sep 17 00:00:00 2001 From: "csilvers+ctemplate@google.com" Date: Thu, 28 Jul 2011 07:45:12 +0000 Subject: [PATCH] compile_test wasn't testing what I wanted: because it ran in the main ctemplate source tree, it had access to files that weren't going to be installed, when the whole point it to test this can compile against the installed ctemplate. To resolve this, I added a new rule that's executed at install time (or the 'install' done during 'make distcheck'). I've verified that this finds the problems with the current ctemplate distribution that compile_test was supposed to capture, and that are reported in http://code.google.com/p/google-ctemplate/issues/detail?id=79 While in the area, add a few files that aren't in the dist tarball but should be. MOE noticed these. R=jad DELTA=11 (10 added, 0 deleted, 1 changed) Revision created by MOE tool push_codebase. MOE_MIGRATION=2766 --- Makefile.am | 12 +++++++++++- Makefile.in | 24 +++++++++++++++++------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index a64fee5..542e0f0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -234,6 +234,15 @@ compile_nothreads_test_SOURCES = $(compile_test_SOURCES) compile_nothreads_test_CXXFLAGS = -DNO_THREADS $(AM_CXXFLAGS) compile_nothreads_test_LDADD = libctemplate_nothreads_debug.la +# With compile_test, we are making sure that the code compiles without +# needing config.h/etc. The best test is to make sure we can compile +# with just the installed header files. The best way to do this is at +# installcheck time. When this rule is run (via 'make distcheck'), +# 'includedir' is the installed include-dir. +installcheck-local: + $(CXX) -I $(includedir) -c $(top_srcdir)/src/tests/compile_test.cc \ + -o installcheck_compile_test.o + TESTS += template_test_util_test template_test_util_nothreads_test WINDOWS_PROJECTS += vsprojects/template_test_util_test/template_test_util_test.vcproj template_test_util_test_SOURCES = src/tests/config_for_unittests.h \ @@ -371,6 +380,7 @@ TESTDATA += \ src/tests/htmlparser_testdata/cdata.html \ src/tests/htmlparser_testdata/comments.html \ src/tests/htmlparser_testdata/context.html \ + src/tests/htmlparser_testdata/google.html \ src/tests/htmlparser_testdata/javascript_attribute.html \ src/tests/htmlparser_testdata/javascript_block.html \ src/tests/htmlparser_testdata/javascript_regexp.html \ @@ -479,7 +489,7 @@ libtool: $(LIBTOOL_DEPS) # NOTE: BUILT_SOURCES should come after the .config files, so they # come later (and thus end up with a later timestamp) when we tar/untar. EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \ - $(SCRIPTS) $(TESTDATA) libtool \ + $(SCRIPTS) $(TESTDATA) libtool autogen.sh \ src/htmlparser/generate_fsm.py src/htmlparser/fsm_config.py \ src/tests/statemachine_test_fsm.config \ src/htmlparser/htmlparser_fsm.config \ diff --git a/Makefile.in b/Makefile.in index 629a2c1..5220a0d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -891,6 +891,7 @@ TESTDATA = src/tests/template_unittest_test_footer.in \ src/tests/htmlparser_testdata/cdata.html \ src/tests/htmlparser_testdata/comments.html \ src/tests/htmlparser_testdata/context.html \ + src/tests/htmlparser_testdata/google.html \ src/tests/htmlparser_testdata/javascript_attribute.html \ src/tests/htmlparser_testdata/javascript_block.html \ src/tests/htmlparser_testdata/javascript_regexp.html \ @@ -1101,7 +1102,7 @@ pkgconfig_DATA = lib${PACKAGE}.pc lib${PACKAGE}_nothreads.pc # NOTE: BUILT_SOURCES should come after the .config files, so they # come later (and thus end up with a later timestamp) when we tar/untar. EXTRA_DIST = packages/rpm.sh packages/rpm/rpm.spec packages/deb.sh packages/deb \ - $(SCRIPTS) $(TESTDATA) libtool \ + $(SCRIPTS) $(TESTDATA) libtool autogen.sh \ src/htmlparser/generate_fsm.py src/htmlparser/fsm_config.py \ src/tests/statemachine_test_fsm.config \ src/htmlparser/htmlparser_fsm.config \ @@ -2643,7 +2644,7 @@ install-pdf: install-pdf-am install-ps: install-ps-am -installcheck-am: +installcheck-am: installcheck-local maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) @@ -2687,11 +2688,11 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ install-libLTLIBRARIES install-man \ install-nodist_ctemplateincludeHEADERS install-pdf \ install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-binSCRIPTS \ + install-strip installcheck installcheck-am installcheck-local \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \ uninstall-dist_docDATA uninstall-libLTLIBRARIES \ uninstall-nodist_ctemplateincludeHEADERS \ uninstall-pkgconfigDATA @@ -2708,6 +2709,15 @@ src/htmlparser/jsparser_fsm.h: src/htmlparser/generate_fsm.py src/htmlparser/fsm src/tests/statemachine_test_fsm.h: src/htmlparser/generate_fsm.py src/htmlparser/fsm_config.py src/tests/statemachine_test_fsm.config $(top_srcdir)/src/htmlparser/generate_fsm.py $(top_srcdir)/src/tests/statemachine_test_fsm.config > $@ +# With compile_test, we are making sure that the code compiles without +# needing config.h/etc. The best test is to make sure we can compile +# with just the installed header files. The best way to do this is at +# installcheck time. When this rule is run (via 'make distcheck'), +# 'includedir' is the installed include-dir. +installcheck-local: + $(CXX) -I $(includedir) -c $(top_srcdir)/src/tests/compile_test.cc \ + -o installcheck_compile_test.o + # We want to compile statemachine.cc as a c file as well as a c++ file statemachine.c: src/htmlparser/statemachine.cc