From nobody Tue May 21 07:39:43 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+104288+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+104288+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1683577136; cv=none; d=zohomail.com; s=zohoarc; b=Zm9zZucmDwMXgwB3Z7jN5QbHPh4fsC5nkdns/CoohJEU6HH2I3h+nYRjAzebv51ohwrvG28bYi5l6Gox/tA8n6psyKXqeCzPOYM4R2a5GjYbONeB7/3ujRc44BzdFxYM3qDZE05q5UM/ehPvWYjE2P6RcdXW8XcjT2KCyx2prMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683577136; 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=mzysM7JTJpzI27e9rThuuBK8QdFP8gXnzlPhEHpUQqg=; b=UW9W+PV0UjcufJ2x2wr2AUD0slsCiR3159LgHe5OUDpQQhNK0FNPFlxEgtD6OyXll9L68k85n+h1rYLCCpJt+gBiiSh9SccGEMmAa0zNj/rZTECZQWy+YGkqbnD7MZsaa0kElN+ViYvtuaDiHQ4Kd9KV43oQsxTrFoTc+bnMnzU= 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+104288+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 1683577136416409.8039545121326; Mon, 8 May 2023 13:18:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 19dfYY1788612xrp52TvcTzD; Mon, 08 May 2023 13:18:56 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.891.1683577135427613511 for ; Mon, 08 May 2023 13:18:55 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="329371803" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="329371803" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2023 13:18:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10704"; a="822818459" X-IronPort-AV: E=Sophos;i="5.99,259,1677571200"; d="scan'208";a="822818459" X-Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by orsmga004.jf.intel.com with ESMTP; 08 May 2023 13:18:52 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: Gua Guo , Michael D Kinney , Sean Brogan , Michael Kubacki Subject: [edk2-devel] [PATCH v3] BaseTools/Plugin: Too many execute filess cause "cmd too long" failure Date: Tue, 9 May 2023 04:18:49 +0800 Message-Id: <20230508201849.36-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: v0BZH5tChlno6As0E9DmxoADx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1683577136; bh=Jkt9nkSFjvGxwqQGN9lizA894FoKNRZavDvNvjAD6yM=; h=Cc:Date:From:Reply-To:Subject:To; b=MKKfOHQ1ljhW60UbPMCNRaHjWrS8ETWPEHIgmno2qMhM+EhLa6Dfqlf+yUW/BludHmC pS416myMIuC4VU+vrWFe8SgpL0fGVsE/oEpUgIhoiORN3om5x3Ro2ZWBGIkrDX5zSMzkG xTlsD11sxZXOzwPp8N0X22BQNyols2ydFC0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1683577137269100001 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 too many cov files, 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 (#104288): https://edk2.groups.io/g/devel/message/104288 Mute This Topic: https://groups.io/mt/98769942/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-