Skip to content

Commit d1a1c93

Browse files
committed
Run individule pytests instead of running all pytests at once.
Change-Id: Ibe02f3fe47846c89c50da1d8e97a78739c2275f8
1 parent ec57bf1 commit d1a1c93

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.azure-pipelines/test-docker-sonic-vs-template.yml

+17-6
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,27 @@ jobs:
6969
pushd tests
7070
7171
if [ '${{ parameters.archive_gcov }}' == True ]; then
72-
sudo py.test -v --force-flaky --junitxml=tr.xml --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
72+
all_tests=$(ls test_*.py)
73+
all_tests="${all_tests} p4rt"
74+
for test in ${all_tests}; do
75+
test_name=$(echo "${test}" | cut -d "." -f 1)
76+
sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) ${test}
77+
container_count=$(docker ps -q -a | wc -l)
78+
if [ ${container_count} -gt 0 ]; then
79+
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
80+
docker stop $(docker ps -q -a)
81+
docker rm $(docker ps -q -a)
82+
fi
83+
done
7384
else
74-
sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
85+
sudo py.test -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
7586
fi
7687
rm -rf $(Build.ArtifactStagingDirectory)/download
7788
displayName: "Run vs tests"
7889
7990
- task: PublishTestResults@2
8091
inputs:
81-
testResultsFiles: '**/tr.xml'
92+
testResultsFiles: '**/*_tr.xml'
8293
testRunTitle: vstest
8394
condition: always()
8495

@@ -87,9 +98,9 @@ jobs:
8798
8899
if [ '${{ parameters.archive_gcov }}' == True ]; then
89100
sudo apt-get install -y lcov
90-
./tests/gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
91-
docker stop $(docker ps -q -a)
92-
docker rm $(docker ps -q -a)
101+
cd $(Build.ArtifactStagingDirectory)/gcov_tmp/
102+
tar -zcvf sonic-gcov.tar.gz sonic-gcov/
103+
rm -rf sonic-gcov
93104
fi
94105
displayName: "Collect logs"
95106
condition: always()

tests/gcov_support.sh

-6
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,6 @@ gcov_set_environment()
197197

198198
echo "cat list"
199199
cat ${CONTAINER_LIST}
200-
201-
cd ${build_dir}/gcov_tmp/
202-
tar -zcvf sonic-gcov.tar.gz sonic-gcov/
203-
rm -rf sonic-gcov
204-
cd ../../
205-
rm ${CONTAINER_LIST}
206200
}
207201

208202
gcov_merge_info()

0 commit comments

Comments
 (0)