./.github/scripts: When only when skecth is built, the build directory (#7037)

should default to "build".
This commit is contained in:
Abdelatif Guettouche 2022-07-26 18:36:00 +02:00 committed by GitHub
parent fef932c1a0
commit 4b64cde102
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 7 deletions

View file

@ -109,18 +109,30 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [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 <ide_path> <user_path> <path-to-ino> [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
}

View file

@ -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