From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from zrleap.intel-email.com (zrleap.intel-email.com [114.80.218.36]) by mx.groups.io with SMTP id smtpd.web10.29219.1681873167249505046 for ; Tue, 18 Apr 2023 19:59:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=XIklFlFK; spf=pass (domain: byosoft.com.cn, ip: 114.80.218.36, mailfrom: gaoliming@byosoft.com.cn) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id E82FFA32E1AB for ; Wed, 19 Apr 2023 10:59:23 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1681873164; bh=L+9oVog1txc9LHTyQ4u41k2kAoIu/zMaBJrNDNZDOAA=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=XIklFlFKRZgZGxVEX2oqgzeijRjAhvxb3puZEauyedivgDxRvLpxXvASyKbFnlKfg aqgbaEfSitIqfaeVsylhBs1wzNSTipDIr1S3jhopn2MeMzRcRzHKk/P3h8FoORKJ9R RKS0egQYUOeNObEOPn6qZ4m6zQ+aocXXa8KzJmCU= Received: from localhost (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 187ECA32E178 for ; Wed, 19 Apr 2023 10:59:22 +0800 (CST) Received: from zrleap.intel-email.com (localhost [127.0.0.1]) by zrleap.intel-email.com (Postfix) with ESMTP id 9E343A32E1BD for ; Wed, 19 Apr 2023 10:59:21 +0800 (CST) Authentication-Results: zrleap.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by zrleap.intel-email.com (Postfix) with SMTP id 2DA49A32E160 for ; Wed, 19 Apr 2023 10:59:18 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Wed, 19 Apr 2023 10:59:12 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , Cc: "'Rebecca Cran'" , "'Bob Feng'" , "'Yuwei Chen'" , "'Michael D Kinney'" , "'Sean Brogan'" References: <20230418161104.595-1-mikuback@linux.microsoft.com> In-Reply-To: <20230418161104.595-1-mikuback@linux.microsoft.com> Subject: =?UTF-8?B?5Zue5aSNOiBbUEFUQ0ggdjEgMS8xXSBCYXNlVG9vbHMvUGx1Z2luOiBDbGFyaWZ5IGNvZGUgY292ZXJhZ2UgZmFpbHVyZSBtZXNzYWdl?= Date: Wed, 19 Apr 2023 10:59:14 +0800 Message-ID: <011001d9726a$ec9aad40$c5d007c0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQF7DIgfhrBDHgV6L1gvSkyQWPW3NK/uvMPg Sender: "gaoliming" Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Reviewed-by: Liming Gao > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: mikuback@linux.microsoft.com = > =B7=A2=CB=CD=CA=B1=BC=E4: 2023=C4=EA4=D4=C219=C8=D5 0:11 > =CA=D5=BC=FE=C8=CB: devel@edk2.groups.io > =B3=AD=CB=CD: Rebecca Cran ; Liming Gao > ; Bob Feng ; Yuwei = Chen > ; Michael D Kinney ; > Sean Brogan > =D6=F7=CC=E2: [PATCH v1 1/1] BaseTools/Plugin: Clarify code coverage = failure message >=20 > From: Michael Kubacki >=20 > HostBasedUnitTestRunner.py is a build plugin responsible for locating > and executing host-based unit tests. >=20 > Recently, commit 6bb00aa introduced support for the plugin to > generate code coverage reports via lcov and OpenCppCoverage. >=20 > The plugin has discovered unit tests by searching for executables > with "Test" in the name for a while. However, the test coverage > change makes assumptions about test presence when crafting the > OpenCppCoverage command that ultimately fails with an ambiguous error > message if no host-based unit tests are discovered (see "ERROR"). >=20 > ``` > SECTION - Run Host based Unit Tests > SUBSECTION - Testing for architecture: X64 > ERROR - UnitTest Coverage: Failed to generate cobertura format xml in > single package. > PROGRESS - --->Test Success: Host Unit Test Compiler Plugin NOOPT > ``` >=20 > This change preempts that message with a check in the plugin to > determine if any host-based tests were discovered. If not, a message > is printed with more guidance about how the developer should proceed > to either (1) fix their tests so code coverage is generated as > expected or (2) prevent the error message. >=20 > New message: >=20 > ``` > SECTION - Run Host based Unit Tests > SUBSECTION - Testing for architecture: X64 > WARNING - UnitTest Coverage: > No unit tests discovered. Test coverage will not be generated. >=20 > Prevent this message by: > 1. Adding host-based unit tests to this package > 2. Ensuring tests have the word "Test" in their name > 3. Disabling HostUnitTestCompilerPlugin in the package CI YAML file > PROGRESS - --->Test Success: Host Unit Test Compiler Plugin NOOPT > ``` >=20 > Cc: Rebecca Cran > Cc: Liming Gao > Cc: Bob Feng > Cc: Yuwei Chen > Cc: Michael D Kinney > Cc: Sean Brogan > Signed-off-by: Michael Kubacki > --- > BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py | > 13 +++++++++++++ > 1 file changed, 13 insertions(+) >=20 > diff --git > a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py > b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py > index 0e013c5f1a7f..a384b556294c 100644 > --- > a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py > +++ > b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py > @@ -16,6 +16,7 @@ import edk2toollib.windows.locate_tools as = locate_tools > from edk2toolext.environment import shell_environment > from edk2toollib.utility_functions import RunCmd > from edk2toollib.utility_functions import GetHostInfo > +from textwrap import dedent >=20 >=20 > class HostBasedUnitTestRunner(IUefiBuildPlugin): > @@ -84,6 +85,18 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin): > else: > raise NotImplementedError("Unsupported Operating > System") >=20 > + if not testList: > + logging.warning(dedent(""" > + UnitTest Coverage: > + No unit tests discovered. Test coverage will = not > be generated. > + > + Prevent this message by: > + 1. Adding host-based unit tests to this package > + 2. Ensuring tests have the word "Test" in their > name > + 3. Disabling HostUnitTestCompilerPlugin in the > package CI YAML file > + """).strip()) > + return 0 > + > for test in testList: > # Configure output name if test uses cmocka. > shell_env.set_shell_var( > -- > 2.40.0.windows.1