Skip to content

Commit

Permalink
Merge remote-tracking branch 'public/master' into v6erspan_master
Browse files Browse the repository at this point in the history
  • Loading branch information
wendani committed Dec 15, 2021
2 parents 6f3315c + 5d5c169 commit f9a3d74
Show file tree
Hide file tree
Showing 307 changed files with 60,648 additions and 5,718 deletions.
71 changes: 53 additions & 18 deletions .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ parameters:
type: string
values:
- sonicbld
- sonicbld-armhf
- sonicbld-arm64
- default
default: default

Expand All @@ -21,6 +23,12 @@ parameters:
- name: sonic_slave
type: string

- name: buildimage_artifact_name
type: string

- name: buildimage_pipeline
type: number

- name: sairedis_artifact_name
type: string

Expand All @@ -34,6 +42,10 @@ parameters:
type: boolean
default: false

- name: archive_gcov
type: boolean
default: false

jobs:
- job:
displayName: ${{ parameters.arch }}
Expand All @@ -49,15 +61,14 @@ jobs:
image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest

steps:
- checkout: self
clean: true
submodules: true
- script: |
sudo apt-get install -y libhiredis0.14 libhiredis-dev
sudo apt-get install -y libzmq5 libzmq3-dev
sudo apt-get install -qq -y \
libhiredis-dev \
libnl-3-dev \
libnl-genl-3-dev \
libnl-route-3-dev \
libnl-nf-3-dev \
swig3.0
sudo apt-get install -y libdbus-1-3
sudo apt-get install -y libteam-dev \
Expand All @@ -69,37 +80,61 @@ jobs:
source: specific
project: build
pipeline: 9
artifacts: ${{ parameters.swss_common_artifact_name }}
artifact: ${{ parameters.swss_common_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
path: '$(Build.SourcesDirectory)/${{ parameters.swss_common_artifact_name }}'
displayName: "Download sonic swss common deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 12
artifacts: ${{ parameters.sairedis_artifact_name }}
artifact: ${{ parameters.sairedis_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
path: '$(Build.SourcesDirectory)/${{ parameters.sairedis_artifact_name }}'
displayName: "Download sonic sairedis deb packages"
- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: ${{ parameters.buildimage_pipeline }}
artifact: ${{ parameters.buildimage_artifact_name }}
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
path: '$(Build.SourcesDirectory)/${{ parameters.buildimage_artifact_name }}'
displayName: "Download sonic buildimage deb packages"
- script: |
sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i ${{ parameters.swss_common_artifact_name }}/libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs_*.deb
sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaivs-dev_*.deb
sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsairedis_*.deb
sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsairedis-dev_*.deb
sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaimetadata_*.deb
sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/libsaimetadata-dev_*.deb
sudo dpkg -i ${{ parameters.sairedis_artifact_name }}/syncd-vs_*.deb
cd $(Build.SourcesDirectory)/${{ parameters.buildimage_artifact_name }}
sudo dpkg -i target/debs/buster/libnl-3-200_*.deb
sudo dpkg -i target/debs/buster/libnl-3-dev_*.deb
sudo dpkg -i target/debs/buster/libnl-genl-3-200_*.deb
sudo dpkg -i target/debs/buster/libnl-genl-3-dev_*.deb
sudo dpkg -i target/debs/buster/libnl-route-3-200_*.deb
sudo dpkg -i target/debs/buster/libnl-route-3-dev_*.deb
sudo dpkg -i target/debs/buster/libnl-nf-3-200_*.deb
sudo dpkg -i target/debs/buster/libnl-nf-3-dev_*.deb
cd $(Build.SourcesDirectory)/${{ parameters.swss_common_artifact_name }}
sudo dpkg -i libswsscommon_1.0.0_${{ parameters.arch }}.deb
sudo dpkg -i libswsscommon-dev_1.0.0_${{ parameters.arch }}.deb
cd $(Build.SourcesDirectory)/${{ parameters.sairedis_artifact_name }}
sudo dpkg -i libsaivs_*.deb
sudo dpkg -i libsaivs-dev_*.deb
sudo dpkg -i libsairedis_*.deb
sudo dpkg -i libsairedis-dev_*.deb
sudo dpkg -i libsaimetadata_*.deb
sudo dpkg -i libsaimetadata-dev_*.deb
sudo dpkg -i syncd-vs_*.deb
workingDirectory: $(Pipeline.Workspace)
displayName: "Install sonic swss common and sairedis"
- checkout: self
submodules: true
displayName: "Install libnl3, sonic swss common and sairedis"
- script: |
set -x
tar czf pytest.tgz tests
cp -r pytest.tgz $(Build.ArtifactStagingDirectory)/
if [ '${{ parameters.archive_gcov }}' == True ]; then
export ENABLE_GCOV=y
fi
./autogen.sh
dpkg-buildpackage -us -uc -b -j$(nproc) && cp ../*.deb .
displayName: "Compile sonic swss"
Expand Down
1 change: 1 addition & 0 deletions .azure-pipelines/build_and_install_module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function build_and_install_kmodule()
echo CONFIG_MACSEC=m >> .config
echo CONFIG_NET_VENDOR_MICROSOFT=y >> .config
echo CONFIG_MICROSOFT_MANA=m >> .config
echo CONFIG_SYSTEM_REVOCATION_LIST=n >> .config
make VERSION=$VERSION PATCHLEVEL=$PATCHLEVEL SUBLEVEL=$SUBLEVEL EXTRAVERSION=-${EXTRAVERSION} LOCALVERSION=-${LOCALVERSION} modules_prepare
make M=drivers/net/team
mv drivers/net/Makefile drivers/net/Makefile.bak
Expand Down
4 changes: 4 additions & 0 deletions .azure-pipelines/docker-sonic-vs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ RUN dpkg -i /debs/syncd-vs_1.0.0_amd64.deb

RUN dpkg --purge swss
RUN dpkg -i /debs/swss_1.0.0_amd64.deb

RUN apt-get update

RUN apt-get -y install lcov
114 changes: 114 additions & 0 deletions .azure-pipelines/gcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
parameters:
- name: arch
type: string
values:
- amd64
default: amd64

- name: pool
type: string
values:
- sonicbld
- default
default: default

- name: timeout
type: number
default: 180

- name: sonic_slave
type: string

- name: sairedis_artifact_name
type: string

- name: swss_common_artifact_name
type: string

- name: swss_artifact_name
type: string

- name: artifact_name
type: string

- name: archive_gcov
type: boolean
default: false

jobs:
- job:
displayName: ${{ parameters.arch }}
timeoutInMinutes: ${{ parameters.timeout }}

pool:
${{ if ne(parameters.pool, 'default') }}:
name: ${{ parameters.pool }}
${{ if eq(parameters.pool, 'default') }}:
vmImage: 'ubuntu-20.04'

container:
image: sonicdev-microsoft.azurecr.io:443/${{ parameters.sonic_slave }}:latest


steps:
- script: |
sudo apt-get install -y lcov
displayName: "Install dependencies"
condition: eq('${{ parameters.archive_gcov }}', true)
- task: DownloadPipelineArtifact@2
inputs:
artifact: ${{ parameters.artifact_name }}
displayName: "Download gcov artifact"
condition: eq('${{ parameters.archive_gcov }}', true)
- script: |
set -x
ls -lh
sudo tar -zxvf sonic-gcov.tar.gz
sudo cp -rf sonic-gcov $(Build.ArtifactStagingDirectory)
sudo rm sonic-gcov.tar.gz
ls -lh
workingDirectory: $(Pipeline.Workspace)
displayName: "store sonic-gcov"
condition: eq('${{ parameters.archive_gcov }}', true)
- checkout: self
submodules: true
condition: eq('${{ parameters.archive_gcov }}', true)
- script: |
set -x
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y dotnet-sdk-5.0
pushd ./s/
sudo tar -zcvf swss.tar.gz ./*
ls -lh ./*
cp ./gcovpreload/lcov_cobertura.py $(Build.ArtifactStagingDirectory)/
cp ./tests/gcov_support.sh $(Build.ArtifactStagingDirectory)/sonic-gcov
sudo cp -rf swss.tar.gz $(Build.ArtifactStagingDirectory)/sonic-gcov
popd
sudo cp -rf $(Build.ArtifactStagingDirectory)/sonic-gcov ./
pushd sonic-gcov
ls -lh ./*
sudo chmod +x ./gcov_support.sh
sudo ./gcov_support.sh generate
sudo ./gcov_support.sh merge_container_info $(Build.ArtifactStagingDirectory)
sudo cp -rf gcov_output $(Build.ArtifactStagingDirectory)
ls -lh $(Build.ArtifactStagingDirectory)
popd
workingDirectory: $(Pipeline.Workspace)
displayName: "generate gcov reports"
condition: eq('${{ parameters.archive_gcov }}', true)
- publish: $(Build.ArtifactStagingDirectory)/gcov_output
artifact: gcov_info
displayName: "Archive gcov info"
condition: eq('${{ parameters.archive_gcov }}', true)

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.ArtifactStagingDirectory)/gcov_output/AllMergeReport/coverage.xml'
reportDirectory: '$(Build.ArtifactStagingDirectory)/gcov_output/AllMergeReport/'
displayName: 'Publish c c++ test coverage'
condition: eq('${{ parameters.archive_gcov }}', true)

31 changes: 29 additions & 2 deletions .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
parameters:
- name: timeout
type: number
default: 180
default: 240

- name: log_artifact_name
type: string

- name: gcov_artifact_name
type: string

- name: sonic_slave
type: string

- name: archive_gcov
type: boolean
default: false

jobs:
- job:
displayName: vstest
Expand Down Expand Up @@ -53,7 +63,12 @@ jobs:
sudo /sbin/ip link add Vrf1 type vrf table 1001 || { echo 'vrf command failed' ; exit 1; }
sudo /sbin/ip link del Vrf1 type vrf table 1001
pushd tests
sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
if [ '${{ parameters.archive_gcov }}' == True ]; then
sudo py.test -v --force-flaky --junitxml=tr.xml --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
else
sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
fi
displayName: "Run vs tests"
- task: PublishTestResults@2
Expand All @@ -64,9 +79,21 @@ jobs:

- script: |
cp -r tests/log $(Build.ArtifactStagingDirectory)/
if [ '${{ parameters.archive_gcov }}' == True ]; then
sudo apt-get install -y lcov
./tests/gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
docker stop $(docker ps -q -a)
docker rm $(docker ps -q -a)
fi
displayName: "Collect logs"
condition: always()
- publish: $(Build.ArtifactStagingDirectory)/gcov_tmp
artifact: ${{ parameters.gcov_artifact_name }}
displayName: "Publish gcov output"
condition: eq('${{ parameters.archive_gcov }}', true)

- publish: $(Build.ArtifactStagingDirectory)/
artifact: ${{ parameters.log_artifact_name }}@$(System.JobAttempt)
displayName: "Publish logs"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,5 @@ tests/mock_tests/tests.trs
tests/test-suite.log
tests/tests.log
tests/tests.trs
orchagent/p4orch/tests/**/*gcda
orchagent/p4orch/tests/**/*gcno
7 changes: 6 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
SUBDIRS = fpmsyncd neighsyncd fdbsyncd portsyncd mclagsyncd natsyncd orchagent swssconfig cfgmgr tests gearsyncd
if GCOV_ENABLED
SUBDIRS = gcovpreload fpmsyncd neighsyncd portsyncd mclagsyncd natsyncd fdbsyncd orchagent swssconfig cfgmgr tests gearsyncd
else
SUBDIRS = fpmsyncd neighsyncd portsyncd mclagsyncd natsyncd fdbsyncd orchagent swssconfig cfgmgr tests gearsyncd
endif


if HAVE_LIBTEAM
SUBDIRS += teamsyncd tlm_teamd
Expand Down
30 changes: 28 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ stages:
parameters:
arch: amd64
sonic_slave: sonic-slave-buster
buildimage_artifact_name: sonic-buildimage.vs
buildimage_pipeline: 142
swss_common_artifact_name: sonic-swss-common
sairedis_artifact_name: sonic-sairedis
artifact_name: sonic-swss
archive_pytests: true
archive_gcov: true

- stage: BuildArm
dependsOn: Build
Expand All @@ -29,21 +32,27 @@ stages:
parameters:
arch: armhf
timeout: 240
pool: sonicbld
pool: sonicbld-armhf
sonic_slave: sonic-slave-buster-armhf
buildimage_artifact_name: sonic-buildimage.marvell-armhf
buildimage_pipeline: 141
swss_common_artifact_name: sonic-swss-common.armhf
sairedis_artifact_name: sonic-sairedis.armhf
artifact_name: sonic-swss.armhf
archive_gcov: false

- template: .azure-pipelines/build-template.yml
parameters:
arch: arm64
timeout: 240
pool: sonicbld
pool: sonicbld-arm64
sonic_slave: sonic-slave-buster-arm64
swss_common_artifact_name: sonic-swss-common.arm64
buildimage_artifact_name: sonic-buildimage.centec-arm64
buildimage_pipeline: 140
sairedis_artifact_name: sonic-sairedis.arm64
artifact_name: sonic-swss.arm64
archive_gcov: false

- stage: BuildDocker
dependsOn: Build
Expand All @@ -63,3 +72,20 @@ stages:
- template: .azure-pipelines/test-docker-sonic-vs-template.yml
parameters:
log_artifact_name: log
gcov_artifact_name: sonic-gcov
sonic_slave: sonic-slave-buster
archive_gcov: true

- stage: Gcov
dependsOn: Test
condition: always()
jobs:
- template: .azure-pipelines/gcov.yml
parameters:
arch: amd64
sonic_slave: sonic-slave-buster
swss_common_artifact_name: sonic-swss-common
sairedis_artifact_name: sonic-sairedis
swss_artifact_name: sonic-swss
artifact_name: sonic-gcov
archive_gcov: true
Loading

0 comments on commit f9a3d74

Please sign in to comment.