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
|
|
|
|
|
2022-02-17 02:27:34 -05:00
|
|
|
COREDUMP_VERSION="espcoredump.py v$(python -c "import pkg_resources; print(pkg_resources.get_distribution('esp-coredump').version)")"
|
|
|
|
COREDUMP_VERSION_REGEX="espcoredump.py v([0-9])+.([0-9a-z-])+(.[0-9a-z-])?"
|
2022-09-24 13:11:17 -04:00
|
|
|
SUPPORTED_TARGETS=("esp32" "esp32s2" "esp32c3" "esp32s3" "esp32c2")
|
2021-07-07 03:22:17 -04:00
|
|
|
res=0
|
|
|
|
for chip in "${SUPPORTED_TARGETS[@]}"; do
|
|
|
|
{
|
|
|
|
echo "run b64 decoding tests on $chip"
|
2022-02-17 02:27:34 -05:00
|
|
|
esp-coredump --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" &&
|
|
|
|
sed -i -E "s/$COREDUMP_VERSION_REGEX/$COREDUMP_VERSION/" "${chip}/expected_output"
|
2021-07-07 03:22:17 -04:00
|
|
|
diff "${chip}/expected_output" "${chip}/output" &&
|
2022-02-17 02:27:34 -05:00
|
|
|
esp-coredump --chip="$chip" --gdb-timeout-sec 5 info_corefile -m -t elf -c "${chip}/core.elf" "${elf_dir}/${chip}.elf" &>"${chip}/output2" &&
|
|
|
|
sed -E "s/$COREDUMP_VERSION_REGEX/$COREDUMP_VERSION/" "${chip}/expected_output"
|
2021-07-07 03:22:17 -04:00
|
|
|
diff "${chip}/expected_output" "${chip}/output2"
|
|
|
|
} || {
|
|
|
|
echo 'The test for espcoredump has failed!'
|
|
|
|
res=1
|
|
|
|
}
|
|
|
|
done
|
|
|
|
exit $res
|