From 45e69f44df6c82fce28b6090fab12cf516c74c12 Mon Sep 17 00:00:00 2001 From: lewisxhe Date: Thu, 25 Jul 2024 17:34:38 +0800 Subject: [PATCH] Added test script --- platformio.ini | 2 +- tools/test_build/build.ps1 | 39 +++++++++++++++++++++++++++++++ tools/test_build/build.sh | 47 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tools/test_build/build.ps1 create mode 100644 tools/test_build/build.sh diff --git a/platformio.ini b/platformio.ini index 6844e9e..e8e286a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -51,7 +51,7 @@ ; src_dir = examples/BHI260AP_aux_BMM150_BME280 ; src_dir = examples/BMM150_GetDataExample -src_dir = test/BHI260AP_aux_BMM150_BME280 +src_dir = examples/BHI260AP_aux_BMM150_BME280 ; Touch devices support list ; src_dir = examples/TouchDrv_FT3267_LilyGo_T_RGB diff --git a/tools/test_build/build.ps1 b/tools/test_build/build.ps1 new file mode 100644 index 0000000..e0e0a00 --- /dev/null +++ b/tools/test_build/build.ps1 @@ -0,0 +1,39 @@ +# Set-Location .. + +$currentDir = Get-Location + +Write-Host "Current path : $currentDir !" + + +$examples = Get-ChildItem -Path "examples" -Directory -Name + +$envs = @( + "esp32s3", + "esp32c3", + "esp32dev", + "rp2040", + "nrf52840" +) + +platformio run -t clean + +foreach ($env in $envs) { + foreach ($example in $examples) { + $skipFile = "examples/$example/.skip.$env" + if (Test-Path $skipFile) { + Write-Host "Skip $example for $env" + continue + } + + $env:PLATFORMIO_SRC_DIR = "examples/$example" + Write-Host "PLATFORMIO_SRC_DIR=$env:PLATFORMIO_SRC_DIR , ENV: $env" + + platformio run -e $env + if ($LASTEXITCODE -ne 0) { + Write-Host "Build env: $env $env:PLATFORMIO_SRC_DIR Failed!" + exit 1 + } else { + Write-Host "Build env: $env $env:PLATFORMIO_SRC_DIR Successed!" + } + } +} \ No newline at end of file diff --git a/tools/test_build/build.sh b/tools/test_build/build.sh new file mode 100644 index 0000000..cd26220 --- /dev/null +++ b/tools/test_build/build.sh @@ -0,0 +1,47 @@ + +cd ../../ + +pwd + +examples=($(find examples/* -maxdepth 1 -type d -printf "%f\n")) + +envs=( + "esp32s3" + "esp32c3" + "esp32dev" + "rp2040" + "nrf52840" + ) + +pio run -t clean + +for env in ${envs[@]} +do + for value in ${examples[@]} + do + if [ -f "$value/.skip."$env ];then + echo "Skip" $value + continue + fi + + export PLATFORMIO_SRC_DIR="examples/$value" + echo "PLATFORMIO_SRC_DIR=$PLATFORMIO_SRC_DIR , ENV: $env" + pio run -e $env + if [ $? -ne 0 ]; then + echo "Build env: $env $PLATFORMIO_SRC_DIR Failed!" + exit -1 + else + echo "Build env: $env $PLATFORMIO_SRC_DIR Successed!" + fi + done +done + + + + + + + + + +