From nobody Mon Feb 9 04:03:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61253+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61253+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1592180377; cv=none; d=zohomail.com; s=zohoarc; b=n6stZZGAhZyeDXbPOrdU/YurXVbzuhxZ9owq21w87gTGAYqV7pvOo25Gz8r0mbGfP/7qvKAsNy70SVzZBw3TaluqeGUA+w1Bihvlt1E9ZDnpdXrnqmew8BYanQBf/lzvWrClMEhU0Y5wmdscijZFldZL6NlYLXErzgeyo8JJjXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592180377; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=rhLt+od2ZSBN/wJkvlt/NkQC8LGt2ZhkUCRlGi20Vb4=; b=TbTgmSGjtYpsyj/IjbxiRR0+yAkkkQ3MvHNgJv96xTxAsPdJ2sP1X2qZJGqeEeIawXAoNPbluFh7VIW/pAd04mB7+V08/DKwB6b3Vvb9+ZmrusaFz/4DlRsPwWp1S1HU2DLkM1H84kDw/7kweGSSrHy8AsQOai3ZWOFTFXzd+cA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61253+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592180377087971.7945702391062; Sun, 14 Jun 2020 17:19:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id C8PtYY1788612xM8YCTu7UYy; Sun, 14 Jun 2020 17:19:36 -0700 X-Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web12.7397.1592180374394024448 for ; Sun, 14 Jun 2020 17:19:35 -0700 IronPort-SDR: 4MJpXWIJCsym+F3GEk3QtWjIBR045IJtC2xhcggabP0md2GECox2V9wKwdWjruzJEDVGVEnaew JA1ysZRi56ZA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2020 17:19:25 -0700 IronPort-SDR: w9AfY2rSxz4IDYa6h3IHtEeuu+7vJRdsvOSCX8RJ/uHR8DXFz3MWiyiApf4wsZordtmOKpDSEN jqiHfRfFET4Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,513,1583222400"; d="scan'208";a="276370278" X-Received: from mdkinney-mobl2.amr.corp.intel.com ([10.252.142.246]) by orsmga006.jf.intel.com with ESMTP; 14 Jun 2020 17:19:25 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Sean Brogan , Bret Barkelew , Jiewen Yao Subject: [edk2-devel] [Patch 10/15] UnitTestFrameworkPkg/UnitTestLib: Move print log into cleanup Date: Sun, 14 Jun 2020 17:19:13 -0700 Message-Id: <20200615001918.22164-11-michael.d.kinney@intel.com> In-Reply-To: <20200615001918.22164-1-michael.d.kinney@intel.com> References: <20200615001918.22164-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com X-Gm-Message-State: VAXr0x13mDRlsFD0pMnOqKlUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592180376; bh=UeBcvk3iLx/BY/Lr2aZHz4EPaaS2mpgnTDIUfg5XNN0=; h=Cc:Date:From:Reply-To:Subject:To; b=O4rjPCySFRB3KnTCqrHapbvaqTLNDXWoITc35QysBYQt86KB8u1hl0D6vX4482cV8rx bEjWZb8G6eN0VP628pAfShmom5WgYd6hC2nW1GWBYnFrQa2Jf07IoTs9kLdmdNRnALYv0 zqz8XaoFbCN5OGKlX/p/y0Q9jaTgQA7k9SY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D2805 If a unit test fails with an exception or an assert, then the CmockaUnitTestFunctionRunner() is terminated and the logic that follows the invocation of the unit test is skipped. This currently skips the logic that prints log messages. Move the print of log messages to the beginning of CmockaUnitTestTeardownFunctionRunner() that is guaranteed to be executed when a unit test completes normally or is terminated with an exception or an assert. Cc: Sean Brogan Cc: Bret Barkelew Cc: Jiewen Yao Signed-off-by: Michael D Kinney --- .../Library/UnitTestLib/RunTestsCmocka.c | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c b/Un= itTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c index fb81cc9658..29f4752d59 100644 --- a/UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c +++ b/UnitTestFrameworkPkg/Library/UnitTestLib/RunTestsCmocka.c @@ -53,21 +53,9 @@ CmockaUnitTestFunctionRunner ( UnitTest->Result =3D UNIT_TEST_SKIPPED; } else { UnitTest->Result =3D UNIT_TEST_RUNNING; - Framework->CurrentTest =3D UnitTest; UnitTest->Result =3D UnitTest->RunTest (UnitTest->Context); Framework->CurrentTest =3D NULL; - - // Print out the log messages - This is a partial solution as it - // does not get the log into the XML. Need cmocka changes to support - // stdout and stderr in their xml format - // - if (UnitTest->Log !=3D NULL) { - print_message("UnitTest: %s - %s\n", UnitTest->Name, UnitTest->Descr= iption); - print_message("Log Output Start\n"); - print_message("%s", UnitTest->Log); - print_message("Log Output End\n"); - } } } =20 @@ -112,6 +100,18 @@ CmockaUnitTestTeardownFunctionRunner ( Suite =3D (UNIT_TEST_SUITE *)(UnitTest->ParentSuite); Framework =3D (UNIT_TEST_FRAMEWORK *)(Suite->ParentFramework); =20 + // + // Print out the log messages - This is a partial solution as it + // does not get the log into the XML. Need cmocka changes to support + // stdout and stderr in their xml format + // + if (UnitTest->Log !=3D NULL) { + print_message("UnitTest: %s - %s\n", UnitTest->Name, UnitTest->Descrip= tion); + print_message("Log Output Start\n"); + print_message("%s", UnitTest->Log); + print_message("Log Output End\n"); + } + if (UnitTest->CleanUp =3D=3D NULL) { return 0; } @@ -119,6 +119,7 @@ CmockaUnitTestTeardownFunctionRunner ( Framework->CurrentTest =3D UnitTest; UnitTest->CleanUp (UnitTest->Context); Framework->CurrentTest =3D NULL; + // // Return 0 for success. Non-zero for error. // --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#61253): https://edk2.groups.io/g/devel/message/61253 Mute This Topic: https://groups.io/mt/74885923/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-