Re: [PATCH kvm-unit-tests 2/4] Introduce a C++ wrapper for the kvm APIs

Anthony Liguori
2010-11-24T14:18:58Z

On 11/24/2010 06:59 AM, Alexander Graf wrote:
> On 24.11.2010, at 11:52, Avi Kivity wrote:
>
>
>> Introduce exception-safe objects for calling system, vm, and vcpu ioctls.
>>
>> Signed-off-by: Avi Kivity<avi@redhat.com>
>>
>
> FWIW, I still disagree with C++ and believe this code to be hardly readable.
>

Take a look at http://repo.or.cz/w/qemupp.git

Start with test/test-mc146818a.cpp

This test infrastructure is arguably a bad place to start because it
doesn't benefit really at all from C++. The object hierarchy is
extremely simple and most of the time you're interfacing with legacy C
interfaces so a lot of effort is spent bridging those interfaces.

OTOH, the device models interact very little with the external world and
the object model is complex is subtle ways. I think C++ is a much
better fit there.

In the above repo, I've converted the PIT, RTC, keyboard controller, and
have started working on the i440fx. The i440fx is a lot of work but
it's also one of the more interesting devices to try and model correctly.

For all devices, there are very intensive unit tests that use fuzzing.
I hope to have something postable for serious consideration by the end
of the year.

BTW, given the ability to test programmatically, I ended up rewriting a
good bit of the PIT and RTC. The way that the unit conversion is
handled right now in QEMU is a train wreck. The new version is much
more accurate and as a consequence, the interrupt catch up logic is much
more precise. There are also three different catch up algorithms that
are selectable at run time.

This is all tested with a time simulation that can simulate random
amounts of drift over random periods of time.

Regards,

Anthony Liguori

>
> Alex
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>