mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-10 14:42:08 +03:00
Merge pull request #1764 from esp8266/feature/size-report
Size reports for CI builds
This commit is contained in:
16
.travis.yml
16
.travis.yml
@ -13,9 +13,12 @@ addons:
|
|||||||
script:
|
script:
|
||||||
- set -e
|
- set -e
|
||||||
- export CXX="g++-4.8" CC="gcc-4.8" GCOV="gcov-4.8"
|
- export CXX="g++-4.8" CC="gcc-4.8" GCOV="gcov-4.8"
|
||||||
|
- echo -e "travis_fold:start:host_tests"
|
||||||
- pushd $TRAVIS_BUILD_DIR/tests/host
|
- pushd $TRAVIS_BUILD_DIR/tests/host
|
||||||
- make
|
- make
|
||||||
- make clean-objects
|
- make clean-objects
|
||||||
|
- echo -e "travis_fold:end:host_tests"
|
||||||
|
- echo -e "travis_fold:start:sketch_test_env_prepare"
|
||||||
- popd
|
- popd
|
||||||
- wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
|
- wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
|
||||||
- tar xf arduino.tar.xz
|
- tar xf arduino.tar.xz
|
||||||
@ -26,15 +29,18 @@ script:
|
|||||||
- ln -s $TRAVIS_BUILD_DIR esp8266
|
- ln -s $TRAVIS_BUILD_DIR esp8266
|
||||||
- cd esp8266/tools
|
- cd esp8266/tools
|
||||||
- python get.py
|
- python get.py
|
||||||
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
|
- export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-lx106-elf/bin:$PATH"
|
||||||
- sleep 3
|
|
||||||
- export DISPLAY=:1.0
|
|
||||||
- export PATH="$HOME/arduino_ide:$PATH"
|
|
||||||
- which arduino
|
- which arduino
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- source tests/common.sh
|
- source tests/common.sh
|
||||||
- install_libraries
|
- install_libraries
|
||||||
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "python tools/build.py -l $HOME/Arduino/libraries -b generic -v"
|
- echo -e "travis_fold:end:sketch_test_env_prepare"
|
||||||
|
- echo -e "travis_fold:start:sketch_test"
|
||||||
|
- build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR "-l $HOME/Arduino/libraries"
|
||||||
|
- echo -e "travis_fold:end:sketch_test"
|
||||||
|
- echo -e "travis_fold:start:size_report"
|
||||||
|
- cat size.log
|
||||||
|
- echo -e "travis_fold:end:size_report"
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- pushd $TRAVIS_BUILD_DIR/tests/host
|
- pushd $TRAVIS_BUILD_DIR/tests/host
|
||||||
|
@ -1,13 +1,49 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function print_size_info()
|
||||||
|
{
|
||||||
|
elf_file=$1
|
||||||
|
|
||||||
|
if [ -z "$elf_file" ]; then
|
||||||
|
printf "sketch data rodata bss text irom0.text dram flash\n"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
elf_name=$(basename $elf_file)
|
||||||
|
sketch_name="${elf_name%.*}"
|
||||||
|
# echo $sketch_name
|
||||||
|
declare -A segments
|
||||||
|
while read -a tokens; do
|
||||||
|
seg=${tokens[0]}
|
||||||
|
seg=${seg//./}
|
||||||
|
size=${tokens[1]}
|
||||||
|
addr=${tokens[2]}
|
||||||
|
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
|
||||||
|
segments[$seg]=$size
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
done < <(xtensa-lx106-elf-size --format=sysv $elf_file)
|
||||||
|
|
||||||
|
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
|
||||||
|
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]}))
|
||||||
|
|
||||||
|
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
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
function build_sketches()
|
function build_sketches()
|
||||||
{
|
{
|
||||||
set +e
|
set +e
|
||||||
local arduino=$1
|
local arduino=$1
|
||||||
local srcpath=$2
|
local srcpath=$2
|
||||||
local build_cmd=$3
|
local build_arg=$3
|
||||||
echo $build_cmd
|
local build_dir=build.tmp
|
||||||
|
mkdir -p $build_dir
|
||||||
|
rm -rf $build_dir/*
|
||||||
|
local build_cmd="python tools/build.py -b generic -v -k -p $PWD/$build_dir $build_arg "
|
||||||
local sketches=$(find $srcpath -name *.ino)
|
local sketches=$(find $srcpath -name *.ino)
|
||||||
|
print_size_info >size.log
|
||||||
export ARDUINO_IDE_PATH=$arduino
|
export ARDUINO_IDE_PATH=$arduino
|
||||||
for sketch in $sketches; do
|
for sketch in $sketches; do
|
||||||
local sketchdir=$(dirname $sketch)
|
local sketchdir=$(dirname $sketch)
|
||||||
@ -33,6 +69,7 @@ function build_sketches()
|
|||||||
return $result
|
return $result
|
||||||
fi
|
fi
|
||||||
rm build.log
|
rm build.log
|
||||||
|
print_size_info $build_dir/*.elf >>size.log
|
||||||
done
|
done
|
||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user