[PATCH] Add unit tests for timer validation

Peter Krempa pkrempa at redhat.com
Wed Sep 16 07:16:04 UTC 2020


On Tue, Sep 15, 2020 at 22:47:46 +0200, Peter Krempa wrote:
> On Tue, Sep 15, 2020 at 19:01:36 +0000, Sebastian Mitterle wrote:
> > Add minimal coverage for non-x86_64 timer validation
> > from commit 2f5d8ffebe5d3d00e16a051ed62ce8a703f18e7c
> > 
> > Signed-off-by: Sebastian Mitterle <smitterl at redhat.com>
> > ---
> >  tests/meson.build        |   1 +
> >  tests/qemuvalidatetest.c | 107 +++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 108 insertions(+)
> >  create mode 100644 tests/qemuvalidatetest.c

[...]

> > +static int
> > +errorTimersNotOnX86(const void *unused G_GNUC_UNUSED)
> > +{
> > +    int ret = 0;
> > +    char *log;
> > +    char expectedError[75] = "'tsc' timer is not supported for virtType=qemu arch=s390x machine=m guests";
> 
> This is extreme overkill. We don't really validate error messages and in
> this particular case I don't really see much value.

I'd actually see more value if qemuxml2argv test supports validating
error messages so that they are not obscured.

The errors should be recorded in a file though so that
VIR_TEST_REGENERATE_OUTPUT=1 can be used to update them without copying
stuff into code.

Additionally, while validating errors we must make sure that the locale
for the errors is set to the default one so that it doesn't break
randomly on certain hosts.




More information about the libvir-list mailing list