diff --git a/.github/scripts/sketch_utils.sh b/.github/scripts/sketch_utils.sh index e3236831309..3a856202e51 100755 --- a/.github/scripts/sketch_utils.sh +++ b/.github/scripts/sketch_utils.sh @@ -109,18 +109,30 @@ function build_sketch(){ # build_sketch [ex exit 1 fi + # The directory that will hold all the artifcats (the build directory) is + # provided through: + # 1. An env variable called ARDUINO_BUILD_DIR. + # 2. Created at the sketch level as "build" in the case of a single + # configuration test. + # 3. Created at the sketch level as "buildX" where X is the number + # of configuration built in case of a multiconfiguration test. + ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp" - if [ -z "$ARDUINO_BUILD_DIR" ]; then - build_dir="$sketchdir/build" - else + if [ -n "$ARDUINO_BUILD_DIR" ]; then build_dir="$ARDUINO_BUILD_DIR" + elif [ $len -eq 1 ]; then + build_dir="$sketchdir/build" fi mkdir -p "$ARDUINO_CACHE_DIR" for i in `seq 0 $(($len - 1))` do - rm -rf "$build_dir$i" - mkdir -p "$build_dir$i" + if [ $len -ne 1 ]; then + build_dir="$sketchdir/build$i" + fi + rm -rf $build_dir + mkdir -p $build_dir + currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'` sketchname=$(basename $sketchdir) echo "Building $sketchname with FQBN=$currfqbn" @@ -134,7 +146,7 @@ function build_sketch(){ # build_sketch [ex -hardware "$user_path/hardware" \ -libraries "$user_path/libraries" \ -build-cache "$ARDUINO_CACHE_DIR" \ - -build-path "$build_dir$i" \ + -build-path "$build_dir" \ $xtra_opts "${sketchdir}/${sketchname}.ino" done } diff --git a/.github/scripts/tests_run.sh b/.github/scripts/tests_run.sh index 94626de9c46..0374b6891b4 100755 --- a/.github/scripts/tests_run.sh +++ b/.github/scripts/tests_run.sh @@ -14,6 +14,11 @@ function run_test() { len=1 fi + if [ $len -eq 1 ]; then + build_dir="tests/$sketchname/build" + report_file="tests/$sketchname/$sketchname.xml" + fi + for i in `seq 0 $(($len - 1))` do echo "Running test: $sketchname -- Config: $i" @@ -21,7 +26,12 @@ function run_test() { esptool.py -c $target erase_flash fi - pytest tests --build-dir tests/$sketchname/build$i -k test_$sketchname --junit-xml=tests/$sketchname/$sketchname$i.xml + if [ $len -ne 1 ]; then + build_dir="tests/$sketchname/build$i" + report_file="tests/$sketchname/$sketchname$i.xml" + fi + + pytest tests --build-dir $build_dir -k test_$sketchname --junit-xml=$report_file result=$? if [ $result -ne 0 ]; then return $result