From nobody Wed Dec 17 09:21:16 2025 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+97834+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+97834+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1672658293; cv=none; d=zohomail.com; s=zohoarc; b=cn0syhO2o+IkrLL9042h0YGmqmDiDaBbs1lYkfWRI/+idwTL8JJWjNGSJ9pIWoBRpjpVSKODhFCrxQqDFdX4d9ecqzSzEruYNGgvEVU5sWMLXCVlp74NB/Pmd1kcPpLVmXqjQKsHt2e0Btl6G8qqVjWUGsASdNjxj09jULdAmLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672658293; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1A/jeDQkYtIItCVu1o6PAAjW4imI9PMnbONGnvPntJ4=; b=fYLGhn9GZm4lrFfa2vYwlLLwGh81ZymxzHzHt5kQx1flZtvhvyS6MhJwuLrGKuBIWVY8aent6+SisPxPowKAoBQYsMErG9C10VNm8rddPVDwQKVLHBIznu+mGIcUy1A/6MqZyCVl8mCxRq+6vvu1fo1hoI2Wh+BotPdrh8s1dus= 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+97834+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 1672658293540812.1975117770081; Mon, 2 Jan 2023 03:18:13 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id XKgtYY1788612xFiAmTuoVwi; Mon, 02 Jan 2023 03:18:13 -0800 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.33235.1672658287716569998 for ; Mon, 02 Jan 2023 03:18:12 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10577"; a="407727676" X-IronPort-AV: E=Sophos;i="5.96,293,1665471600"; d="scan'208";a="407727676" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2023 03:18:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10577"; a="654471755" X-IronPort-AV: E=Sophos;i="5.96,293,1665471600"; d="scan'208";a="654471755" X-Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by orsmga002.jf.intel.com with ESMTP; 02 Jan 2023 03:18:10 -0800 From: "Guo, Gua" To: devel@edk2.groups.io Cc: Gua Guo , Sean Brogan , Bret Barkelew , Michael D Kinney , Liming Gao Subject: [edk2-devel] [PATCH v7 3/3] .azurepipelines: Install code coverage tool Date: Mon, 2 Jan 2023 19:18:02 +0800 Message-Id: <5318d30db2bb837ebd3718f29f00893e064f1104.1672657976.git.gua.guo@intel.com> In-Reply-To: References: 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: pHPVg12sJ3y8yKcJdLf1NMurx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1672658293; bh=uGhsEBIZhmHtjTlMrILVQdXN1l/Y216UFb3FzPsUnMc=; h=Cc:Date:From:Reply-To:Subject:To; b=IhWY4/AFX75695DwOGrA9H3C8Pq1rdGLcjMqNJiZrujg5C2XmydlAr5BsUhxaM7WSwz DDsut6YpDzEIsjSJIoHvzkn/YcozaflDR6iQsl9HwGF4KIr2Ps0ZFPYagh7wP665e4yDW Vec+WXkhycgJJqblC6yGI5OwlZz+98Qyxd0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1672658294645100013 Content-Type: text/plain; charset="utf-8" From: Gua Guo For Windows add below tool for code coverage 1. OpenCppCoverage: parsing pdb file to generate coverage data 2. pycobertura: show up html format data for coverage data For Linux add below tool for code coverage 1. lcov: parsing gcda gcno file to generate coverage data 2. lcov-cobertura: convert coverage data to cobertura format 3. pycobertura: show up html format data for coverage data Cc: Sean Brogan Cc: Bret Barkelew Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Gua Guo --- .azurepipelines/Ubuntu-GCC5.yml | 5 ++- .azurepipelines/Windows-VS2019.yml | 5 +++ .../templates/pr-gate-build-job.yml | 36 +++++++++++++++++++ .azurepipelines/templates/pr-gate-steps.yml | 4 +++ pip-requirements.txt | 2 ++ 5 files changed, 51 insertions(+), 1 deletion(-) diff --git a/.azurepipelines/Ubuntu-GCC5.yml b/.azurepipelines/Ubuntu-GCC5.= yml index 1acd8d2a46..f83951eeaf 100644 --- a/.azurepipelines/Ubuntu-GCC5.yml +++ b/.azurepipelines/Ubuntu-GCC5.yml @@ -19,4 +19,7 @@ jobs: tool_chain_tag: 'GCC5' vm_image: 'ubuntu-latest' arch_list: "IA32,X64,ARM,AARCH64,RISCV64,LOONGARCH64" - + extra_install_step: + - bash: sudo apt-get install -y lcov + displayName: Install Code Coverage Tools + condition: and(gt(variables.pkg_count, 0), succeeded()) diff --git a/.azurepipelines/Windows-VS2019.yml b/.azurepipelines/Windows-V= S2019.yml index e4bd4b1d22..c07e5bb434 100644 --- a/.azurepipelines/Windows-VS2019.yml +++ b/.azurepipelines/Windows-VS2019.yml @@ -18,3 +18,8 @@ jobs: tool_chain_tag: 'VS2019' vm_image: 'windows-2019' arch_list: "IA32,X64" + extra_install_step: + - powershell: choco install opencppcoverage; Write-Host "##vso[task.pr= ependpath]C:\Program Files\OpenCppCoverage" + displayName: Install Code Coverage Tool + condition: and(gt(variables.pkg_count, 0), succeeded()) + diff --git a/.azurepipelines/templates/pr-gate-build-job.yml b/.azurepipeli= nes/templates/pr-gate-build-job.yml index 7f88b41dc8..f148ec23e2 100644 --- a/.azurepipelines/templates/pr-gate-build-job.yml +++ b/.azurepipelines/templates/pr-gate-build-job.yml @@ -12,6 +12,7 @@ parameters: tool_chain_tag: '' vm_image: '' arch_list: '' + extra_install_step: [] =20 # Build step jobs: @@ -77,3 +78,38 @@ jobs: build_pkgs: $(Build.Pkgs) build_targets: $(Build.Targets) build_archs: ${{ parameters.arch_list }} + extra_install_step: ${{ parameters.extra_install_step }} + +- job: Build_${{ parameters.tool_chain_tag }}_TARGET_CODE_COVERAGE + dependsOn: Build_${{ parameters.tool_chain_tag }} + workspace: + clean: all + + pool: + vmImage: 'windows-2019' + + steps: + - checkout: self + clean: true + fetchDepth: 1 + submodules: true + + - task: DownloadPipelineArtifact@2 + displayName: 'Download Build Artifacts' + inputs: + buildType: 'current' + targetPath: '$(Build.ArtifactStagingDirectory)' + + - task: CmdLine@2 + displayName: Create code coverage report + inputs: + script: | + dotnet tool install -g dotnet-reportgenerator-globaltool + reportgenerator -reports:$(Build.ArtifactStagingDirectory)/**/co= verage.xml -targetdir:$(Build.ArtifactStagingDirectory)/Coverage -reporttyp= es:Cobertura -filefilters:-*Build*;-*UnitTest*;-*Mock*;*usr/* + + - task: PublishCodeCoverageResults@1 + displayName: 'Publish code coverage' + inputs: + codeCoverageTool: Cobertura + summaryFileLocation: '$(Build.ArtifactStagingDirectory)/Coverage/C= obertura.xml' + diff --git a/.azurepipelines/templates/pr-gate-steps.yml b/.azurepipelines/= templates/pr-gate-steps.yml index cb431e53fc..080f60aea6 100644 --- a/.azurepipelines/templates/pr-gate-steps.yml +++ b/.azurepipelines/templates/pr-gate-steps.yml @@ -12,6 +12,7 @@ parameters: build_pkgs: '' build_targets: '' build_archs: '' + extra_install_step: [] =20 steps: - checkout: self @@ -37,6 +38,8 @@ steps: displayName: fetch target branch condition: eq(variables['Build.Reason'], 'PullRequest') =20 +- ${{ parameters.extra_install_step }} + # trim the package list if this is a PR - task: CmdLine@1 displayName: Check if ${{ parameters.build_pkgs }} need testing @@ -125,6 +128,7 @@ steps: TestSuites.xml **/BUILD_TOOLS_REPORT.html **/OVERRIDELOG.TXT + coverage.xml flattenFolders: true condition: succeededOrFailed() =20 diff --git a/pip-requirements.txt b/pip-requirements.txt index be8c7a1c37..4ffcadddd8 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -16,3 +16,5 @@ edk2-pytool-library=3D=3D0.12.1 edk2-pytool-extensions~=3D0.20.0 edk2-basetools=3D=3D0.1.39 antlr4-python3-runtime=3D=3D4.7.1 +lcov-cobertura=3D=3D2.0.2 + --=20 2.31.1.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 (#97834): https://edk2.groups.io/g/devel/message/97834 Mute This Topic: https://groups.io/mt/96004774/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-