From nobody Sat Apr 20 10:29:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1581006923839903.917466456473; Thu, 6 Feb 2020 08:35:23 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-168-A9JNvOIWOqCxTkijWIfH2w-1; Thu, 06 Feb 2020 11:35:19 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2139319324BF; Thu, 6 Feb 2020 16:35:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A201360BEC; Thu, 6 Feb 2020 16:35:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8B8A918089C8; Thu, 6 Feb 2020 16:35:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 016GZAo7000665 for ; Thu, 6 Feb 2020 11:35:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id C41F38DC1F; Thu, 6 Feb 2020 16:35:10 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-34.brq.redhat.com [10.40.200.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19C708DC1B for ; Thu, 6 Feb 2020 16:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581006922; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=BnSU6swPtHubhzFv0B5i3Sz46x1gaPVHs2RMVUoheLE=; b=QSefiwvgLtt/alVegkegDsSbkhIkMSnlB+ptMBvWSVWMZo8V4PfOgddJ9n/Zsz26EoTvDk SCY7QueepG18FdGItVUQbGr96Wf51NVxB4G2PI/zkCvdOl6VJ472DoKGjXheuXupFeU4ki PWAgKfLF6l96jPPQApGjJYCfBoAcmNg= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] testutils: print a helpful summary of failed tests Date: Thu, 6 Feb 2020 17:35:05 +0100 Message-Id: <8c807eeae7a69e4c488469bd8b08105dd9e9d12e.1581006903.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: A9JNvOIWOqCxTkijWIfH2w-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When debugging test failures in seven independent test cases, it might be helpful to only gather the debug output of the failing cases. Record the indexes of the tests that fail and print them in the VIR_TEST_RANGE of the command line that will result in only those tests being run. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/testutils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index 7b9a5ea05b..0cf0ac7e5c 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -54,6 +54,7 @@ static unsigned int testRegenerate =3D -1; =20 static size_t testCounter; static virBitmapPtr testBitmap; +static virBitmapPtr failedTests; =20 virArch virTestHostArch =3D VIR_ARCH_X86_64; =20 @@ -172,6 +173,9 @@ virTestRun(const char *title, fprintf(stderr, "!"); } =20 + if (ret !=3D 0) + ignore_value(virBitmapSetBitExpand(failedTests, testCounter)); + g_unsetenv("VIR_TEST_MOCK_TESTNAME"); return ret; } @@ -930,6 +934,9 @@ int virTestMain(int argc, } } =20 + if (!(failedTests =3D virBitmapNew(1))) + return EXIT_FAILURE; + ret =3D (func)(); =20 virResetLastError(); @@ -938,6 +945,11 @@ int virTestMain(int argc, fprintf(stderr, "%*s", 40 - (int)(testCounter % 40), ""); fprintf(stderr, " %-3zu %s\n", testCounter, ret =3D=3D 0 ? "OK" : = "FAIL"); } + if (ret =3D=3D EXIT_FAILURE && !virBitmapIsAllClear(failedTests)) { + g_autofree char *failed =3D virBitmapFormat(failedTests); + fprintf(stderr, "Some tests failed. Run them using:\n"); + fprintf(stderr, "VIR_TEST_DEBUG=3D1 VIR_TEST_RANGE=3D%s %s\n", fai= led, argv[0]); + } virLogReset(); return ret; } --=20 2.21.1