travis_at_home 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env bash
  2. #
  3. # travis_at_home
  4. #
  5. # Run all Travis test builds at home to save time finding typos
  6. # Make sure to have 'arduino' somewhere in your PATH
  7. #
  8. LOG="travis-out.txt"
  9. cd `dirname "$0"`/../..
  10. TRAVIS_BUILD_DIR=`pwd`
  11. echo $'Tests for '$TRAVIS_BUILD_DIR$' ...\n' >"$LOG"
  12. # Add a temporary execution PATH
  13. export PATH="./buildroot/bin:$PATH"
  14. # Scan .travis.yml and run config/build commands only
  15. X=1
  16. while read P; do
  17. # Command lines start with a hyphen
  18. if [[ $P =~ ^-\ (([^ ]+)(\ .*)?)$ ]]; then
  19. WORD="${BASH_REMATCH[2]}" ; # The first word
  20. CMD="${BASH_REMATCH[1]}" ; # The whole command
  21. RUN=1 ; BUILD=0
  22. case "$WORD" in
  23. cp|opt_*|pins_*|use_*|restore_*|gen*) ;;
  24. build_*) BUILD=1 ;;
  25. *) RUN=0 ;;
  26. esac
  27. # Runnable command
  28. if [[ $RUN == 1 ]]; then
  29. echo "$CMD" >>"$LOG"
  30. RESULT=$( eval "$CMD >>\"$LOG\" 2>&1" )
  31. if [[ $BUILD == 1 ]]; then
  32. echo "--- Build $X done."
  33. echo >>"$LOG"
  34. X=$((X+1))
  35. fi
  36. fi
  37. fi
  38. done <.travis.yml
  39. cd - >/dev/null