Undefined behavior in unit-tests is no fun. assert_string_equal()
expects properly zero-terminated strings. None of the encoded test
strings contain a termination, hence add it manually.
Without this change, the test was often failing with a wrong error
message:
[==========] tests_lib_b64_decode-test(tests): Running 1 test(s).
[ RUN ] test_b64_decode
[ ERROR ] --- "AB" != "AB"
[ LINE ] --- tests/lib/b64_decode-test.c:38: error: Failure!
[ FAILED ] test_b64_decode
[==========] tests_lib_b64_decode-test(tests): 1 test(s) run.
Probably due to unprintable characters in the string. No idea why
my system is more susceptible to this issue.
Change-Id: Id1bd2c3ff06bc1d4e5aa21ddd0f1d5802540999d
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84088
Reviewed-by: Jakub Czapiga <czapiga@google.com>
Reviewed-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
|
||
|---|---|---|
| .. | ||
| b64_decode-test.c | ||
| bootmem-test.c | ||
| cbfs-lookup-test.c | ||
| cbfs-verification-test.c | ||
| cbmem_console-test.c | ||
| cbmem_stage_cache-test.c | ||
| coreboot_table-test.c | ||
| crc_byte-test.c | ||
| dimm_info_util-test.c | ||
| edid-test.c | ||
| fmap-test.c | ||
| hexstrtobin-test.c | ||
| imd-test.c | ||
| imd_cbmem-test.c | ||
| lib-test.c | ||
| libgcc-test.c | ||
| lzma-test.c | ||
| Makefile.mk | ||
| malloc-test.c | ||
| memchr-test.c | ||
| memcmp-test.c | ||
| memcpy-test.c | ||
| memmove-test.c | ||
| memrange-test.c | ||
| memset-test.c | ||
| region_file-test.c | ||
| rtc-test.c | ||
| spd_cache-test.c | ||
| stack-test.c | ||
| string-test.c | ||
| timestamp-test.c | ||
| uuid-test.c | ||
| ux_locales-test.c | ||