File tree Expand file tree Collapse file tree 2 files changed +51
-8
lines changed Expand file tree Collapse file tree 2 files changed +51
-8
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,12 @@ addons:
1313script :
1414 - set -e
1515 - export CXX="g++-4.8" CC="gcc-4.8" GCOV="gcov-4.8"
16+ - echo -e "travis_fold:start:host_tests"
1617 - pushd $TRAVIS_BUILD_DIR/tests/host
1718 - make
1819 - make clean-objects
20+ - echo -e "travis_fold:end:host_tests"
21+ - echo -e "travis_fold:start:sketch_test_env_prepare"
1922 - popd
2023 - wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
2124 - tar xf arduino.tar.xz
@@ -26,15 +29,18 @@ script:
2629 - ln -s $TRAVIS_BUILD_DIR esp8266
2730 - cd esp8266/tools
2831 - python get.py
29- - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
30- - sleep 3
31- - export DISPLAY=:1.0
32- - export PATH="$HOME/arduino_ide:$PATH"
32+ - export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-lx106-elf/bin:$PATH"
3333 - which arduino
3434 - cd $TRAVIS_BUILD_DIR
3535 - source tests/common.sh
3636 - install_libraries
37- - build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "python tools/build.py -l $HOME/Arduino/libraries -b generic -v"
37+ - echo -e "travis_fold:end:sketch_test_env_prepare"
38+ - echo -e "travis_fold:start:sketch_test"
39+ - build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "-l $HOME/Arduino/libraries"
40+ - echo -e "travis_fold:end:sketch_test"
41+ - echo -e "travis_fold:start:size_report"
42+ - cat size.log
43+ - echo -e "travis_fold:end:size_report"
3844
3945after_success :
4046 - pushd $TRAVIS_BUILD_DIR/tests/host
Original file line number Diff line number Diff line change 1- #! /bin/bash
1+ #! /usr/bin/env bash
2+
3+ function print_size_info()
4+ {
5+ elf_file=$1
6+
7+ if [ -z " $elf_file " ]; then
8+ printf " sketch data rodata bss text irom0.text dram flash\n"
9+ return 0
10+ fi
11+
12+ elf_name=$( basename $elf_file )
13+ sketch_name=" ${elf_name% .* } "
14+ # echo $sketch_name
15+ declare -A segments
16+ while read -a tokens; do
17+ seg=${tokens[0]}
18+ seg=${seg// ./ }
19+ size=${tokens[1]}
20+ addr=${tokens[2]}
21+ if [ " $addr " -eq " $addr " -a " $addr " -ne " 0" ] 2> /dev/null; then
22+ segments[$seg ]=$size
23+ fi
24+
25+
26+ done < <( xtensa-lx106-elf-size --format=sysv $elf_file )
27+
28+ total_ram=$(( ${segments[data]} + ${segments[rodata]} + ${segments[bss]} ))
29+ total_flash=$(( ${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]} ))
30+
31+ printf " %-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[data]} ${segments[rodata]} ${segments[bss]} ${segments[text]} ${segments[irom0text]} $total_ram $total_flash
32+ return 0
33+ }
234
335function build_sketches()
436{
537 set +e
638 local arduino=$1
739 local srcpath=$2
8- local build_cmd=$3
9- echo $build_cmd
40+ local build_arg=$3
41+ local build_dir=build.tmp
42+ mkdir -p $build_dir
43+ rm -rf $build_dir /*
44+ local build_cmd=" python tools/build.py -b generic -v -k -p $PWD /$build_dir $build_arg "
1045 local sketches=$( find $srcpath -name * .ino)
46+ print_size_info > size.log
1147 export ARDUINO_IDE_PATH=$arduino
1248 for sketch in $sketches ; do
1349 local sketchdir=$( dirname $sketch )
@@ -33,6 +69,7 @@ function build_sketches()
3369 return $result
3470 fi
3571 rm build.log
72+ print_size_info $build_dir /* .elf >> size.log
3673 done
3774 set -e
3875}
You can’t perform that action at this time.
0 commit comments