From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: Re: [PATCH kvm-unit-tests v2 05/12] lib/report: allow test skipping Date: Fri, 18 Dec 2015 12:55:19 -0600 Message-ID: <20151218185519.GE3885@hawk.localdomain> 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> <20151218111818.GB21525@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org, Paolo Bonzini To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41744 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932958AbbLRSzZ (ORCPT ); Fri, 18 Dec 2015 13:55:25 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 4BBA4349E45 for ; Fri, 18 Dec 2015 18:55:25 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20151218111818.GB21525@potion.brq.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Dec 18, 2015 at 12:18:19PM +0100, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: > 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 sk= ipped as > >> > well. This also includes the case where no tests were run, but = still > >> > ended with report_summary(). > >> >=20 > >> > When the whole test is skipped, ./run_tests.sh prints yellow "SK= IP" > >> > instead of green "PASS". > >> >=20 > >> > Return value of 77 is used to please Autotools. I also renamed = few > >> > things in reporting code and chose to refactor a logic while at = it. > >> >=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 xfai= l, 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 whet= her > >> 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= wrappers, > > the wrapper I wrote here as an example wouldn't be necessary if rep= ort_skip's > > inputs were instead=20 >=20 > That breaks encapsulation -- if we ever want to change va_report(), > we've just made our lives harder. OK, let's make it static and extend the API. >=20 > > void report_skip(const char *msg_fmt, bool pass, bool skip, ...) > >=20 > > Why not do that? >=20 > Yeah, some cases want to unconditionally skip, so we'd want to have > both. I'll think of naming during lunch :) > -- > 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