check_examples_rom_header.sh 450 B

123456789101112131415161718192021
  1. #!/usr/bin/env bash
  2. set -uo pipefail
  3. # Examples shouldn't include rom headers directly
  4. output=$(find ${IDF_PATH}/examples -name "*.[chS]" -o -name "*.cpp" -not -path "**/build/**")
  5. files=$(egrep ".*include.*\Wrom\W.*h" ${output} | cut -d ":" -f 1)
  6. found_rom=0
  7. for file in ${files}
  8. do
  9. echo "${file} contains rom headers!"
  10. ((found_rom++))
  11. done
  12. if [ $found_rom -eq 0 ]; then
  13. echo "No rom headers found in examples"
  14. exit 0
  15. fi
  16. exit 1