|
| 1 | +parameters: |
| 2 | +- name: arch |
| 3 | + type: string |
| 4 | + values: |
| 5 | + - amd64 |
| 6 | + default: amd64 |
| 7 | + |
| 8 | +- name: pool |
| 9 | + type: string |
| 10 | + values: |
| 11 | + - sonicbld |
| 12 | + - default |
| 13 | + default: default |
| 14 | + |
| 15 | +- name: timeout |
| 16 | + type: number |
| 17 | + default: 180 |
| 18 | + |
| 19 | +- name: sonic_slave |
| 20 | + type: string |
| 21 | + |
| 22 | +- name: sairedis_artifact_name |
| 23 | + type: string |
| 24 | + |
| 25 | +- name: swss_common_artifact_name |
| 26 | + type: string |
| 27 | + |
| 28 | +- name: swss_artifact_name |
| 29 | + type: string |
| 30 | + |
| 31 | +- name: artifact_name |
| 32 | + type: string |
| 33 | + |
| 34 | +- name: archive_gcov |
| 35 | + type: boolean |
| 36 | + default: false |
| 37 | + |
| 38 | +jobs: |
| 39 | +- job: |
| 40 | + displayName: ${{ parameters.arch }} |
| 41 | + timeoutInMinutes: ${{ parameters.timeout }} |
| 42 | + |
| 43 | + pool: |
| 44 | + ${{ if ne(parameters.pool, 'default') }}: |
| 45 | + name: ${{ parameters.pool }} |
| 46 | + ${{ if eq(parameters.pool, 'default') }}: |
| 47 | + vmImage: 'ubuntu-20.04' |
| 48 | + |
| 49 | + container: |
| 50 | + image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest |
| 51 | + |
| 52 | + |
| 53 | + steps: |
| 54 | + - script: | |
| 55 | + sudo apt-get install -y lcov |
| 56 | + displayName: "Install dependencies" |
| 57 | + condition: eq('${{ parameters.archive_gcov }}', true) |
| 58 | + - task: DownloadPipelineArtifact@2 |
| 59 | + inputs: |
| 60 | + artifact: ${{ parameters.artifact_name }} |
| 61 | + displayName: "Download gcov artifact" |
| 62 | + condition: eq('${{ parameters.archive_gcov }}', true) |
| 63 | + - script: | |
| 64 | + set -x |
| 65 | + ls -lh |
| 66 | + sudo tar -zxvf sonic-gcov.tar.gz |
| 67 | + sudo cp -rf sonic-gcov $(Build.ArtifactStagingDirectory) |
| 68 | + sudo rm sonic-gcov.tar.gz |
| 69 | + ls -lh |
| 70 | + workingDirectory: $(Pipeline.Workspace) |
| 71 | + displayName: "store sonic-gcov" |
| 72 | + condition: eq('${{ parameters.archive_gcov }}', true) |
| 73 | + - checkout: self |
| 74 | + submodules: true |
| 75 | + condition: eq('${{ parameters.archive_gcov }}', true) |
| 76 | + - script: | |
| 77 | + set -x |
| 78 | + wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb |
| 79 | + sudo dpkg -i packages-microsoft-prod.deb |
| 80 | + sudo apt-get update |
| 81 | + sudo apt-get install -y dotnet-sdk-5.0 |
| 82 | + pushd ./s/ |
| 83 | + sudo tar -zcvf swss.tar.gz ./* |
| 84 | + ls -lh ./* |
| 85 | + cp ./gcovpreload/lcov_cobertura.py $(Build.ArtifactStagingDirectory)/ |
| 86 | + cp ./tests/gcov_support.sh $(Build.ArtifactStagingDirectory)/sonic-gcov |
| 87 | + sudo cp -rf swss.tar.gz $(Build.ArtifactStagingDirectory)/sonic-gcov |
| 88 | + popd |
| 89 | + sudo cp -rf $(Build.ArtifactStagingDirectory)/sonic-gcov ./ |
| 90 | + pushd sonic-gcov |
| 91 | + ls -lh ./* |
| 92 | + sudo chmod +x ./gcov_support.sh |
| 93 | + sudo ./gcov_support.sh generate |
| 94 | + sudo ./gcov_support.sh merge_container_info $(Build.ArtifactStagingDirectory) |
| 95 | + sudo cp -rf gcov_output $(Build.ArtifactStagingDirectory) |
| 96 | + ls -lh $(Build.ArtifactStagingDirectory) |
| 97 | + popd |
| 98 | + workingDirectory: $(Pipeline.Workspace) |
| 99 | + displayName: "generate gcov reports" |
| 100 | + condition: eq('${{ parameters.archive_gcov }}', true) |
| 101 | +
|
| 102 | + - publish: $(Build.ArtifactStagingDirectory)/gcov_output |
| 103 | + artifact: gcov_info |
| 104 | + displayName: "Archive gcov info" |
| 105 | + condition: eq('${{ parameters.archive_gcov }}', true) |
| 106 | + |
| 107 | + - task: PublishCodeCoverageResults@1 |
| 108 | + inputs: |
| 109 | + codeCoverageTool: Cobertura |
| 110 | + summaryFileLocation: '$(Build.ArtifactStagingDirectory)/gcov_output/AllMergeReport/coverage.xml' |
| 111 | + reportDirectory: '$(Build.ArtifactStagingDirectory)/gcov_output/AllMergeReport/' |
| 112 | + displayName: 'Publish c c++ test coverage' |
| 113 | + condition: eq('${{ parameters.archive_gcov }}', true) |
| 114 | + |
0 commit comments