Skip to content

Commit 0e31203

Browse files
committed
tests_build.sh: Update the script to be able to build one skecth at a
time. Signed-off-by: Abdelatif Guettouche <[email protected]>
1 parent 9c6751d commit 0e31203

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

Diff for: .github/scripts/tests_build.sh

+34-12
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
#!/bin/bash
22

3-
target=$1
4-
chunk_index=$2
5-
chunk_max=$3
6-
7-
if [ "$chunk_index" -gt "$chunk_max" ] && [ "$chunk_max" -ge 2 ]; then
8-
chunk_index=$chunk_max
3+
SCRIPTS_DIR="./.github/scripts"
4+
BUILD_CMD=""
5+
6+
if [ $# -eq 3 ]; then
7+
chunk_build=1
8+
elif [ $# -eq 2 ]; then
9+
chunk_build=0
10+
else
11+
echo "ERROR: Illegal number of parameters"
12+
echo "USAGE:
13+
${0} <target> <sketch_dir>
14+
${0} <target> <chunk> <total_chunks>
15+
"
16+
exit 0
917
fi
1018

19+
target=$1
20+
1121
case "$target" in
1222
"esp32") fqbn="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
1323
;;
@@ -22,13 +32,25 @@ if [ -z $fqbn ]; then
2232
exit 0
2333
fi
2434

25-
SCRIPTS_DIR="./.github/scripts"
26-
BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
27-
2835
source ${SCRIPTS_DIR}/install-arduino-ide.sh
2936
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
3037

31-
args="$ARDUINO_IDE_PATH $ARDUINO_USR_PATH"
32-
args+=" \"$fqbn\" $target $PWD/tests $chunk_index $chunk_max"
33-
${BUILD_SKETCHES} ${args}
38+
args="$ARDUINO_IDE_PATH $ARDUINO_USR_PATH \"$fqbn\""
39+
40+
if [ $chunk_build -eq 1 ]; then
41+
chunk_index=$2
42+
chunk_max=$3
43+
44+
if [ "$chunk_index" -gt "$chunk_max" ] && [ "$chunk_max" -ge 2 ]; then
45+
chunk_index=$chunk_max
46+
fi
47+
BUILD_CMD="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
48+
args+=" $target $PWD/tests $chunk_index $chunk_max"
49+
else
50+
sketchdir=$2
51+
BUILD_CMD="${SCRIPTS_DIR}/sketch_utils.sh build"
52+
args+=" $PWD/tests/$sketchdir/$sketchdir.ino"
53+
fi
54+
55+
${BUILD_CMD} ${args}
3456

0 commit comments

Comments
 (0)