@@ -16,6 +16,14 @@ parameters:
16
16
type : boolean
17
17
default : false
18
18
19
+ - name : docker_sonic_vs_name
20
+ type : string
21
+ default : docker-sonic-vs
22
+
23
+ - name : asan
24
+ type : boolean
25
+ default : false
26
+
19
27
jobs :
20
28
- job :
21
29
displayName : vstest
30
38
- checkout : self
31
39
- task : DownloadPipelineArtifact@2
32
40
inputs :
33
- artifact : docker-sonic-vs
41
+ artifact : ${{ parameters.docker_sonic_vs_name }}
34
42
path : $(Build.ArtifactStagingDirectory)/download
35
- displayName : " Download pre-stage built docker-sonic-vs "
43
+ displayName : " Download pre-stage built ${{ parameters.docker_sonic_vs_name }} "
36
44
- task : DownloadPipelineArtifact@2
37
45
inputs :
38
46
source : specific
@@ -68,40 +76,46 @@ jobs:
68
76
sudo /sbin/ip link del Vrf1 type vrf table 1001
69
77
pushd tests
70
78
79
+ params=''
71
80
if [ '${{ parameters.archive_gcov }}' == True ]; then
72
- all_tests=$(ls test_*.py)
73
- all_tests="${all_tests} p4rt"
74
- test_set=()
75
- # Run 20 tests as a set.
76
- for test in ${all_tests}; do
77
- test_set+=("${test}")
78
- if [ ${#test_set[@]} -ge 20 ]; then
79
- test_name=$(echo "${test_set[0]}" | cut -d "." -f 1)
80
- echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
81
- container_count=$(docker ps -q -a | wc -l)
82
- if [ ${container_count} -gt 0 ]; then
83
- ./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
84
- docker stop $(docker ps -q -a)
85
- docker rm $(docker ps -q -a)
86
- fi
87
- test_set=()
88
- fi
89
- done
90
- if [ ${#test_set[@]} -gt 0 ]; then
81
+ params='--keeptb'
82
+ fi
83
+ if [ '${{ parameters.asan }}' == True ]; then
84
+ params='--graceful-stop'
85
+ fi
86
+
87
+ all_tests=$(ls test_*.py)
88
+ all_tests="${all_tests} p4rt"
89
+ test_set=()
90
+ # Run 20 tests as a set.
91
+ for test in ${all_tests}; do
92
+ test_set+=("${test}")
93
+ if [ ${#test_set[@]} -ge 20 ]; then
91
94
test_name=$(echo "${test_set[0]}" | cut -d "." -f 1)
92
- echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
95
+ echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" $params --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber).asan-${{ parameters.asan }}
93
96
container_count=$(docker ps -q -a | wc -l)
94
- if [ ${container_count} -gt 0 ]; then
97
+ if [ '${{ parameters.archive_gcov }}' == True ] && [ ${container_count} -gt 0 ]; then
95
98
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
96
99
docker stop $(docker ps -q -a)
97
100
docker rm $(docker ps -q -a)
98
101
fi
102
+ test_set=()
103
+ fi
104
+ done
105
+ if [ ${#test_set[@]} -gt 0 ]; then
106
+ test_name=$(echo "${test_set[0]}" | cut -d "." -f 1)
107
+ echo "${test_set[*]}" | xargs sudo py.test -v $params --force-flaky --junitxml="${test_name}_tr.xml" $params --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber).asan-${{ parameters.asan }}
108
+ container_count=$(docker ps -q -a | wc -l)
109
+ if [ '${{ parameters.archive_gcov }}' == True ] && [ ${container_count} -gt 0 ]; then
110
+ ./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
111
+ docker stop $(docker ps -q -a)
112
+ docker rm $(docker ps -q -a)
99
113
fi
100
- else
101
- sudo py.test -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
102
114
fi
115
+
103
116
rm -rf $(Build.ArtifactStagingDirectory)/download
104
117
displayName: "Run vs tests"
118
+ continueOnError: ${{ parameters.asan }}
105
119
106
120
- task : PublishTestResults@2
107
121
inputs :
@@ -112,6 +126,10 @@ jobs:
112
126
- script : |
113
127
cp -r tests/log $(Build.ArtifactStagingDirectory)/
114
128
129
+ if [ '${{ parameters.asan }}' == True ]; then
130
+ cp -vr tests/log/*/log/asan $(Build.ArtifactStagingDirectory)/
131
+ fi
132
+
115
133
if [ '${{ parameters.archive_gcov }}' == True ]; then
116
134
sudo apt-get install -y lcov
117
135
cd $(Build.ArtifactStagingDirectory)/gcov_tmp/
@@ -130,3 +148,19 @@ jobs:
130
148
artifact : ${{ parameters.log_artifact_name }}@$(System.JobAttempt)
131
149
displayName : " Publish logs"
132
150
condition : always()
151
+
152
+ - publish : $(Build.ArtifactStagingDirectory)/asan
153
+ artifact : asan-reports
154
+ displayName : " Publish ASAN reports"
155
+ condition : eq('${{ parameters.asan }}', true)
156
+
157
+ - script : |
158
+ if [ "$(ls -A $(Build.ArtifactStagingDirectory)/asan)" ]; then
159
+ echo "There are issues reported by ASAN"
160
+ exit 1
161
+ else
162
+ echo "No issues reported by ASAN"
163
+ fi
164
+ displayName: "Check ASAN reports"
165
+ condition: eq('${{ parameters.asan }}', true)
166
+ continueOnError: true
0 commit comments