diff options
author | Thomas Haller <thaller@redhat.com> | 2018-05-07 17:10:07 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-05-11 16:51:20 +0200 |
commit | 5e6b0382ad672254bdabf1997ef36bdc4fa0e11f (patch) | |
tree | 028e23704e3ff38b5b884a3c009b4a0388340128 | |
parent | 9628aabc2fbf9315eb9c87478da1588c72d8b44c (diff) | |
download | NetworkManager-5e6b0382ad672254bdabf1997ef36bdc4fa0e11f.tar.gz |
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
-rw-r--r-- | Makefile.am | 10 |
1 files 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 |