]> xenbits.xensource.com Git - libvirt.git/commit
testutils: Document and enforce @func callback retvals for virTestMain()
authorMichal Privoznik <mprivozn@redhat.com>
Sun, 16 May 2021 16:20:56 +0000 (18:20 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 17 May 2021 07:26:05 +0000 (09:26 +0200)
commit6eac856e7ce36a6ccdbc2094077c10ccebdb296c
tree80071164619a2f8549b6a526d8f13dd3cdbfcf0b
parent5d99b157bcae14e7429f4f21f0c841e5b839effb
testutils: Document and enforce @func callback retvals for virTestMain()

When a test has a wrapper over main() (e.g. because it's
preloading some mock libraries). the main() is renamed to
something else (usually mymain()), and main() is generated by
calling one of VIR_TEST_MAIN() or VIR_TEST_MAIN_PRELOAD() macros.

This has a neat side effect - if mymain() returns an error a
short summary is printed, e.g.:

  Some tests failed. Run them using:
  VIR_TEST_DEBUG=1 VIR_TEST_RANGE=5-6 ./virtest

However, this detection only works if EXIT_FAILURE is returned by
mymain(). Document and enforce this limitation.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tests/testutils.c
tests/testutils.h