Skip to content

Add build_even/odd types to split Arduino tests #4737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ cache:
matrix:
include:
- env:
- BUILD_TYPE=build
- BUILD_TYPE=build_even
- env:
- BUILD_TYPE=build_odd
- env:
- BUILD_TYPE=platformio
- env:
Expand Down
22 changes: 19 additions & 3 deletions tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,19 @@ function build_sketches()
local srcpath=$2
local build_arg=$3
local build_dir=build.tmp
local build_mod=$4
local build_rem=$5
mkdir -p $build_dir
local build_cmd="python tools/build.py -b generic -v -w all -s 4M1M -v -k -p $PWD/$build_dir $build_arg "
local sketches=$(find $srcpath -name *.ino)
local sketches=$(find $srcpath -name *.ino | sort)
print_size_info >size.log
export ARDUINO_IDE_PATH=$arduino
local testcnt=0
for sketch in $sketches; do
testcnt=$(( ($testcnt + 1) % $build_mod ))
if [ $testcnt -ne $build_rem ]; then
continue # Not ours to do
fi
rm -rf $build_dir/*
local sketchdir=$(dirname $sketch)
local sketchdirname=$(basename $sketchdir)
Expand Down Expand Up @@ -202,9 +209,12 @@ function install_arduino()

function build_sketches_with_arduino()
{
local build_mod=$1
local build_rem=$2

# Compile sketches
echo -e "travis_fold:start:sketch_test"
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries"
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries" $1 $2
echo -e "travis_fold:end:sketch_test"

# Generate size report
Expand Down Expand Up @@ -239,7 +249,13 @@ fi

if [ "$BUILD_TYPE" = "build" ]; then
install_arduino
build_sketches_with_arduino
build_sketches_with_arduino 1 0
elif [ "$BUILD_TYPE" = "build_even" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please rename build/build_odd/build_even to e.g. arduino/arduino_odd/arduino_even? It's not critical for the pr, but every time I read through this code it takes me a few minutes to remember that "build" really means arduino and is not common to everything.

install_arduino
build_sketches_with_arduino 2 0
elif [ "$BUILD_TYPE" = "build_odd" ]; then
install_arduino
build_sketches_with_arduino 2 1
elif [ "$BUILD_TYPE" = "platformio" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't a similar even/odd scheme be implemented for platformio builds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not needed. PlatformIO builds the examples 2x (yes, two times) as fast as Arduino. So it takes ~28mins today vs 50+mins for Ardunio. Should we go from 96 to 200 examples, I'll revisit this statement, but for now we're OK. 😄

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the.times, you're right. Even with load I see the platformio runtime doesn't go above 40mins.

# PlatformIO
install_platformio
Expand Down