From nobody Tue May 21 18:24:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104287+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104287+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1683576775; cv=none; d=zohomail.com; s=zohoarc; b=OLxxk6zwWmxlInLEDqbuP7E0YrwoOr3CmM3U6gKfrnRal+NVunacLVBuIMj2GzWftfGKV/QPOzdrR4gQSZs3C/BymT+hA8J2RFyEtY6HBlcTay19iB51fuXwCHK5iWwWh/HkVh1lcHWwAzEqBeSRRX02v8FR4nASNCkBxQrCGoQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683576775; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=L8c/CqqSxEteksOGc7vfRQj9TBVtACk5jQ9CgAbwZ5I=; b=UbE3WmoYIn0fvEzQ9i0vNkVOmLRjxmwF7b6YUKD+6+fAwp4Dq5aZArlgBlt6rEhexLNphpZbDjdr429uNiGw0q9TYOTLW8vZofhwbyv5EWIf695rkvO5VyNHPC7zXu/PntBOwDkqK9EgXiIcPgMWThM/d/U7lp4AU/TSx8Iwlbc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104287+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1683576775949883.1411894487237; Mon, 8 May 2023 13:12:55 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id UqT0YY1788612xhutbOGljI6; Mon, 08 May 2023 13:12:55 -0700 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.803.1683576774865909371 for ; Mon, 08 May 2023 13:12:55 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="334193359" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="334193359" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 13:12:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="698640359" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="698640359" X-Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by orsmga002.jf.intel.com with ESMTP; 08 May 2023 13:12:52 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: Gua Guo , Michael D Kinney , Sean Brogan , Michael Kubacki Subject: [edk2-devel] [PATCH v2] BaseTools/Plugin: Too many execute file report cmd too long failure Date: Tue, 9 May 2023 04:12:49 +0800 Message-Id: <20230508201249.291-1-gua.guo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,gua.guo@intel.com X-Gm-Message-State: wZmyUHyzEspveAeG2V1aN1pWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683576775; bh=en0ebQl25WtQlFFcvy4IFOPFbrTRZiZqyvmP/o2cv1I=; h=Cc:Date:From:Reply-To:Subject:To; b=mVMccywjjP1PL18ThDMphYdTDofHh85rafwvQOjHfdQL2zQNmXXNqbOkOpUlDVe30DV HsS64Su9m2spWN5VfqoyTX2CQ7uP4Aejmi4y9MaE8PqionimQT+cSzRnR6TkG75IS9HRI hfywJPvpjLgNgMR9bBwoUUfGVwodT3Mgd68= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683576776244100001 Content-Type: text/plain; charset="utf-8" From: Gua Guo Windows command prompt have 8191 characters limitation, enhance it to make command too long can be resloved. Provide an example, if have to many *.cov, it causes to run single command over the 8191 characters limitation. > OpenCppCoverage > --export_type binary:coverage.cov > --working_dir=3D{workspace}Build > --input_coverage=3DAAA.cov > ... > --input_coverage=3DNNN.cov The solution is passing many coverage files in single command line to breaking it up into many command lines with one coverage file per command line in order to prevent single line is over to 8191 characters. - Command Line 1 > OpenCppCoverage > --export_type binary:coverage.cov > --working_dir=3D{workspace}Build > --input_coverage=3DAAA.cov > --input_coverage=3Dcoverage.cov ... - Command Line N > OpenCppCoverage > --export_type binary:coverage.cov > --working_dir=3D{workspace}Build > --input_coverage=3DNNN.cov > --input_coverage=3Dcoverage.cov Cc: Michael D Kinney Cc: Sean Brogan Cc: Michael Kubacki Signed-off-by: Gua Guo --- .../HostBasedUnitTestRunner.py | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunn= er.py b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py index d993de9412..05bb6da50a 100644 --- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py +++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py @@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin): coverageFile =3D "" for testFile in testList: ret =3D RunCmd("OpenCppCoverage", f"--source {workspace} --exp= ort_type binary:{testFile}.cov -- {testFile}") - coverageFile +=3D " --input_coverage=3D" + testFile + ".cov" + if ret !=3D 0: + logging.error("UnitTest Coverage: Failed to collect covera= ge data.") + return 1 + + coverageFile =3D f" --input_coverage=3D{testFile}.cov" + if (os.path.isfile(f"{os.path.join(buildOutputBase, 'coverage.= cov')}")): + coverageFile +=3D f" --input_coverage=3D{os.path.join(buil= dOutputBase, 'coverage.cov')}" + ret =3D RunCmd("OpenCppCoverage", f"--export_type binary:{os.p= ath.join(buildOutputBase, 'coverage.cov')} --working_dir=3D{workspace}Build= {coverageFile}") if ret !=3D 0: logging.error("UnitTest Coverage: Failed to collect covera= ge data.") return 1 =20 # Generate and XML file if requested.by each package - ret =3D RunCmd("OpenCppCoverage", f"--export_type cobertura:{os.pa= th.join(buildOutputBase, 'coverage.xml')} --working_dir=3D{workspace}Build = {coverageFile}") + ret =3D RunCmd( + "OpenCppCoverage", + f"--export_type cobertura:{os.path.join(buildOutputBase, 'cove= rage.xml')} " + + f"--working_dir=3D{workspace}Build " + + f"--input_coverage=3D{os.path.join(buildOutputBase, 'coverage.= cov')}" + ) if ret !=3D 0: logging.error("UnitTest Coverage: Failed to generate cobertura= format xml in single package.") return 1 @@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin): testCoverageList =3D glob.glob(os.path.join(workspace, "Build", "*= *","*Test*.exe.cov"), recursive=3DTrue) coverageFile =3D "" for testCoverage in testCoverageList: - coverageFile +=3D " --input_coverage=3D" + testCoverage + coverageFile =3D f" --input_coverage=3D{testCoverage}" + if (os.path.isfile(f"{workspace}Build/coverage.cov")): + coverageFile +=3D f" --input_coverage=3D{workspace}Build/c= overage.cov" + ret =3D RunCmd("OpenCppCoverage", f"--export_type binary:{work= space}Build/coverage.cov --working_dir=3D{workspace}Build {coverageFile}") + if ret !=3D 0: + logging.error("UnitTest Coverage: Failed to collect covera= ge data.") + return 1 =20 - ret =3D RunCmd("OpenCppCoverage", f"--export_type cobertura:{works= pace}Build/coverage.xml --working_dir=3D{workspace}Build {coverageFile}") + ret =3D RunCmd( + "OpenCppCoverage", + f"--export_type cobertura:{workspace}Build/coverage.xml " + + f"--working_dir=3D{workspace}Build " + + f"--input_coverage=3D{workspace}Build/coverage.cov" + ) if ret !=3D 0: logging.error("UnitTest Coverage: Failed to generate cobertura= format xml.") return 1 --=20 2.39.2.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 (#104287): https://edk2.groups.io/g/devel/message/104287 Mute This Topic: https://groups.io/mt/98769807/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-