test-rpi-eeprom-config: Add test cases for large config files

This commit is contained in:
Tim Gover
2019-10-06 14:08:44 +01:00
parent 937f722198
commit 57150a4104
3 changed files with 96 additions and 0 deletions

28
test/bootconf-2024.txt Normal file
View File

@@ -0,0 +1,28 @@
[all]
BOOT_UART=0
WAKE_ON_GPIO=1
POWER_OFF_ON_HALT=0
[none]
userdata0=0x12345789
userdata1=0x12345789
userdata2=0x12345789
userdata3=0x12345789
userdata4=0x12345789
userdata5=0x12345789
userdata6=0x12345789
userdata7=0x12345789
userdata8=0x12345789
userdata9=0x12345789
usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# ++++++++++++++++++++++++++++++++++++++++++++++++

28
test/bootconf-2025.txt Normal file
View File

@@ -0,0 +1,28 @@
[all]
BOOT_UART=0
WAKE_ON_GPIO=1
POWER_OFF_ON_HALT=0
[none]
userdata0=0x12345789
userdata1=0x12345789
userdata2=0x12345789
userdata3=0x12345789
userdata4=0x12345789
userdata5=0x12345789
userdata6=0x12345789
userdata7=0x12345789
userdata8=0x12345789
userdata9=0x12345789
usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
# ++++++++++++++++++++++++++++++++++++++++++++++++!

View File

@@ -107,6 +107,40 @@ check_update()
fi fi
} }
# Verify that rpi-eeprom-config will apply and 2024 byte configuration file correctly.
check_conf_size_large()
{
echo "check maximum config file size"
image="${script_dir}/$1"
conf="bootconf-2024.txt"
expected_md5="$(md5sum "${conf}" | awk '{print $1}')"
TMP_EEPROM="$(mktemp)"
"${script_dir}/../rpi-eeprom-config" \
"${image}" \
--config "${conf}" \
--out "${TMP_EEPROM}"
actual_md5="$("${script_dir}/../rpi-eeprom-config" "${TMP_EEPROM}" | md5sum | awk '{print $1}')"
[ "${actual_md5}" = "${expected_md5}" ] || die "EEPROM check large config: checksum mismatch"
}
# Verify that rpi-eeprom-config will reject files exceeding 2024 bytes
check_conf_size_too_large()
{
echo "check config file which exceeds the maximum size"
image="${script_dir}/$1"
conf="bootconf-2025.txt"
expected_md5="$(md5sum "${conf}" | awk '{print $1}')"
TMP_EEPROM="$(mktemp)"
if "${script_dir}/../rpi-eeprom-config" "${image}" --config "${conf}" --out "${TMP_EEPROM}" > /dev/null 2>&1; then
die "$config should have been rejected"
fi
}
check_loopback "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt" check_loopback "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt"
cleanup cleanup
@@ -118,3 +152,9 @@ cleanup
check_reduce_size "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt" check_reduce_size "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt"
cleanup cleanup
check_conf_size_large "../firmware/critical/pieeprom-2019-05-10.bin"
cleanup
check_conf_size_too_large "../firmware/critical/pieeprom-2019-05-10.bin"
cleanup