From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=OpjTmYmH; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: gua.guo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672658292; x=1704194292; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3PeAN4L4gmTxjxUONqxLi+Byro3BmvbTnUcjp4pXFAE=; b=OpjTmYmH/0lLG26fmsVd/mEqOIqT4M/6BQO12mBMA/Hcj2ZARe9NaHVW 1+I23i+2LhFOqJyXriwOaGXF89/jW3h78N3YeddugxvwO5gIML1jfNbGE DW1ikf8QwYJYWvVliYQmvke3yIsxBmuv5RPh+SSXhtObnOVl6AljfeRJw YhkqqJ2qyYSqHqCqKmJonstH7rQWW080vgeyBt/pxn0z9feyz+Rn16MoE LLcJcUFS5GJxg+m7iDZ9T8ikqTpEz1T+nXXCdbq4IEgzYTyJG1IsjEMNz zHH6+/u3JGUVhtkGFH4FwbmLwg6WWXsUTNKyIt4r28i2tjguqp1xReFGP A==; 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" 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" 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: [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> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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'=0D vm_image: 'ubuntu-latest'=0D arch_list: "IA32,X64,ARM,AARCH64,RISCV64,LOONGARCH64"=0D -=0D + extra_install_step:=0D + - bash: sudo apt-get install -y lcov=0D + displayName: Install Code Coverage Tools=0D + condition: and(gt(variables.pkg_count, 0), succeeded())=0D 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'=0D vm_image: 'windows-2019'=0D arch_list: "IA32,X64"=0D + extra_install_step:=0D + - powershell: choco install opencppcoverage; Write-Host "##vso[task.pr= ependpath]C:\Program Files\OpenCppCoverage"=0D + displayName: Install Code Coverage Tool=0D + condition: and(gt(variables.pkg_count, 0), succeeded())=0D +=0D 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: ''=0D vm_image: ''=0D arch_list: ''=0D + extra_install_step: []=0D =0D # Build step=0D jobs:=0D @@ -77,3 +78,38 @@ jobs: build_pkgs: $(Build.Pkgs)=0D build_targets: $(Build.Targets)=0D build_archs: ${{ parameters.arch_list }}=0D + extra_install_step: ${{ parameters.extra_install_step }}=0D +=0D +- job: Build_${{ parameters.tool_chain_tag }}_TARGET_CODE_COVERAGE=0D + dependsOn: Build_${{ parameters.tool_chain_tag }}=0D + workspace:=0D + clean: all=0D +=0D + pool:=0D + vmImage: 'windows-2019'=0D +=0D + steps:=0D + - checkout: self=0D + clean: true=0D + fetchDepth: 1=0D + submodules: true=0D +=0D + - task: DownloadPipelineArtifact@2=0D + displayName: 'Download Build Artifacts'=0D + inputs:=0D + buildType: 'current'=0D + targetPath: '$(Build.ArtifactStagingDirectory)'=0D +=0D + - task: CmdLine@2=0D + displayName: Create code coverage report=0D + inputs:=0D + script: |=0D + dotnet tool install -g dotnet-reportgenerator-globaltool=0D + reportgenerator -reports:$(Build.ArtifactStagingDirectory)/**/co= verage.xml -targetdir:$(Build.ArtifactStagingDirectory)/Coverage -reporttyp= es:Cobertura -filefilters:-*Build*;-*UnitTest*;-*Mock*;*usr/*=0D +=0D + - task: PublishCodeCoverageResults@1=0D + displayName: 'Publish code coverage'=0D + inputs:=0D + codeCoverageTool: Cobertura=0D + summaryFileLocation: '$(Build.ArtifactStagingDirectory)/Coverage/C= obertura.xml'=0D +=0D 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: ''=0D build_targets: ''=0D build_archs: ''=0D + extra_install_step: []=0D =0D steps:=0D - checkout: self=0D @@ -37,6 +38,8 @@ steps: displayName: fetch target branch=0D condition: eq(variables['Build.Reason'], 'PullRequest')=0D =0D +- ${{ parameters.extra_install_step }}=0D +=0D # trim the package list if this is a PR=0D - task: CmdLine@1=0D displayName: Check if ${{ parameters.build_pkgs }} need testing=0D @@ -125,6 +128,7 @@ steps: TestSuites.xml=0D **/BUILD_TOOLS_REPORT.html=0D **/OVERRIDELOG.TXT=0D + coverage.xml=0D flattenFolders: true=0D condition: succeededOrFailed()=0D =0D 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=0D edk2-basetools=3D=3D0.1.39=0D antlr4-python3-runtime=3D=3D4.7.1=0D +lcov-cobertura=3D=3D2.0.2=0D +=0D --=20 2.31.1.windows.1