Skip to content

Commit

Permalink
Add tests for the web server (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
me-no-dev authored Sep 21, 2019
1 parent f6c8778 commit 545260d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
30 changes: 25 additions & 5 deletions travis/build-pio.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
#!/bin/bash

echo -e "travis_fold:start:install_pio"

pip install -U platformio
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_pio"

python -m platformio lib --storage-dir $PWD
echo -e "travis_fold:start:install_lib"
python -m platformio lib --storage-dir $TRAVIS_BUILD_DIR install
if [ $? -ne 0 ]; then exit 1; fi

echo -e "travis_fold:end:install_pio"
echo -e "travis_fold:end:install_lib"

echo -e "travis_fold:start:test_pio"
for EXAMPLE in $PWD/examples/*/*.ino; do
for EXAMPLE in $TRAVIS_BUILD_DIR/examples/*/*.ino; do
python -m platformio ci $EXAMPLE -l '.' -b esp12e
if [ $? -ne 0 ]; then exit 1; fi
done
echo -e "travis_fold:end:test_pio"

echo -e "travis_fold:start:install_json"
python -m platformio lib -g install https://github.com/bblanchon/ArduinoJson.git
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_json"

cd $HOME/
echo -e "travis_fold:start:install_web_server"
git clone https://github.com/me-no-dev/ESPAsyncWebServer
if [ $? -ne 0 ]; then exit 1; fi
python -m platformio lib --storage-dir $HOME/ESPAsyncWebServer install
if [ $? -ne 0 ]; then exit 1; fi
echo -e "travis_fold:end:install_web_server"

echo -e "travis_fold:start:test_web_server"
for EXAMPLE in $HOME/ESPAsyncWebServer/examples/*/*.ino; do
python -m platformio ci $EXAMPLE -l $TRAVIS_BUILD_DIR -l $HOME/ESPAsyncWebServer -b esp12e
if [ $? -ne 0 ]; then exit 1; fi
done
echo -e "travis_fold:end:test_web_server"
15 changes: 11 additions & 4 deletions travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ cp -rf $TRAVIS_BUILD_DIR ESPAsyncTCP
PLATFORM_EXAMPLES=$TRAVIS_BUILD_DIR/examples

cd $HOME/Arduino/libraries
git clone https://github.com/me-no-dev/ESPAsyncTCP
git clone https://github.com/me-no-dev/ESPAsyncWebServer
git clone https://github.com/bblanchon/ArduinoJson
LIB_EXAMPLES=$HOME/Arduino/libraries/ESPAsyncWebServer/examples

cd $HOME/Arduino/hardware
mkdir esp8266com
cd esp8266com
Expand Down Expand Up @@ -99,9 +102,9 @@ function build_sketch()

function count_sketches()
{
local sketches=$(find $PLATFORM_EXAMPLES -name *.ino)
local path=$1
local sketches=$(find $path -name *.ino)
local sketchnum=0
rm -rf sketches.txt
for sketch in $sketches; do
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
Expand All @@ -124,8 +127,12 @@ function build_sketches()

local chunk_idex=$1
local chunks_num=$2
count_sketches
rm -rf sketches.txt
count_sketches $PLATFORM_EXAMPLES
local sketchcount=$?
count_sketches $LIB_EXAMPLES
local libsketchcount=$?
sketchcount=$(($sketchcount + $libsketchcount))
local sketches=$(cat sketches.txt)

local chunk_size=$(( $sketchcount / $chunks_num ))
Expand Down

0 comments on commit 545260d

Please sign in to comment.