Skip to content

Commit 1d107aa

Browse files
committed
./github/scripts: Add option to erase the flash before flashing.
Signed-off-by: Abdelatif Guettouche <[email protected]>
1 parent 28ed0a4 commit 1d107aa

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Diff for: .github/scripts/tests_run.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ function run_test() {
44
local target=$1
55
local sketch=$2
66
local options=$3
7+
local erase_flash=$4
78
local sketchdir=$(dirname $sketch)
89
local sketchdirname=$(basename $sketchdir)
910

@@ -16,6 +17,10 @@ function run_test() {
1617
for i in `seq 0 $(($len - 1))`
1718
do
1819
echo "Running test: $sketchdirname -- Config: $i"
20+
if [ $erase_flash -eq 1 ]; then
21+
esptool.py -c $target erase_flash
22+
fi
23+
1924
pytest tests --build-dir tests/$sketchdirname/build$i -k test_$sketchdirname --junit-xml=tests/$sketchdirname/$sketchdirname$i.xml
2025
result=$?
2126
if [ $result -ne 0 ]; then
@@ -54,6 +59,9 @@ while [ ! -z "$1" ]; do
5459
shift
5560
chunk_max=$1
5661
;;
62+
-e )
63+
erase=$1
64+
;;
5765
-h )
5866
echo "$USAGE"
5967
exit 0
@@ -68,7 +76,7 @@ done
6876
source ${SCRIPTS_DIR}/install-arduino-ide.sh
6977

7078
if [ $chunk_run -eq 0 ]; then
71-
run_test $target $PWD/tests/$sketch/$sketch.ino $options
79+
run_test $target $PWD/tests/$sketch/$sketch.ino $options $erase
7280
else
7381
if [ "$chunk_max" -le 0 ]; then
7482
echo "ERROR: Chunks count must be positive number"
@@ -124,6 +132,6 @@ else
124132
echo ""
125133
echo "Sketch Index $(($sketchnum - 1))"
126134

127-
run_test $target $sketch
135+
run_test $target $sketch $options $erase
128136
done
129137
fi

Diff for: .github/workflows/hil.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
100100
- name: Run Tests
101101
run: |
102-
bash .github/scripts/tests_run.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}}
102+
bash .github/scripts/tests_run.sh -c -t ${{matrix.chip}} -i ${{matrix.chunks}} -m ${{env.MAX_CHUNKS}} -e
103103
104104
- name: Upload test result artifacts
105105
uses: actions/upload-artifact@v2

0 commit comments

Comments
 (0)