Skip to content

Commit 4d85161

Browse files
committed
Run individule pytests instead of running all pytests at once.
1 parent ec57bf1 commit 4d85161

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

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

+14-6
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,24 @@ 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+
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
78+
docker stop $(docker ps -q -a)
79+
docker rm $(docker ps -q -a)
80+
done
7381
else
74-
sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
82+
sudo py.test -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
7583
fi
7684
rm -rf $(Build.ArtifactStagingDirectory)/download
7785
displayName: "Run vs tests"
7886
7987
- task: PublishTestResults@2
8088
inputs:
81-
testResultsFiles: '**/tr.xml'
89+
testResultsFiles: '**/*_tr.xml'
8290
testRunTitle: vstest
8391
condition: always()
8492

@@ -87,9 +95,9 @@ jobs:
8795
8896
if [ '${{ parameters.archive_gcov }}' == True ]; then
8997
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)
98+
cd $(Build.ArtifactStagingDirectory)/gcov_tmp/
99+
tar -zcvf sonic-gcov.tar.gz sonic-gcov/
100+
rm -rf sonic-gcov
93101
fi
94102
displayName: "Collect logs"
95103
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)