@@ -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
77
85
test_set+=("${test}")
78
86
if [ ${#test_set[@]} -ge 20 ]; then
79
87
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)
88
+ echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber).asan-${{ parameters.asan }}
81
89
container_count=$(docker ps -q -a | wc -l)
82
90
if [ ${container_count} -gt 0 ]; then
83
91
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
89
97
done
90
98
if [ ${#test_set[@]} -gt 0 ]; then
91
99
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)
100
+ echo "${test_set[*]}" | xargs sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber).asan-${{ parameters.asan }}
93
101
container_count=$(docker ps -q -a | wc -l)
94
102
if [ ${container_count} -gt 0 ]; then
95
103
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
@@ -98,8 +106,13 @@ jobs:
98
106
fi
99
107
fi
100
108
else
101
- sudo py.test -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
109
+ test_args=""
110
+ if [ '${{ parameters.asan }}' == True ]; then
111
+ test_args="--graceful-stop"
112
+ fi
113
+ sudo py.test $test_args -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber).asan-${{ parameters.asan }}
102
114
fi
115
+
103
116
rm -rf $(Build.ArtifactStagingDirectory)/download
104
117
displayName: "Run vs tests"
105
118
@@ -112,6 +125,10 @@ jobs:
112
125
- script : |
113
126
cp -r tests/log $(Build.ArtifactStagingDirectory)/
114
127
128
+ if [ '${{ parameters.asan }}' == True ]; then
129
+ cp -r tests/log/*/log/asan $(Build.ArtifactStagingDirectory)/
130
+ fi
131
+
115
132
if [ '${{ parameters.archive_gcov }}' == True ]; then
116
133
sudo apt-get install -y lcov
117
134
cd $(Build.ArtifactStagingDirectory)/gcov_tmp/
@@ -130,3 +147,17 @@ jobs:
130
147
artifact : ${{ parameters.log_artifact_name }}@$(System.JobAttempt)
131
148
displayName : " Publish logs"
132
149
condition : always()
150
+
151
+ - publish : $(Build.ArtifactStagingDirectory)/asan
152
+ artifact : asan-reports
153
+ displayName : " Publish ASAN reports"
154
+ condition : eq('${{ parameters.asan }}', true)
155
+
156
+ - script : |
157
+ if [ "$(ls -A $(Build.ArtifactStagingDirectory)/asan)" ]; then
158
+ echo "There are issues reported by ASAN"
159
+ else
160
+ echo "No issues reported by ASAN"
161
+ fi
162
+ displayName: "Check ASAN reports"
163
+ condition: eq('${{ parameters.asan }}', true)
0 commit comments