4848TEST_SUITE_NAME=" $( basename " $0 " ) ${TEST_SUITE} "
4949
5050EXCLUDE_TARGET_EXPR=" (not u55) and (not u85) and (not tosa) and (not _vgf_)"
51+ PYTEST_RETRY_ARGS=(--reruns 2 --reruns-delay 1)
5152
5253all () { # Run all tests
5354 # This will list all lines in this file that is starting with test_ remove () { and add this script name in
@@ -80,7 +81,7 @@ test_pytest_ops_no_target() {
8081 echo " ${TEST_SUITE_NAME} : Run pytest ops for target-less tests"
8182
8283 # Run arm baremetal pytest tests without target
83- pytest --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k " ${EXCLUDE_TARGET_EXPR} "
84+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k " ${EXCLUDE_TARGET_EXPR} "
8485 echo " ${TEST_SUITE_NAME} : PASS"
8586}
8687
@@ -91,7 +92,7 @@ test_pytest_models_no_target() {
9192 source backends/arm/scripts/install_models_for_test.sh
9293
9394 # Run arm baremetal pytest tests without FVP
94- pytest --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k " ${EXCLUDE_TARGET_EXPR} "
95+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k " ${EXCLUDE_TARGET_EXPR} "
9596 echo " ${TEST_SUITE_NAME} : PASS"
9697}
9798
@@ -101,7 +102,7 @@ test_pytest_models_no_target() {
101102test_pytest_ops_tosa () {
102103 echo " ${TEST_SUITE_NAME} : Run pytest ops for TOSA"
103104
104- pytest --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k tosa
105+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k tosa
105106 echo " ${TEST_SUITE_NAME} : PASS"
106107}
107108
@@ -111,7 +112,7 @@ test_pytest_models_tosa() {
111112 # Install model dependencies for pytest
112113 source backends/arm/scripts/install_models_for_test.sh
113114
114- pytest --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k tosa
115+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k tosa
115116 echo " ${TEST_SUITE_NAME} : PASS"
116117}
117118
@@ -134,7 +135,7 @@ test_pytest_ops_ethos_u55() {
134135 backends/arm/scripts/build_executorch.sh
135136 backends/arm/test/setup_testing.sh
136137
137- pytest --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k u55
138+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k u55
138139 echo " ${TEST_SUITE_NAME} : PASS"
139140}
140141
@@ -147,7 +148,7 @@ test_pytest_models_ethos_u55() {
147148 # Install model dependencies for pytest
148149 source backends/arm/scripts/install_models_for_test.sh
149150
150- pytest --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k u55
151+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k u55
151152 echo " ${TEST_SUITE_NAME} : PASS"
152153}
153154
@@ -188,7 +189,7 @@ test_pytest_ops_ethos_u85() {
188189 backends/arm/test/setup_testing.sh
189190
190191 # Run arm baremetal pytest tests with FVP
191- pytest --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k u85
192+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ --ignore=backends/arm/test/models -k u85
192193 echo " ${TEST_SUITE_NAME} : PASS"
193194}
194195
@@ -201,7 +202,7 @@ test_pytest_models_ethos_u85() {
201202 # Install model dependencies for pytest
202203 source backends/arm/scripts/install_models_for_test.sh
203204
204- pytest --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k u85
205+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k u85
205206 echo " ${TEST_SUITE_NAME} : PASS"
206207}
207208
@@ -235,7 +236,7 @@ test_pytest_ops_vkml() {
235236
236237 source backends/arm/test/setup_testing_vkml.sh
237238
238- pytest --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ \
239+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=10 backends/arm/test/ \
239240 --ignore=backends/arm/test/models -k _vgf_
240241 echo " ${TEST_SUITE_NAME} : PASS"
241242}
@@ -248,7 +249,7 @@ test_pytest_models_vkml() {
248249 # Install model dependencies for pytest
249250 source backends/arm/scripts/install_models_for_test.sh
250251
251- pytest --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k _vgf_
252+ pytest " ${PYTEST_RETRY_ARGS[@]} " --verbose --color=yes --numprocesses=auto --durations=0 backends/arm/test/models -k _vgf_
252253 echo " ${TEST_SUITE_NAME} : PASS"
253254}
254255
@@ -295,6 +296,7 @@ test_smaller_stories_llama() {
295296 # Get path to source directory
296297 pytest \
297298 -c /dev/null \
299+ " ${PYTEST_RETRY_ARGS[@]} " \
298300 --verbose \
299301 --color=yes \
300302 --numprocesses=auto \
0 commit comments