Attention is currently required from: David Hendricks, Edward O'Callaghan, Anastasia Klimchuk. Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/51243 )
Change subject: Enable dynamic memory allocation checks for cmocka unit tests ......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2:
- There are two different headers for a file under test and for a test (unittest_env.h vs unittest.h). Can this be expressed from the command line: different includes for different files?
Yes, absolutely. Don't ask me how to do it with Meson, though. I'd have to look into it.
- Using -include directives from the command line means that none of stdlib|unittest|unittest_env headers are included in the file is that correct? So someone looking at the file won't see stdlib included, and only after inspecting Makefile can understand this?
My idea is to leave the code untouched and only add -include directives via the `tests/meson.build`. So any .c file that needs `stdlib.h` would still include it the usual way (it would just be redundant when compiled for the tests).
- Looking from the other side: at the moment there are no inline functions with malloc in flashrom code. Does not seem like a commonly used pattern here? Moving include to a command line seems like a big change, and for all files (not only under /test), I am worried to do this for a problem that does not exist at the moment, and maybe will never exist?
It's far fetched indeed, but IMHO a valid example to prove that the order of includes matters. Introducing header files that need to be included in the right order to the whole code base vs. -include directives in the tests' build description. Seems to me the former is the bigger change.