[Libosinfo] [libosinfo PATCH] tests: convert from check to the GLib testing framework

Pino Toscano ptoscano at redhat.com
Thu Oct 19 14:14:14 UTC 2017


On Thursday, 19 October 2017 16:02:18 CEST Daniel P. Berrange wrote:
> On Thu, Oct 19, 2017 at 03:59:02PM +0200, Pino Toscano wrote:
> > On Thursday, 19 October 2017 15:36:28 CEST Daniel P. Berrange wrote:
> > > On Thu, Oct 19, 2017 at 03:14:24PM +0200, Pino Toscano wrote:
> > > > diff --git a/tests/test-isodetect.c b/tests/test-isodetect.c
> > > > index 7214531..97c86c4 100644
> > > > --- a/tests/test-isodetect.c
> > > > +++ b/tests/test-isodetect.c
> > > 
> > > > -int main(void)
> > > > -{
> > > > -    int number_failed;
> > > > -    Suite *s = list_suite();
> > > > -    SRunner *sr = srunner_create(s);
> > > > +    g_test_init(&argc, &argv, NULL);
> > > > +
> > > > +    g_test_add_func("/isodetect/fedora", test_fedora);
> > > > +    g_test_add_func("/isodetect/rhel", test_rhel);
> > > > +    g_test_add_func("/isodetect/ubuntu", test_ubuntu);
> > > > +    g_test_add_func("/isodetect/debian", test_debian);
> > > > +    g_test_add_func("/isodetect/windows", test_windows);
> > > > +    g_test_add_func("/isodetect/freebsd", test_freebsd);
> > > > +    g_test_add_func("/isodetect/openbsd", test_openbsd);
> > > > +    g_test_add_func("/isodetect/opensuse", test_opensuse);
> > > > +    g_test_add_func("/isodetect/centos", test_centos);
> > > > +    g_test_add_func("/isodetect/gnome", test_gnome);
> > > > +    g_test_add_func("/isodetect/altlinux", test_altlinux);
> > > > +    g_test_add_func("/isodetect/mageia", test_mageia);
> > > > +    g_test_add_func("/isodetect/sles", test_sles);
> > > > +    g_test_add_func("/isodetect/sled", test_sled);
> > > 
> > > We could wrap all of this in a
> > > 
> > >    if (g_test_slow()) {
> > >      ....
> > >    }
> > > 
> > > so that this only executes if people request slow tests via '-m slow' arg
> > 
> > Hm aren't these tests worth executing by default?  Not sure what is the
> > proper definition of "slow" for GLib tests though, and test-isodetect
> > takes less than 20 seconds to run here.
> 
> They're primarily useful for upstream to run - I don't think there's much
> benefit downstream users running them. So I think its the kind of thing
> where we could put '-m slow' into our CI system tests.

Couldn't it be useful for downstream as well, i.e. to check that the
data provided in osinfo-db actually match the expected ISO data?  Say
in case a downstream adds custom changes (or backport upstream commits),
so they know the modified osinfo-db is OK.

> THis would avoid downstream users needing networking during tests too IIUC.

Note that test-isodetect does not require networking, as it uses the
data in tests/isodata.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20171019/c1090cea/attachment.sig>


More information about the Libosinfo mailing list