Merge pull request #2932 from cesanta/test

Add test Makefiles for IDEs and Wizard test script
This commit is contained in:
Sergio R. Caprile 2024-10-04 17:37:19 -03:00 committed by GitHub
commit 069254be6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 173 additions and 12 deletions

View File

@ -9,17 +9,8 @@ all: $(PROJECTS)
$(DOCKER) $(IMAGE) $(PATHTO)headless-build.sh -data workspace -removeAll workspace
$(PROJECTS): FORCE
(make -C $@ && sudo make -C $@ clean) || $(DOCKER) $(IMAGE) $(PATHTO)headless-build.sh -data workspace -import $@ -cleanBuild $(@F)/$(TARGET)
(make -C $@ && make -C $@ clean) || ( \
PROJNAME=`xq -r .projectDescription.name $@/.project` && \
$(DOCKER) $(IMAGE) $(PATHTO)headless-build.sh -data workspace -import $@ -cleanBuild $$PROJNAME/$(TARGET) )
FORCE:
# Automated remote test. See https://vcon.io/automated-firmware-tests/
URL ?= https://dash.vcon.io/api/v3/devices
update: $(PROJECTS)
curl --fail-with-body -su :$(VCON_API_KEY) $(URL)/$(DEVICE)/ota --data-binary @$</$(TARGET)/firmware.bin
test update: TARGET = Test
test: update
curl --fail-with-body -su :$(VCON_API_KEY) $(URL)/$(DEVICE)/tx?t=5 | tee /tmp/output.txt
grep 'READY, IP:' /tmp/output.txt # Check for network init
# grep 'MQTT connected' /tmp/output.txt # Check for MQTT connection success

16
test/esp-idf/Makefile Normal file
View File

@ -0,0 +1,16 @@
ROOT ?= $(realpath $(CURDIR)/../..)
PROJECTS ?= $(wildcard ../../examples/esp32/*)
TARGET ?= Debug
DOCKER = docker run --rm -v $(ROOT):$(ROOT) -v $(CURDIR):/root -w $(CURDIR)
IMAGE ?= espressif/idf
all: $(PROJECTS)
echo
$(PROJECTS): FORCE
(make -C $@ build && make -C $@ clean) || ( \
$(DOCKER) $(IMAGE) /bin/bash -c 'cd $@ && idf.py build' && \
rm -rf build sdkconfig )
FORCE:

9
test/gcc+make/Makefile Normal file
View File

@ -0,0 +1,9 @@
PROJECTS ?= $(wildcard ../../examples/*/*-make-*)
all: $(PROJECTS)
echo
$(PROJECTS): FORCE
$(MAKE) -C $@ build clean
FORCE:

18
test/pico-sdk/Makefile Normal file
View File

@ -0,0 +1,18 @@
PROJECTS ?= $(wildcard ../../examples/rp2040/*-sdk-*)
all: $(PROJECTS)
echo
$(PROJECTS): pico-sdk
(make -C $@ build && make -C $@ clean) || ( \
ln -s $(PWD)/pico-sdk $@/pico-sdk && \
cd $@ && rm -rf build && mkdir -p build && \
cd build && cmake -G "Unix Makefiles" .. && make && \
rm -rf build pico-sdk )
pico-sdk:
git clone --depth 1 -b 1.5.1 https://github.com/raspberrypi/pico-sdk $@
cd $@ && git submodule update --init
clean:
rm -rf pico-sdk

39
test/wizard/Makefile Normal file
View File

@ -0,0 +1,39 @@
WIZARD_URL ?= http://mongoose.ws/wizard
all build example: firmware.bin
ifeq "$(IDE)" "GCC+make"
BUILD = $(MAKE) -f ../gcc+make/Makefile PROJECTS=wizard
endif
ifeq "$(IDE)" "CubeIDE"
BUILD = $(MAKE) -f ../cube/Makefile PROJECTS=wizard
endif
ifeq "$(IDE)" "MCUXpresso"
BUILD = $(MAKE) -f ../xpresso/Makefile PROJECTS=wizard
endif
ifeq "$(IDE)" "Zephyr"
BUILD = true
endif
ifeq "$(IDE)" "Keil"
BUILD = true
endif
ifeq "$(IDE)" "Pico-SDK"
BUILD = $(MAKE) -f ../pico-sdk/Makefile PROJECTS=wizard
endif
ifeq "$(IDE)" "ESP-IDF"
BUILD = $(MAKE) -f ../esp-idf/Makefile PROJECTS=wizard
endif
ifeq "$(IDE)" "Arduino"
BUILD = true
endif
firmware.bin: wizard
$(BUILD) && rm -rf wizard*
wizard: FORCE
hash=$$(curl -s -X POST -H "Content-Type: application/json" -d '{"build":{"board":"$(BOARD)","ide":"$(IDE)","rtos":"$(RTOS)"}}' $(WIZARD_URL)/api/hash | jq -r '.hash') \
&& curl -s $(WIZARD_URL)/api/zip/$(BOARD)/$(IDE)/$(RTOS)/$$hash -o wizard.zip
unzip wizard.zip
FORCE:

72
test/wizard/test.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
RTOSES="baremetal FreeRTOS"
dotest ()
{
echo "BOARD=$1 IDE=$2 RTOS=$3" >> test.log
make BOARD=$1 IDE=$2 RTOS=$3 || ( \
echo "^^^ FAILED ^^^" >> test.log && rm -rf wizard* workspace )
}
cd `dirname "$0"`
rm test.log
STM32="f207 f429 f439 f746 f756 f767 h563 h573 h723 h735 h743 h745 h747 h753 h755"
STIDES="GCC+make CubeIDE"
# Zephyr: !f439
# Keil: f756
for board in $STM32; do
for ide in $STIDES; do
for rtos in $RTOSES; do
dotest $board $ide $rtos
done
done
done
NXP="rt1020 rt1024 rt1040 rt1060 rt1064 rt1170 mcxn947"
NXPIDES="GCC+make"
#MCUXpresso: mcxn947
for board in $NXP; do
for ide in $NXPIDES; do
for rtos in "baremetal"; do
dotest $board $ide $rtos
done
done
done
INFINEON="xmc4400 xmc4700 xmc7200"
INFINEONIDES="GCC+make"
for board in $INFINEON; do
for ide in $INFINEONIDES; do
for rtos in "baremetal"; do
dotest $board $ide $rtos
done
done
done
PICO="evb-pico"
#Zephyr
for board in $PICO; do
for rtos in "baremetal"; do
dotest $board "Pico-SDK" $rtos
done
done
ESP="esp32"
for board in $ESP; do
dotest $board "ESP-IDF" "baremetal"
done
ARDUINO="teensy41"
rm -rf workspace pico-sdk
cd -

16
test/xpresso/Makefile Normal file
View File

@ -0,0 +1,16 @@
ROOT ?= $(realpath $(CURDIR)/../..)
PROJECTS ?= $(wildcard ../../examples/nxp/*-xpresso-*)
TARGET ?= Debug
DOCKER = docker run --rm -v $(ROOT):$(ROOT) -v $(CURDIR):/root -w $(CURDIR)
IMAGE ?= scaprile/xpresso
HEADLESS_BUILD = /usr/local/mcuxpressoide/ide/mcuxpressoide --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild
all: $(PROJECTS)
$(DOCKER) $(IMAGE) $(HEADLESS_BUILD) -data workspace -removeAll workspace
$(PROJECTS): FORCE
(make -C $@ && make -C $@ clean) || ( \
PROJNAME=`xq -r .projectDescription.name $@/.project` && \
($(DOCKER) $(IMAGE) $(HEADLESS_BUILD) -data workspace -import wizard -cleanBuild $$PROJNAME/$(TARGET) || true) && \
test -f $(@F)/$(TARGET)/$$PROJNAME.axf )
FORCE: