Skip to content

Commit

Permalink
change(tests): Re-run once on test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasssvaz committed May 27, 2024
1 parent 21136a2 commit 2644e5a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .github/scripts/tests_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function run_test() {
local erase_flash=$4
local sketchdir=$(dirname $sketch)
local sketchname=$(basename $sketchdir)
local result=0

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

result=0
echo "pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args"
bash -c "pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args"
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?
result=$?
if [ $result -ne 0 ]; then
return $result
echo "Retrying test: $sketchname -- Config: $i"
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?
result=$?
if [ $result -ne 0 ]; then
exit $result
fi
fi
done
}
Expand Down

0 comments on commit 2644e5a

Please sign in to comment.