Attention is currently required from: Nico Huber, David Hendricks, Edward O'Callaghan. Anastasia Klimchuk 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 3:
(3 comments)
Commit Message:
https://review.coreboot.org/c/flashrom/+/51243/comment/19d7c988_e5f6139f PS2, Line 10: files and tests.
Nit. If these are paragraphs, split them with empty lines. If they […]
done
Patchset:
PS2:
- There are two different headers for a file under test and for a test (unittest_env. […]
Nico, sorry for a delay, I just needed some time to think about it. I really like the idea and want to do this, because it “leaves the code untouched” as you said. That would cover all the files implicitly, which is great: no need to add unittest_env.h in every file and what is even better all new future files are covered as well.
Now I am trying to get a clear idea how exactly to implement this, so reading meson manual etc, definitely working on this.
Let’s check my understanding: 1) I need to create another target in root (not test) meson.build, so that will be two targets: one for “real env”, one for “test env”? And then tests/meson.build will use that second “test env” target? 2) And “real env” target leaves includes as is, while “test env” target adds stdlib.h and unittest_env.h? 3) The last bit: tests/meson.build includes unittest.h in every test?
I am resolving two other comments, just leaving remaining hard one, but I am working on it!
File tests/flashrom.c:
https://review.coreboot.org/c/flashrom/+/51243/comment/fcfe57a8_122bd274 PS2, Line 27: #define assert_string_not_equal_with_free(text, expected) \
NB. I known this is probably just following cmocka, but I find it […]
I tried to make it better, dropped _string (7 chars) and replaced free->and (1 char) so in total I removed 8 chars from boilerplate. The remaining stuff seems to be critical: assert and free, both meaningful words, I would keep them. What do you think?