Skip to content

Commit

Permalink
fix(tests): Fix wrong selection of tests and add debug flag for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasssvaz committed Nov 7, 2024
1 parent 9f3010f commit c7c4f68
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
20 changes: 13 additions & 7 deletions .github/scripts/sketch_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
shift
log_compilation=$1
;;
-d )
shift
debug_level="DebugLevel=$1"
;;
* )
break
;;
Expand Down Expand Up @@ -140,13 +144,15 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
fi

# Default FQBN options if none were passed in the command line.

esp32_opts="PSRAM=enabled${fqbn_append:+,$fqbn_append}"
esp32s2_opts="PSRAM=enabled${fqbn_append:+,$fqbn_append}"
esp32s3_opts="PSRAM=opi,USBMode=default${fqbn_append:+,$fqbn_append}"
esp32c3_opts="$fqbn_append"
esp32c6_opts="$fqbn_append"
esp32h2_opts="$fqbn_append"
# Replace any double commas with a single one and strip leading and
# trailing commas.

esp32_opts=$(echo "PSRAM=enabled,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32s2_opts=$(echo "PSRAM=enabled,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32s3_opts=$(echo "PSRAM=opi,USBMode=default,$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32c3_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32c6_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')
esp32h2_opts=$(echo "$debug_level,$fqbn_append" | sed 's/^,*//;s/,*$//;s/,\{2,\}/,/g')

# Select the common part of the FQBN based on the target. The rest will be
# appended depending on the passed options.
Expand Down
8 changes: 4 additions & 4 deletions .github/scripts/tests_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ function run_test() {
rm $sketchdir/diagram.json 2>/dev/null || true

result=0
printf "\033[95mpytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args\033[0m\n"
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?
printf "\033[95mpytest $sketchdir/test_$sketchname.py --build-dir $build_dir --junit-xml=$report_file $extra_args\033[0m\n"
bash -c "set +e; pytest $sketchdir/test_$sketchname.py --build-dir $build_dir --junit-xml=$report_file $extra_args; exit \$?" || result=$?
printf "\n"
if [ $result -ne 0 ]; then
result=0
printf "\033[95mRetrying test: $sketchname -- Config: $i\033[0m\n"
printf "\033[95mpytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args\033[0m\n"
bash -c "set +e; pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file $extra_args; exit \$?" || result=$?
printf "\033[95mpytest $sketchdir/test_$sketchname.py --build-dir $build_dir --junit-xml=$report_file $extra_args\033[0m\n"
bash -c "set +e; pytest $sketchdir/test_$sketchname.py --build-dir $build_dir --junit-xml=$report_file $extra_args; exit \$?" || result=$?
printf "\n"
if [ $result -ne 0 ]; then
printf "\033[91mFailed test: $sketchname -- Config: $i\033[0m\n\n"
Expand Down

0 comments on commit c7c4f68

Please sign in to comment.