Re: [PATCH kvm-unit-tests 0/4] API test framework

Marcelo Tosatti
2010-11-29T16:09:34Z

On Wed, Nov 24, 2010 at 12:52:09PM +0200, Avi Kivity wrote:
> This patchset adds an API test framework. Rather than driving kvm from qemu,
> we now have a way of calling the kvm API directly and observing the results.
> We can switch to guest mode and back at will and see any micro effects such
> as the result of executing particular instructions.
>
> As an experiment, the framework is coded in C++.
>
> Avi Kivity (4):
> Makefile: add support for C++
> Introduce a C++ wrapper for the kvm APIs
> Add support for calling a function in guest mode
> Add sample test using the api test harness
>
> Makefile | 4 +-
> api/identity.cc | 76 ++++++++++++++++++++++
> api/identity.h | 28 ++++++++
> api/kvmxx.cc | 168 +++++++++++++++++++++++++++++++++++++++++++++++++
> api/kvmxx.h | 80 +++++++++++++++++++++++
> config-x86-common.mak | 8 +++
> x86/api-sample.cc | 23 +++++++
> 7 files changed, 386 insertions(+), 1 deletions(-)
> create mode 100644 api/identity.cc
> create mode 100644 api/identity.h
> create mode 100644 api/kvmxx.cc
> create mode 100644 api/kvmxx.h
> create mode 100644 x86/api-sample.cc

I fail to see practical advantages of this compared to current unit
tests. Could you give some exciting examples?

The fact that it does not run inside QEMU
means you can't test QEMU interactions (re:
http://permalink.gmane.org/gmane.comp.emulators.kvm.devel/59060).

Perhaps you can write a save/restore example as mentioned in the URL
above?

To me it seems having an interface to QEMU from unit tests would be more
beneficial.