Re: [PATCH kvm-unit-tests 4/4] Add sample test using the api test harness

Michael S. Tsirkin
2010-11-28T09:27:43Z

On Sat, Nov 27, 2010 at 11:15:54AM +0200, Avi Kivity wrote:
> On 11/26/2010 04:17 PM, Michael S. Tsirkin wrote:
> >> +
> >> +int main(int ac, char **av)
> >> +{
> >> + kvm::system system;
> >> + kvm::vm vm(system);
> >> + identity::setup_vm(vm);
> >> + kvm::vcpu vcpu(vm, 0);
> >> + identity::vcpu thread(vcpu, set_global);
> >> + vcpu.run();
> >> + printf("global %d\n", global);
> >> + return global == 1;
> >> +}
> >
> >I note that no exceptions are caught. So any failure will get us a crash,
> >is there an indication what went wrong?
> >
>
> I'll add a try/catch.

So we'll get a "test failed: error 11" at high level?
That's still not very helpful for debugging.
The specific test might be better served by assert calls after each ioctl
than an elaborate exception handling scheme.

> --
> I have a truly marvellous patch that fixes the bug which this
> signature is too narrow to contain.