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 695688 - Run tests in gtester
Run tests in gtester
Status: RESOLVED OBSOLETE
Product: evolution-data-server
Classification: Platform
Component: general
3.8.x (obsolete)
Other Linux
: Normal enhancement
: ---
Assigned To: Evolution Shell Maintainers Team
Evolution QA team
Depends on: 692125
Blocks:
 
 
Reported: 2013-03-12 09:56 UTC by Vadim Rutkovsky
Modified: 2014-03-25 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use gtester to run tests (37.56 KB, patch)
2013-03-12 09:58 UTC, Vadim Rutkovsky
none Details | Review
Use gtester to run tests - removed xslt convertion (34.36 KB, patch)
2013-03-12 14:14 UTC, Vadim Rutkovsky
none Details | Review
Use gtester to run tests - now in tests only (7.66 KB, patch)
2013-03-13 17:07 UTC, Vadim Rutkovsky
reviewed Details | Review

Description Vadim Rutkovsky 2013-03-12 09:56:48 UTC
Current testsuite uses gtest, but tests are being run manually, test report is scattered around in the directories. As a result, it is quite hard to collect test statistics and spot tests, which fail irregularly.

The proposed patch uses gtester utility to run tests, gtester-report to produce the report and gtester2junit.xsl to conver gtester data to JUnit xml output to be used in most CIs.

Gtester adds several more features on running tests - for instance, test can be marked as slow [1] and will not be run during usual check. Sample report, generated by gtester-report [2] gives a nice overview on current test suite status.

Note, that 'check' make target is not replaced, gtester will be used only on running test-report, perf-report or full-report targets, so this change doesn't break current test suite run procedure.

[1] https://developer.gnome.org/glib/stable/gtester.html
[2] http://dl.dropbox.com/u/8686253/test-report.html
Comment 1 Vadim Rutkovsky 2013-03-12 09:58:18 UTC
Created attachment 238679 [details] [review]
Use gtester to run tests
Comment 2 Milan Crha 2013-03-12 11:56:07 UTC
Tristan, what do you think about this, please? It's related to your changes in output of tests, and it seems like it would be useful to have.
Comment 3 Tristan Van Berkom 2013-03-12 12:34:23 UTC
My concerns are:

  a.) Why does this include the new makefile in every directory's Makefile,
      even the reference documentation Makefiles ?

  b.) The gtester documentation says that the output can be converted to HTML
      using the gtester-report utility... how come the added Makefile here
      includes a heap of inline xml and translates this to a sort of JUnit
      format ?

  c.) I'm curious how this works, where does the HTML output go ?

      With this applied, can I simply run 'make test-report' and
      there will be a directory created with HTML that I can look at
      using my browser locally ?

      In other words, how accessible is this feature to developers ?

  d.) Finally, I think this should be automated further, can these
      rules be added in an .m4 macro ?

      I wonder if there already is an m4 macro for this in gnome-common,
      otherwise I would suspect it would be a welcome macro in gnome-common
      (this way other modules can easily benefit from this too, without
      adding their own custom makefile, it should be shared).

      I think the best way to implement this would be to create an m4 macro
      in gnome-common and add a single line to EDS's configure.ac (instead
      of modifying every Makefile and including a custom makefile, I think
      it should be implied by any makefile defining a TESTS variable, or
      perhaps a GTESTS variable understood by an m4 macro).

I'm not against it, but the above are my basic concerns.
Comment 4 Vadim Rutkovsky 2013-03-12 12:50:27 UTC
>Why does this include the new makefile in every directory's Makefile,       even the reference documentation Makefiles ?

Could not found a better way to do this (otherwise 'make test-report' in root dir will fail), suggestions welcome

>how come the added Makefile here includes a heap of inline xml and translates this to a sort of JUnit format

It runs every test, produces output for every test and later combines in one big gtester xml. Then gtester-report produces html report. 

Last step is producing JUnit compatible report using xslt. This step is actually not required and can easily be omitted.

>I'm curious how this works, where does the HTML output go
Stored in current directory and can be used as "artifact" in CI (for instance, Jenkins) - or as a report for maintainer/committer. 

> how accessible is this feature to developers?
Instead of reading the whole output or test-suite.log files in each test dir, the report merges all info about the test - result, error message, test duration, messages etc. After running this report several time anyone will notice that some tests are irregularly fail and pass (test-client-suppress-notifications and test-client-get-revision). This kind of statistic (ideally across several commits/runs) shows that these tests should either be disabled or fixed - and this kind of conclusion is not that easy to watching stdout from 'make check'

>Finally, I think this should be automated further, can these rules be added in an .m4 macro
I'm not that good in m4 and Makefiles, this patch is more like a quick solution for eds. Note, that this  patch is mostly a copy of solution used already in dconf and qemu. Of course, a more intelligent and neat solution (ready to use in other project) to have gtester xml output (which is a core point of this patch) is welcome.

Of course, the main point of this patch is to prepare EDS for CI integration - this will unlock several interesting features, like easy patch tests, build failure notifications and constant quality control.
Comment 5 Tristan Van Berkom 2013-03-12 13:53:01 UTC
(In reply to comment #4)
> >Why does this include the new makefile in every directory's Makefile,       even the reference documentation Makefiles ?
> 
> Could not found a better way to do this (otherwise 'make test-report' in root
> dir will fail), suggestions welcome
> 
> >how come the added Makefile here includes a heap of inline xml and translates this to a sort of JUnit format
> 
> It runs every test, produces output for every test and later combines in one
> big gtester xml. Then gtester-report produces html report. 
> 
> Last step is producing JUnit compatible report using xslt. This step is
> actually not required and can easily be omitted.

I would think this conversion is a special use-case, personally I don't
like the idea of including that custom case in EDS proper (perhaps you
could write your own conversion script if interacting with third-parting
tooling is important for you).

> 
> >I'm curious how this works, where does the HTML output go
> Stored in current directory and can be used as "artifact" in CI (for instance,
> Jenkins) - or as a report for maintainer/committer. 
> 
> > how accessible is this feature to developers?
> Instead of reading the whole output or test-suite.log files in each test dir,
> the report merges all info about the test - result, error message, test
> duration, messages etc. After running this report several time anyone will
> notice that some tests are irregularly fail and pass
> (test-client-suppress-notifications and test-client-get-revision). This kind of
> statistic (ideally across several commits/runs) shows that these tests should
> either be disabled or fixed - and this kind of conclusion is not that easy to
> watching stdout from 'make check'

In these cases I'm quite certain that the problem has to do with race
conditions in EDS proper (specifically when interacting with the EBookClient
in a non-default thread).

> 
> >Finally, I think this should be automated further, can these rules be added in an .m4 macro
> I'm not that good in m4 and Makefiles, this patch is more like a quick solution
> for eds. Note, that this  patch is mostly a copy of solution used already in
> dconf and qemu. Of course, a more intelligent and neat solution (ready to use
> in other project) to have gtester xml output (which is a core point of this
> patch) is welcome.
> 
> Of course, the main point of this patch is to prepare EDS for CI integration -
> this will unlock several interesting features, like easy patch tests, build
> failure notifications and constant quality control.

I'm not against this in general, and the HTML output does look good.

Perhaps we can run with this in EDS for now as an incubator of sorts
for other GNOME projects, and adapt it into a proper m4 macro as a separate
step (hopefully with a more formal approach using an m4 macro we can
also eliminate the need to modify unrelated Makefiles that dont 
build TESTS targets at all, too).
Comment 6 Vadim Rutkovsky 2013-03-12 14:14:04 UTC
Created attachment 238692 [details] [review]
Use gtester to run tests - removed xslt convertion

Removed xslt convertion - not really necessary and should be performed on CI's side
Comment 7 Milan Crha 2013-03-13 07:43:46 UTC
(In reply to comment #4)
> >Why does this include the new makefile in every directory's Makefile,
> > even the reference documentation Makefiles ?
> 
> Could not found a better way to do this (otherwise 'make test-report' in root
> dir will fail), suggestions welcome

What about adding it to tests/ folder only? I understand that it's easier to run this in a root directory, but as the most directories are unrelated/unaffected, then it sort of makes sense to run "make test-report" inside tests/ directory.
Comment 8 Tristan Van Berkom 2013-03-13 09:06:21 UTC
(In reply to comment #7)
> (In reply to comment #4)
> > >Why does this include the new makefile in every directory's Makefile,
> > > even the reference documentation Makefiles ?
> > 
> > Could not found a better way to do this (otherwise 'make test-report' in root
> > dir will fail), suggestions welcome
> 
> What about adding it to tests/ folder only? I understand that it's easier to
> run this in a root directory, but as the most directories are
> unrelated/unaffected, then it sort of makes sense to run "make test-report"
> inside tests/ directory.

I agree, how about adding the include (and Makefile.gtester) only to
the tests/ subdir ?

Then we avoid all the useless diffs throughout the tree.

We can then include some extra rules in the toplevel Makefile, such as:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.PHONY:test-report perf-report full-report

test-report perf-report full-report:
  <tab>  $(MAKE) -C tests/ $@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Just so the tests can be invoked from the toplevel, alternatively,
if we have/need to run tests in other directories, then we could
do something like this in the toplevel makefile instead:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GTESTER_SUBDIRS = tests directory_one directory_two ...

.PHONY:test-report perf-report full-report

test-report perf-report full-report:
  <tab>  for test in $(GTESTER_SUBDIRS); do
  <tab>    $(MAKE) -C $$test $@;
  <tab>  done
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Of course in the above <tab> should really be tabs, and I think
I got the double escape sequence for '$$test' correctly for the
makefile rule, but it always takes me a couple tries to be sure
I got it right...

I think that the Makefile.gtester itself is a bit crack and
definitely should be improved before we can consider sharing
that with other projects.
Comment 9 Vadim Rutkovsky 2013-03-13 17:07:50 UTC
Created attachment 238801 [details] [review]
Use gtester to run tests - now in tests only

Thanks for comments, current version affects much less makefiles, .gtester is stored in tests/ dir. Note, that addressbook/backends/google/tests/ contains phonenumber test (but that's another story)

>I think that the Makefile.gtester itself is a bit crack and
definitely should be improved before we can consider sharing
that with other projects.
Actually, this file is (almost) an exact copy from dconf - see [1], so I don't think it would be hard to port this makefile to any other project

I'd really love to see this file to become generic and easily usable in any other project - but this is looks more like an enhancement for gnome-common

[1] https://git.gnome.org/browse/dconf/tree/Makefile.gtester
Comment 10 Tristan Van Berkom 2013-03-13 17:45:04 UTC
Some interesting input related to this...

See Mathias Clasen's take on d-d-l:
  https://mail.gnome.org/archives/desktop-devel-list/2013-March/msg00055.html

And the bug report he links to:
  https://bugzilla.gnome.org/show_bug.cgi?id=692125
Comment 11 Milan Crha 2013-03-15 11:03:03 UTC
Thanks for the pointers, Tristan. I'd say to wait for the TAP bug, then return to this again, and possibly re-evaluate.
Comment 12 Vadim Rutkovsky 2014-03-25 16:50:11 UTC
EDS now uses Installed Tests, so gtester is not required here