Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/40538 )
Change subject: tests: Add lib/string-test test case ......................................................................
Patch Set 2:
(3 comments)
https://review.coreboot.org/c/coreboot/+/40538/1/tests/include/mocks/assert.... File tests/include/mocks/assert.h:
https://review.coreboot.org/c/coreboot/+/40538/1/tests/include/mocks/assert.... PS1, Line 64: * called.
Can you provide an example? […]
Sorry, I just wrote these comments in the order I read your code. I mean an example of where dead_code() breaks compilation. I see now that your issue was with strdup() but I think providing the -stage attribute was the more appropriate solution to that, so this is no longer relevant.
https://review.coreboot.org/c/coreboot/+/40538/2/tests/lib/Makefile.inc File tests/lib/Makefile.inc:
https://review.coreboot.org/c/coreboot/+/40538/2/tests/lib/Makefile.inc@21 PS2, Line 21: string-test-stage:= ramstage Actually, I'd rather you leave this out so that the reference to others is that you don't need to provide it unless you care about the stage explicitly (because people will just copy&paste this).
https://review.coreboot.org/c/coreboot/+/40538/2/tests/lib/string-test.c File tests/lib/string-test.c:
https://review.coreboot.org/c/coreboot/+/40538/2/tests/lib/string-test.c@34 PS2, Line 34: assert_int_equal(0, memcmp(str, duplicate, strlen(str))); Cmocka seems to have an assert_string_equal().