From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH kvm-unit-tests v2 05/12] lib/report: allow test skipping Date: Fri, 18 Dec 2015 12:18:19 +0100 Message-ID: <20151218111818.GB21525@potion.brq.redhat.com> References: <1450374823-7648-1-git-send-email-rkrcmar@redhat.com> <1450374823-7648-6-git-send-email-rkrcmar@redhat.com> <20151217193023.GE14168@hawk.localdomain> <20151217193702.GF14168@hawk.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Paolo Bonzini To: Andrew Jones Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35543 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751257AbbLRLSW (ORCPT ); Fri, 18 Dec 2015 06:18:22 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 29C49C0B7E02 for ; Fri, 18 Dec 2015 11:18:22 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20151217193702.GF14168@hawk.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: 2015-12-17 13:37-0600, Andrew Jones: > On Thu, Dec 17, 2015 at 01:30:23PM -0600, Andrew Jones wrote: >> On Thu, Dec 17, 2015 at 06:53:36PM +0100, Radim Kr=C4=8Dm=C3=A1=C5=99= wrote: >> > We can now explicitly mark a unit-test as skipped. >> > If all unit-tests were skipped, the whole test is reported as skip= ped as >> > well. This also includes the case where no tests were run, but st= ill >> > ended with report_summary(). >> >=20 >> > When the whole test is skipped, ./run_tests.sh prints yellow "SKIP= " >> > instead of green "PASS". >> >=20 >> > Return value of 77 is used to please Autotools. I also renamed fe= w >> > things in reporting code and chose to refactor a logic while at it= =2E >> >=20 >> > Signed-off-by: Radim Kr=C4=8Dm=C3=A1=C5=99 >> > --- >> > diff --git a/lib/report.c b/lib/report.c >> > @@ -43,25 +43,28 @@ void report_prefix_pop(void) >> > -void va_report_xfail(const char *msg_fmt, bool xfail, bool cond, = va_list va) >> > +static void va_report(const char *msg_fmt, bool pass, bool xfail,= bool skip, >> > + va_list va) >>=20 >> Making this static disallows unit test writers to create their own >> variable arg report() wrapper functions. Perhaps to determine whethe= r >> or not a skip is in order, e.g. >>=20 >> xyz_report(msg, pass, ...) >> { >> va_list va; >> va_start(va, pass); >> if (xyz) >> va_report(msg, pass, false, false, va); >> else >> va_report(msg, false, false, true, va); >> va_end(va); >> } >=20 > Hmm, while I still think we should avoid using static, to allow new w= rappers, > the wrapper I wrote here as an example wouldn't be necessary if repor= t_skip's > inputs were instead=20 That breaks encapsulation -- if we ever want to change va_report(), we've just made our lives harder. > void report_skip(const char *msg_fmt, bool pass, bool skip, ...) >=20 > Why not do that? Yeah, some cases want to unconditionally skip, so we'd want to have both. I'll think of naming during lunch :)