test_espcoredump.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. function help() {
  3. echo "Usage: bash test_espcoredump.sh [ELF_DIR]"
  4. }
  5. if [ -z "$1" ]; then
  6. help
  7. exit 1
  8. else
  9. elf_dir=$1
  10. fi
  11. if ! command -v coverage &> /dev/null; then
  12. echo "coverage could not be found, please install it ('pip install coverage')"
  13. exit 1
  14. fi
  15. SUPPORTED_TARGETS=("esp32" "esp32s2" "esp32c3" "esp32s3" )
  16. res=0
  17. coverage erase
  18. for chip in "${SUPPORTED_TARGETS[@]}"; do
  19. {
  20. echo "run b64 decoding tests on $chip"
  21. coverage run -a --source=corefile ../espcoredump.py --chip="$chip" --gdb-timeout-sec 5 info_corefile -m -t b64 -c "${chip}/coredump.b64" -s "${chip}/core.elf" "${elf_dir}/${chip}.elf" &>"${chip}/output" &&
  22. diff "${chip}/expected_output" "${chip}/output" &&
  23. coverage run -a --source=corefile ../espcoredump.py --chip="$chip" --gdb-timeout-sec 5 info_corefile -m -t elf -c "${chip}/core.elf" "${elf_dir}/${chip}.elf" &>"${chip}/output2" &&
  24. diff "${chip}/expected_output" "${chip}/output2"
  25. } || {
  26. echo 'The test for espcoredump has failed!'
  27. res=1
  28. }
  29. done
  30. coverage run -a --source=corefile ./test_espcoredump.py
  31. coverage report ../corefile/*.py ../espcoredump.py
  32. exit $res