Skip to content

Run individual pytests instead of running all pytests at once. #2350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,27 @@ jobs:
pushd tests

if [ '${{ parameters.archive_gcov }}' == True ]; then
sudo py.test -v --force-flaky --junitxml=tr.xml --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
all_tests=$(ls test_*.py)
all_tests="${all_tests} p4rt"
for test in ${all_tests}; do
test_name=$(echo "${test}" | cut -d "." -f 1)
sudo py.test -v --force-flaky --junitxml="${test_name}_tr.xml" --keeptb --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber) ${test}
container_count=$(docker ps -q -a | wc -l)
if [ ${container_count} -gt 0 ]; then
./gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
docker stop $(docker ps -q -a)
docker rm $(docker ps -q -a)
fi
done
else
sudo py.test -v --force-flaky --junitxml=tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
sudo py.test -v --force-flaky --junitxml=tests_tr.xml --imgname=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber)
fi
rm -rf $(Build.ArtifactStagingDirectory)/download
displayName: "Run vs tests"

- task: PublishTestResults@2
inputs:
testResultsFiles: '**/tr.xml'
testResultsFiles: '**/*_tr.xml'
testRunTitle: vstest
condition: always()

Expand All @@ -87,9 +98,9 @@ jobs:

if [ '${{ parameters.archive_gcov }}' == True ]; then
sudo apt-get install -y lcov
./tests/gcov_support.sh set_environment $(Build.ArtifactStagingDirectory)
docker stop $(docker ps -q -a)
docker rm $(docker ps -q -a)
cd $(Build.ArtifactStagingDirectory)/gcov_tmp/
tar -zcvf sonic-gcov.tar.gz sonic-gcov/
rm -rf sonic-gcov
fi
displayName: "Collect logs"
condition: always()
Expand Down
6 changes: 0 additions & 6 deletions tests/gcov_support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,6 @@ gcov_set_environment()

echo "cat list"
cat ${CONTAINER_LIST}

cd ${build_dir}/gcov_tmp/
tar -zcvf sonic-gcov.tar.gz sonic-gcov/
rm -rf sonic-gcov
cd ../../
rm ${CONTAINER_LIST}
}

gcov_merge_info()
Expand Down