Skip to content

Commit 2644e5a

Browse files
committed
change(tests): Re-run once on test failure
1 parent 21136a2 commit 2644e5a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Diff for: .github/scripts/tests_run.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function run_test() {
77
local erase_flash=$4
88
local sketchdir=$(dirname $sketch)
99
local sketchname=$(basename $sketchdir)
10+
local result=0
1011

1112
if [[ -f "$sketchdir/.skip.$platform" ]] || [[ -f "$sketchdir/.skip.$target" ]] || [[ -f "$sketchdir/.skip.$platform.$target" ]]; then
1213
echo "Skipping $sketchname test for $target, platform: $platform"
@@ -61,11 +62,17 @@ function run_test() {
6162
extra_args="--embedded-services esp,arduino"
6263
fi
6364

65+
result=0
6466
echo "pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args"
65-
bash -c "pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args"
67+
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?
6668
result=$?
6769
if [ $result -ne 0 ]; then
68-
return $result
70+
echo "Retrying test: $sketchname -- Config: $i"
71+
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?
72+
result=$?
73+
if [ $result -ne 0 ]; then
74+
exit $result
75+
fi
6976
fi
7077
done
7178
}

0 commit comments

Comments
 (0)