From nobody Wed May 15 04:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621234172; cv=none; d=zohomail.com; s=zohoarc; b=HQl2VQuwTssJHPMTN/Q97Yud7TtvhlLSIKHrQNwNTh08USTvR3gNzNr6l79Evq2HfoSpDH1QguQvBtJZoqP/2bxswbtt/XFsDlh5sTUaE/jcXQnBLr0C27ZpCfQOoDBg0lM8eKyoEaX1yEvkf9Nq7FSPZX+vwsApBK7ciZxFjpE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621234172; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nDwwHyGlGkhc7Z/vOrt8n1DIxG4HgnbDUPsmbP3bwgQ=; b=Pfjv+P0cXgHHyIW40+z9Q5QmwM1QxE5ni6BJFiCFXI65HC0wkaK65h8HauVz0XKjEGlzXHnv/u3g8+58ToCv72arMNFZ8d7WPbsJC6Z7e5uNsPmkhQwvMBZnB3WCe8zpmlOul+YcCTxeGEHp89s6aYQ4hsJxnDchkJcnsPtppdg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621234172865939.6102522809906; Sun, 16 May 2021 23:49:32 -0700 (PDT) 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-194-2sLFF9rxPYSRpzdB61ry_w-1; Mon, 17 May 2021 02:49:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D36B4107ACE4; Mon, 17 May 2021 06:49:24 +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 C82FF5D9F0; Mon, 17 May 2021 06:49:23 +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 3F33A180B463; Mon, 17 May 2021 06:49:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14H6nGO5016793 for ; Mon, 17 May 2021 02:49:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8BBD81F051; Mon, 17 May 2021 06:49:16 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E7E91A86D for ; Mon, 17 May 2021 06:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621234171; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nDwwHyGlGkhc7Z/vOrt8n1DIxG4HgnbDUPsmbP3bwgQ=; b=Xy/osRXruCgCIjLrXq2ux4y++yfsvv4AmS19t/+ZH6ncL6UnY2tPydLEzTkmvtJEJmEEWM rTE3G5R73JTOJSwry8Oa7iS6D5m+pCR+2dNn57YuV0HK01GJ/yPD3vUnFSdWRLCa6bFrgV 6sDjY3MSstQs1pVEF1SZInJ9JCNW0nc= X-MC-Unique: 2sLFF9rxPYSRpzdB61ry_w-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/3] testutils: Drop libtool binary name handling Date: Mon, 17 May 2021 08:49:08 +0200 Message-Id: <4612c267df6655a833ca788f3277e1182fea7efa.1621234104.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Back in the old days, we used to use libtool to run compiled libraries. That meant we had to deal with "lt-" prefix for our binaries. With meson that's no longer the case. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- tests/testutils.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index d6b7c2a580..870a3b081a 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -750,8 +750,7 @@ int virTestMain(int argc, size_t noutputs =3D 0; virLogOutput *output =3D NULL; virLogOutput **outputs =3D NULL; - g_autofree char *baseprogname =3D NULL; - const char *progname; + g_autofree char *progname =3D NULL; g_autofree const char **preloads =3D NULL; size_t npreloads =3D 0; g_autofree char *mock =3D NULL; @@ -784,9 +783,7 @@ int virTestMain(int argc, VIR_TEST_PRELOAD(mock); } =20 - progname =3D baseprogname =3D g_path_get_basename(argv[0]); - if (STRPREFIX(progname, "lt-")) - progname +=3D 3; + progname =3D g_path_get_basename(argv[0]); =20 g_setenv("VIR_TEST_MOCK_PROGNAME", progname, TRUE); =20 --=20 2.26.3 From nobody Wed May 15 04:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621234173; cv=none; d=zohomail.com; s=zohoarc; b=L7ymldQ31XxPG+YORKU6a5Tdi7p3gA51weEo1NrRoKEwLgMaHQ1HZXHpUFtbtqVilZgGE2n6Ea699NdW5c0IPEhuc9c7wvrAeaSXodmagwcjNQrtd0BkpE5fni0cE/0CPy3B84c1FoEASFxI2lB0aNGfDTvtSozH22dPZiVsmNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621234173; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=y147aQZNZCHl3idPBNzQmm1yJ3Q3cQnBqJCQAzfZxS4=; b=DUpm8IkwpMqt7gfIsjznxPr2ktpEIBhUkwNg2Za7YH2CuAlkRlWxER5m/jJ/n3C5rIybCgeUITfG+kg727jwfxwINXYSFlCBdsYJtZtH/LDA2B0BYaluEMmRMtl/xiSRtQAgnII3GvfOBgfxB/tpRx6vwSTiRupbRdxaU5TDANE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621234173514161.02049875609725; Sun, 16 May 2021 23:49:33 -0700 (PDT) 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-498-TkVMHkIlPA2BfCcEeN_alg-1; Mon, 17 May 2021 02:49:30 -0400 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 35C2C107ACE6; Mon, 17 May 2021 06:49:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C33DD50551; Mon, 17 May 2021 06:49:23 +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 15C8155344; Mon, 17 May 2021 06:49:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14H6nHGY016799 for ; Mon, 17 May 2021 02:49:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6588416ED7; Mon, 17 May 2021 06:49:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCAE11F05A for ; Mon, 17 May 2021 06:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621234172; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=y147aQZNZCHl3idPBNzQmm1yJ3Q3cQnBqJCQAzfZxS4=; b=EKoxu3VQb2M/eSjO3S8kGnhNlLwXtSgrPzqE7cT5mTrvJqrB+aM+iaI/afkGn+RmHvJGaN r2fdRjm545+sFjF6xio5G7Uvyd+V9JtoHHmyOwCq/MjmgR2EHkZ2zdNtKnbIzm/r3im2qM usEiE62Zw+Jt+xXu4HaeYkMcFpi1T8I= X-MC-Unique: TkVMHkIlPA2BfCcEeN_alg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/3] tests: Return EXIT_FAILURE/EXIT_SUCCESS instead of -1/0 Date: Mon, 17 May 2021 08:49:09 +0200 Message-Id: <57b21916b49849af80f6742e193e2459eb1cbbdc.1621234104.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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 using VIR_TEST_MAIN() or VIR_TEST_MAIN_PRELOAD() macros, the retval of mymain() will become retval of main(). Hence, mymain() should use EXIT_FAILURE and EXIT_SUCCESS return values for greater portability. Another reason is that otherwise our summary printing of failed tests doesn't work (see following commit for more info). Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- tests/fchosttest.c | 2 +- tests/qemusecuritytest.c | 2 +- tests/scsihosttest.c | 2 +- tests/seclabeltest.c | 2 +- tests/storagepoolcapstest.c | 2 +- tests/virbitmaptest.c | 2 +- tests/vircaps2xmltest.c | 2 +- tests/vircapstest.c | 2 +- tests/virconftest.c | 2 +- tests/virendiantest.c | 2 +- tests/virlogtest.c | 2 +- tests/virresctrltest.c | 2 +- tests/virscsitest.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/fchosttest.c b/tests/fchosttest.c index 44e7f11599..53d02241ca 100644 --- a/tests/fchosttest.c +++ b/tests/fchosttest.c @@ -374,7 +374,7 @@ mymain(void) ret =3D -1; =20 VIR_FREE(fchost_prefix); - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virrandom")) diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c index 184ffca15f..f7186700c4 100644 --- a/tests/qemusecuritytest.c +++ b/tests/qemusecuritytest.c @@ -261,7 +261,7 @@ mymain(void) #endif virObjectUnref(dac); virObjectUnref(stack); - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN_PRELOAD(mymain, diff --git a/tests/scsihosttest.c b/tests/scsihosttest.c index 17825bba35..7508ac37a3 100644 --- a/tests/scsihosttest.c +++ b/tests/scsihosttest.c @@ -282,7 +282,7 @@ mymain(void) VIR_FREE(fakerootdir); VIR_FREE(fakesysfsdir); VIR_FREE(scsihost_class_path); - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/seclabeltest.c b/tests/seclabeltest.c index 39a96d0fc0..b2a11b278c 100644 --- a/tests/seclabeltest.c +++ b/tests/seclabeltest.c @@ -33,7 +33,7 @@ mymain(void) =20 virObjectUnref(mgr); =20 - return 0; + return EXIT_SUCCESS; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/storagepoolcapstest.c b/tests/storagepoolcapstest.c index f937670aa7..526c9ad045 100644 --- a/tests/storagepoolcapstest.c +++ b/tests/storagepoolcapstest.c @@ -101,7 +101,7 @@ mymain(void) DO_TEST("full", fullCaps); DO_TEST("fs", fsCaps); =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/virbitmaptest.c b/tests/virbitmaptest.c index a376a613db..02241c4c20 100644 --- a/tests/virbitmaptest.c +++ b/tests/virbitmaptest.c @@ -784,7 +784,7 @@ mymain(void) if (virTestRun("test16", test16, NULL) < 0) ret =3D -1; =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/vircaps2xmltest.c b/tests/vircaps2xmltest.c index ead3fb88ff..5b1b60124a 100644 --- a/tests/vircaps2xmltest.c +++ b/tests/vircaps2xmltest.c @@ -113,7 +113,7 @@ mymain(void) DO_TEST_FULL("resctrl-skx-twocaches", VIR_ARCH_X86_64, true, true); DO_TEST_FULL("resctrl-fake-feature", VIR_ARCH_X86_64, true, true); =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virnuma")) diff --git a/tests/vircapstest.c b/tests/vircapstest.c index 9299b42bf3..8cb6fafd1d 100644 --- a/tests/vircapstest.c +++ b/tests/vircapstest.c @@ -249,7 +249,7 @@ mymain(void) ret =3D -1; #endif /* WITH_LXC */ =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/virconftest.c b/tests/virconftest.c index 52f68287d6..f1a58b01cf 100644 --- a/tests/virconftest.c +++ b/tests/virconftest.c @@ -465,7 +465,7 @@ mymain(void) if (virTestRun("string-list", testConfParseStringList, NULL) < 0) ret =3D -1; =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 =20 diff --git a/tests/virendiantest.c b/tests/virendiantest.c index 38adef9353..8a6d2f5e2d 100644 --- a/tests/virendiantest.c +++ b/tests/virendiantest.c @@ -108,7 +108,7 @@ mymain(void) if (virTestRun("test2", test2, NULL) < 0) ret =3D -1; =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/virlogtest.c b/tests/virlogtest.c index 44d71015d5..582ac5c5b8 100644 --- a/tests/virlogtest.c +++ b/tests/virlogtest.c @@ -151,7 +151,7 @@ mymain(void) TEST_PARSE_FILTERS_FAIL(":foo", 1); TEST_PARSE_FILTERS_FAIL("1:+", 1); =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/virresctrltest.c b/tests/virresctrltest.c index 00f9f552e5..26fbde3668 100644 --- a/tests/virresctrltest.c +++ b/tests/virresctrltest.c @@ -93,7 +93,7 @@ mymain(void) DO_TEST_UNUSED("resctrl-skx"); DO_TEST_UNUSED("resctrl-skx-twocaches"); =20 - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) diff --git a/tests/virscsitest.c b/tests/virscsitest.c index 84b6f15ec6..0d7c35a261 100644 --- a/tests/virscsitest.c +++ b/tests/virscsitest.c @@ -229,7 +229,7 @@ mymain(void) if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(tmpdir); VIR_FREE(virscsi_prefix); - return ret; + return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 VIR_TEST_MAIN(mymain) --=20 2.26.3 From nobody Wed May 15 04:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1621234189; cv=none; d=zohomail.com; s=zohoarc; b=fz/h0hTSaUc/6x+wHByGYwDGMu46EcBln2sd0CuQxovTqfnaMtlJafda8YMZpscQECkKm41C+01zDhM3+Ohmerb0Q4YuINxoKkxTSWvT2Amw676kSFfbX3nKiIcO/hpW4sI0boXfmdqDny1KZTGlxhLUiHGpUgXOCn+Jrm0+tX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621234189; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yMflix8Dap6YN4ShVP7QU664gj9YYddmydSIpknCOug=; b=lWGclKNxcDGRQ/B7F0bEA2xYBVwtSnYwSQM4UfmCCvnK+ADZ7mud2ZOmLp/YrBbKkhklY6fFnTREXYU2sp7avLteQvF+w+/ZjE7SzwfPM2lf3RPbvcqZRdXWzMhkSSKpNUseDayV8hT314JtWvPPpGK7W4tg4CfN3L1U9CSSPQc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1621234189106842.6688466528483; Sun, 16 May 2021 23:49:49 -0700 (PDT) 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-276-dDHMBMLXO7uR4TkeNVu0tA-1; Mon, 17 May 2021 02:49:45 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BC761013721; Mon, 17 May 2021 06:49:41 +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 7E73F6E6FF; Mon, 17 May 2021 06:49:41 +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 51206180B463; Mon, 17 May 2021 06:49:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14H6nIHS016811 for ; Mon, 17 May 2021 02:49:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 480A01A86D; Mon, 17 May 2021 06:49:18 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B776016ED7 for ; Mon, 17 May 2021 06:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621234188; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yMflix8Dap6YN4ShVP7QU664gj9YYddmydSIpknCOug=; b=bK2RUDdyjRHVLGLfvvW+Liz89mRJmM1i0XtkB6dRrDpMRIz28mE9i3smdYNT5EUhotCXsF Aq3n1nyZKo+bsYqwjnip2F209+r8GGLeR/s30J2JSLEsNTTBatYdVVJ1zBUWqU1J6qaZoe 7zRNuFAgm1Fs6EIn9CImF7ddJtxoPBI= X-MC-Unique: dDHMBMLXO7uR4TkeNVu0tA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] testutils: Document and enforce @func callback retvals for virTestMain() Date: Mon, 17 May 2021 08:49:10 +0200 Message-Id: <403325ac7a71fdf4cacd37339508cf38e6618b32.1621234104.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" Sometimes a test has a wrapper over main() (e.g. because it's preloading some mock libraries). In such case, the main() is renamed to something else (usually mymain()), and main() is generated by calling one of VIR_TEST_MAIN() or VIR_TEST_MAIN_PRELOAD() macros. This has a neat side effect - if mymain() returns an error a short summary is printed, e.g.: Some tests failed. Run them using: VIR_TEST_DEBUG=3D1 VIR_TEST_RANGE=3D5-6 ./virtest However, this detection only works if EXIT_FAILURE is returned by mymain(). Document and enforce this limitation. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- tests/testutils.c | 13 +++++++++++++ tests/testutils.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index 870a3b081a..b57b44fab5 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -838,6 +838,19 @@ int virTestMain(int argc, fprintf(stderr, "%*s", 40 - (int)(testCounter % 40), ""); fprintf(stderr, " %-3zu %s\n", testCounter, ret =3D=3D 0 ? "OK" : = "FAIL"); } + + switch (ret) { + case EXIT_FAILURE: + case EXIT_SUCCESS: + case EXIT_AM_SKIP: + case EXIT_AM_HARDFAIL: + break; + default: + fprintf(stderr, "Test callback did returned invalid value: %d\n", = ret); + ret =3D EXIT_AM_HARDFAIL; + break; + } + if (ret =3D=3D EXIT_FAILURE && !virBitmapIsAllClear(failedTests)) { g_autofree char *failed =3D virBitmapFormat(failedTests); fprintf(stderr, "Some tests failed. Run them using:\n"); diff --git a/tests/testutils.h b/tests/testutils.h index e268a95612..6848323586 100644 --- a/tests/testutils.h +++ b/tests/testutils.h @@ -98,6 +98,10 @@ void virTestQuiesceLibvirtErrors(bool always); void virTestCounterReset(const char *prefix); const char *virTestCounterNext(void); =20 +/** + * The @func shall return EXIT_FAILURE or EXIT_SUCCESS or + * EXIT_AM_SKIP or EXIT_AM_HARDFAIL. + */ int virTestMain(int argc, char **argv, int (*func)(void), --=20 2.26.3