After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 383456 - "make check" test for 100% documentation
"make check" test for 100% documentation
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: 1.9
Assigned To: gtk-doc maintainers
gtk-doc maintainers
: 434177 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-12-07 18:24 UTC by Behdad Esfahbod
Modified: 2007-09-23 14:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
run documentation tests (1.04 KB, text/plain)
2007-08-08 13:43 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
Details
alternate gtkdoc-check (in Perl) (1.96 KB, text/plain)
2007-08-10 18:33 UTC, Yeti
Details
alternate gtkdoc-check (in Perl) (1.93 KB, text/plain)
2007-08-11 19:53 UTC, Yeti
Details

Description Behdad Esfahbod 2006-12-07 18:24:34 UTC
> I want to suggest you add a way for the user library to tell gtk-doc
> that it wants to keep full doc coverage, such that make distcheck fails
> if there are unused or undocumented symbols... I'm using my own small
> shell script for this purpose in Pango now:

  http://cvs.gnome.org/viewcvs/*checkout*/pango/docs/check.docs
Comment 1 Benjamin Otte (Company) 2007-06-06 06:43:20 UTC
*** Bug 434177 has been marked as a duplicate of this bug. ***
Comment 2 Benjamin Otte (Company) 2007-06-06 06:46:34 UTC
Some additional suggestion from bug 434177: It would be nice if this thing was run on make check, not only on distcheck.
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-08 13:43:11 UTC
Created attachment 93276 [details]
run documentation tests

put this into gtk-doc.make:

TESTS=<prefix>/gtkdoc-check
e.g.:
TESTS=/opt/gnome/bin/gtkdoc-check

and exactly this is the problem. If its not a fully patch make check tries to *make* and run it localy. Any ideas?
Comment 4 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-08 15:26:54 UTC
What about this hack for gtkdoc.make

TESTS = gtkdoc-check

gtkdoc-check:
	cp `which gtkdoc-check` ./

CLEANFILES = ... gtkdoc-check
Comment 5 Behdad Esfahbod 2007-08-08 22:33:26 UTC
FWIW, this is the script I use in pango:

#!/bin/sh

LANG=C

test -z "$srcdir" && srcdir=.
status=0

if ! test -f pango-undocumented.txt -a -f pango-unused.txt; then
        echo At least one of pango-undocumented.txt and pango-unused.txt not found.
        echo Skipping test.
        exit 0
fi

status=0

unused=`cat pango-unused.txt`
if test -n "$unused"; then
        echo Unused documentated symbols:
        cat pango-unused.txt
        status=1
fi
if ! grep '^0 symbols incomplete' pango-undocumented.txt >/dev/null ||
   ! grep '^0 not documented'     pango-undocumented.txt >/dev/null; then
        echo Incomplete or undocumented symbols:
        cat pango-unused.txt
        status=1
fi

exit $status
Comment 6 Behdad Esfahbod 2007-08-08 22:34:47 UTC
(In reply to comment #5)
> FWIW, this is the script I use in pango:
> 
> #!/bin/sh
> 
> LANG=C
> 
> test -z "$srcdir" && srcdir=.
> status=0
> 
> if ! test -f pango-undocumented.txt -a -f pango-unused.txt; then
>         echo At least one of pango-undocumented.txt and pango-unused.txt not
> found.
>         echo Skipping test.
>         exit 0
> fi
> 
> status=0
> 
> unused=`cat pango-unused.txt`
> if test -n "$unused"; then
>         echo Unused documentated symbols:
>         cat pango-unused.txt
>         status=1
> fi
> if ! grep '^0 symbols incomplete' pango-undocumented.txt >/dev/null ||
>    ! grep '^0 not documented'     pango-undocumented.txt >/dev/null; then
>         echo Incomplete or undocumented symbols:
>         cat pango-unused.txt

Humm, this one should be cat pango-undocumented.txt



>         status=1
> fi
> 
> exit $status
> 

Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-09 07:27:33 UTC
@Behdad, my script works in a similar way. Main issue is the invocation from the gtkdoc.make. I also mimiced the output from check in the hope that its then easier to treat in in the test-status page on build.gnome.org.
Comment 8 Yeti 2007-08-09 20:31:16 UTC
Please write it in Perl.

The rest of gtk-doc is written in Perl and it's much easier to write code like this portably in Perl than in shell.  I won't go into great lengths as what can go wrong in various shells and with various version of Unix text tools (and don't imagine anything exotic, run it on Ubuntu where all text tools are the GNU versions, just /bin/sh is dash instead of bash -- running it on *BSD would be much more fun).

Also, I am probably not the only one with spaces around `=' in my Makefiles:

DOC_MODULE = libgwyddion

This does not work, the script requires

DOC_MODULE=libgwyddion
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-10 08:25:59 UTC
yes we can rewrite in in perl. The more critical point is the invocation and that need to be solved/agreed with before.
Comment 10 Yeti 2007-08-10 09:25:04 UTC
OK, invocation.

1. Extend gtk-doc.m4 with

AC_PATH_PROGS(GTKDOC_CHECK,gtkdoc-check,)

2. Use

TESTS = $(GTKDOC_CHECK)

in the makefile.

The thing I am missing in this discussion is: how is one supposed enable/disable this?  Because not everyone probably wants missing documentation make `make check' fail.

The easiest way seems to be putting the TESTS line not into gtk-doc.make, but into the sample Makefile.am, commented out and commented, and letting the user uncomment it at his discretion.
Comment 11 Benjamin Otte (Company) 2007-08-10 12:59:23 UTC
Question: How do we encourage projects to use this feature?
I think maintainers should not be annoyed by make check failing, but should want to use this feature.

Just making projects with non-updated documentation suddenly fail on make check obviously does not seem like a good idea. But you want to get those projects to use it that take care of their documentation. This includes both projects that already use gtk-doc and new projects.

For existing projects, I have no idea how to solve it, maybe posting it to various lists and blogs.

For new projects I'd suggest enabling the check automatically and having an easy way to opt out. I think it's a reasonable assumption that people use gtk-doc to write complete and good documentation, so supporting this should be the default behavior.
Comment 12 Yeti 2007-08-10 13:50:22 UTC
(In reply to comment #11)
> For new projects I'd suggest enabling the check automatically and having an
> easy way to opt out. I think it's a reasonable assumption that people use
> gtk-doc to write complete and good documentation, so supporting this should be
> the default behavior.

I don't think it's a reasonable assumption that a typical *new* project has 100% coverage of API documentation, not even that documenting every obscure exported symbol is well spent effort in the `0.1' stage.
Comment 13 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-10 16:46:47 UTC
I've committed it. When 1.9 comes out I will do some blogging to tech maintainer what new things they can do.
@Yeti, sorry for keeping it a shell script. I fixed the docmodule matching though.

2007-08-10  Stefan Kost  <ensonic@users.sf.net>

	* examples/Makefile.am:
	  Add commented out TESTS.

	* gtk-doc.m4:
	  Check for location of gtkdoc-check.

	* Makefile.am:
	* gtkdoc-check:
	  Test doc status and print result in check like layout.
Comment 14 Yeti 2007-08-10 16:48:10 UTC
If I rewrite it in Perl, will you replace it?
Comment 15 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-10 16:50:45 UTC
Yes, I will :) Lets see how much simpler you'll get it.
Comment 16 Yeti 2007-08-10 18:33:11 UTC
(In reply to comment #15)
> Yes, I will :) Lets see how much simpler you'll get it.

Simpler, well, that was not exactly the primary goal.  Correct and portable were.
Comment 17 Yeti 2007-08-10 18:33:51 UTC
Created attachment 93451 [details]
alternate gtkdoc-check (in Perl)
Comment 18 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-11 19:34:36 UTC
Looks good, but should probably be move to .in with the @PERL@ replacement for line 1.
Comment 19 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-11 19:36:58 UTC
Cannot open tester-unused.txt: No such file or directory

The grep function should not fail for optional files.
Comment 20 Yeti 2007-08-11 19:53:59 UTC
Created attachment 93507 [details]
alternate gtkdoc-check (in Perl)

Don't die in CheckEmpty if the file does not exist, nonexistent files are as good as empty.  Fixed inversion of some failure conditions in the rate calculation.
Comment 21 Yeti 2007-08-11 19:56:50 UTC
(In reply to comment #18)
> Looks good, but should probably be move to .in with the @PERL@ replacement for
> line 1.

Yes, this can be easily changed when it's being added to the repo.  The plain form is better for testing.
Comment 22 Stefan Sauer (gstreamer, gtkdoc dev) 2007-08-12 10:14:12 UTC
2007-08-12  Stefan Kost  <ensonic@users.sf.net>

	* Makefile.am:
	* configure.in:
	* gtkdoc-check:
	* gtkdoc-check.in:
	  Replacing my shell based test script by Davids perl based one. Add
	  licence, copyright and docs header. Integrate with build.