From 5e6b0382ad672254bdabf1997ef36bdc4fa0e11f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 7 May 2018 17:10:07 +0200 Subject: build: let `make check` re-generate clients/common/settings-doc.h.in with NM_TEST_REGENERATE=1 When building with --disable-introspection, we re-use the pre-generated clients/common/settings-doc.h.in file. When building with --enable-introspection, we generate clients/common/settings-doc.h, and let `make check` verify that the generated file is identical to what we would generate. The common case where the generated file differ, is when code changed, in this case, the developer is advised to update settings-doc.h.in. Interpret environment variable NM_TEST_REGENERATE=1 to do this automatically during `make check`. This will be useful, as there might be several tests that compare a generated file with a file from version control. NM_TEST_REGENERATE=1 will be the general way to re-generate all these files. $ NM_TEST_REGENERATE=1 make check --- Makefile.am | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7f5c328f20..a7152bd07c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3424,10 +3424,14 @@ $(clients_common_settings_doc_h): clients/common/settings-docs.xsl libnm/nm-prop $(AM_V_GEN) $(XSLTPROC) --output $@ $< $(word 2,$^) DISTCLEANFILES += $(clients_common_settings_doc_h) check-local-settings-docs: $(clients_common_settings_doc_h) - @if test -z "$$NMTST_NO_CHECK_SETTINGS_DOCS" ; then \ + @if test -z "$$NMTST_NO_CHECK_SETTINGS_DOCS" ; then \ if ! cmp -s "$(srcdir)/$(clients_common_settings_doc_h).in" "$(builddir)/$(clients_common_settings_doc_h)" ; then \ - echo "The generated file \"$(builddir)/$(clients_common_settings_doc_h)\" differs from the source file \"$(srcdir)/$(clients_common_settings_doc_h).in\". You probably should copy the generated file over to the source file. You can skip this test by setting \$$NMTST_NO_CHECK_SETTINGS_DOCS=yes"; \ - false; \ + if test "$$NM_TEST_REGENERATE" == 1 ; then \ + cp -f "$(builddir)/$(clients_common_settings_doc_h)" "$(srcdir)/$(clients_common_settings_doc_h).in"; \ + else \ + echo "The generated file \"$(builddir)/$(clients_common_settings_doc_h)\" differs from the source file \"$(srcdir)/$(clients_common_settings_doc_h).in\". You probably should copy the generated file over to the source file. You can skip this test by setting \$$NMTST_NO_CHECK_SETTINGS_DOCS=yes". You can also automatically copy the file by rerunning the test with \$$NM_TEST_REGENERATE=1 ; \ + false; \ + fi; \ fi;\ fi check_local += check-local-settings-docs -- cgit v1.2.1