From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH kvm-unit-tests 4/4] Add sample test using the api test harness Date: Sun, 28 Nov 2010 11:21:21 +0200 Message-ID: <4CF21F11.5030100@redhat.com> References: <1290595933-13122-1-git-send-email-avi@redhat.com> <1290595933-13122-5-git-send-email-avi@redhat.com> <20101126141721.GA6124@redhat.com> <4CF0CC4A.8070100@redhat.com> <20101128090422.GC3330@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:11516 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751864Ab0K1JVY (ORCPT ); Sun, 28 Nov 2010 04:21:24 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAS9LOKn023283 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 28 Nov 2010 04:21:24 -0500 In-Reply-To: <20101128090422.GC3330@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/28/2010 11:04 AM, Michael S. Tsirkin wrote: > 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. Particular tests will use a report(message, bool) scheme like the other unit tests. If a test checks for an error, it will have an explicit try/catch (or better, expect_error(std::tr1::function<>, errno). The top-level try/catch is for unexpected errors. -- error compiling committee.c: too many arguments to function