2020-04-02 19:10:02 -04:00
|
|
|
#!/usr/bin/env bash
|
2018-09-03 07:48:32 -04:00
|
|
|
|
2021-07-07 03:22:17 -04:00
|
|
|
function help() {
|
|
|
|
echo "Usage: bash test_espcoredump.sh [ELF_DIR]"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
help
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
elf_dir=$1
|
|
|
|
fi
|
|
|
|
|
2021-09-06 14:31:37 -04:00
|
|
|
SUPPORTED_TARGETS=("esp32" "esp32s2" "esp32c3" "esp32s3" )
|
2021-07-07 03:22:17 -04:00
|
|
|
res=0
|
2022-01-03 20:35:08 -05:00
|
|
|
python -m coverage erase
|
2021-07-07 03:22:17 -04:00
|
|
|
for chip in "${SUPPORTED_TARGETS[@]}"; do
|
|
|
|
{
|
|
|
|
echo "run b64 decoding tests on $chip"
|
2022-01-03 20:35:08 -05:00
|
|
|
python -m 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" &&
|
2021-07-07 03:22:17 -04:00
|
|
|
diff "${chip}/expected_output" "${chip}/output" &&
|
2022-01-03 20:35:08 -05:00
|
|
|
python -m 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" &&
|
2021-07-07 03:22:17 -04:00
|
|
|
diff "${chip}/expected_output" "${chip}/output2"
|
|
|
|
} || {
|
|
|
|
echo 'The test for espcoredump has failed!'
|
|
|
|
res=1
|
|
|
|
}
|
|
|
|
done
|
2022-01-03 20:35:08 -05:00
|
|
|
python -m coverage run -a --source=corefile ./test_espcoredump.py
|
|
|
|
python -m coverage report ../corefile/*.py ../espcoredump.py
|
2021-07-07 03:22:17 -04:00
|
|
|
exit $res
|