Skip to content

Commit

Permalink
Split kvmtest t0 job into two jobs and run in parallel (sonic-net#10044)
Browse files Browse the repository at this point in the history
Why I did it
Introduce 2 sub jobs for kvmtest t0 job in sonic-mgmt repo in PR sonic-net/sonic-mgmt#4861
But in sonic-buildimage repo, because section parameter is null, it always run the part 2 test scripts in kvmtest t0 job.
It missed the part 1 test scripts in kvmtest.sh.

How I did it
Split kvmtest t0 job into two sub jobs such as sonic-mgmt repo and run them in parallel to save time.

How to verify it
Submit PR will trigger the pipeline to run.

Signed-off-by: Zhaohui Sun <[email protected]>
  • Loading branch information
ZhaohuiS authored Feb 24, 2022
1 parent 2d0b063 commit 4402872
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
11 changes: 7 additions & 4 deletions .azure-pipelines/run-test-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ parameters:
type: string
- name: ptf_name
type: string
- name: section
type: string
default: ''
- name: image
type: string
default: sonic-vs.img.gz
Expand Down Expand Up @@ -43,7 +46,7 @@ steps:

- script: |
rm -rf $(Build.ArtifactStagingDirectory)/*
docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }}"
docker exec sonic-mgmt bash -c "/data/sonic-mgmt/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} ${{ parameters.tbname }} ${{ parameters.dut }} ${{ parameters.section }}"
displayName: "Run tests"

- script: |
Expand Down Expand Up @@ -75,17 +78,17 @@ steps:
condition: succeededOrFailed()

- publish: $(Build.ArtifactStagingDirectory)/kvmdump
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}.memdump@$(System.JobAttempt)
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}${{ parameters.section }}.memdump@$(System.JobAttempt)
displayName: "Archive sonic kvm memdump"
condition: failed()

- publish: $(Build.ArtifactStagingDirectory)/logs
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}.log@$(System.JobAttempt)
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}${{ parameters.section }}.log@$(System.JobAttempt)
displayName: "Archive sonic kvm logs"
condition: succeededOrFailed()

- task: PublishTestResults@2
inputs:
testResultsFiles: '$(Build.ArtifactStagingDirectory)/logs/**/*.xml'
testRunTitle: kvmtest.${{ parameters.tbtype }}
testRunTitle: kvmtest.${{ parameters.tbtype }}${{ parameters.section }}
condition: succeededOrFailed()
41 changes: 39 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ stages:
testResultsFiles: '**/tr.xml'
testRunTitle: vstest

- job:
- job: t0_part1
pool: sonictest
displayName: "kvmtest-t0"
displayName: "kvmtest-t0-part1"
timeoutInMinutes: 360

steps:
Expand All @@ -116,6 +116,43 @@ stages:
tbname: vms-kvm-t0
ptf_name: ptf_vms6-1
tbtype: t0
section: part-1

- job: t0_part2
pool: sonictest
displayName: "kvmtest-t0-part2"
timeoutInMinutes: 360

steps:
- template: .azure-pipelines/run-test-template.yml
parameters:
dut: vlab-01
tbname: vms-kvm-t0
ptf_name: ptf_vms6-1
tbtype: t0
section: part-2

- job:
pool: sonictest
displayName: "kvmtest-t0"
timeoutInMinutes: 360
dependsOn:
- t0_part1
- t0_part2
condition: always()
variables:
resultOfPart1: $[ dependencies.t0_part1.result ]
resultOfPart2: $[ dependencies.t0_part2.result ]

steps:
- script: |
if [ $(resultOfPart1) == "Succeeded" ] && [ $(resultOfPart2) == "Succeeded" ]; then
echo "Both job kvmtest-t0-part1 and kvmtest-t0-part2 are passed."
exit 0
else
echo "Either job kvmtest-t0-part1 or job kvmtest-t0-part2 failed! Please check the detailed information."
exit 1
fi
- job:
pool: sonictest-t1-lag
Expand Down

0 comments on commit 4402872

Please sign in to comment.