Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/56413 )
Change subject: tests: Mock file i/o for linux_mtd and linux_spi tests ......................................................................
Patch Set 10:
(6 comments)
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56413/comment/bcdbbb06_e473ea02 PS4, Line 219: //
`//` is generally accepted by the syscalls. I think that means the […]
I started reading man page for fnmatch() and realised I am not sure what the end goal is. Can we talk a bit more about this? fnmatch asks me for a pattern for pathname+filename. Is the pattern same as now but with choice of / or //? I don't know how to express the idea "accept what Linux accepts".
Haven't changed anything, so I mark this comment unresolved.
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/56413/comment/88eba068_4b23b7a0 PS9, Line 206: io_state->fopen_path = pathname;
We should keep a copy (strdup()). There is no guarantee* that the […]
Thank you, done (fclose is now freeing memory)! Yes, ideally we test that driver is functional, and also ideally test is changed very very rare, only if some dramatic changes such that mocks need to be adjusted.
https://review.coreboot.org/c/flashrom/+/56413/comment/0c4184c8_d154b651 PS9, Line 208: return (void *)0x55AA; /* valid file descriptor */
I have to say, I only understood the comment by reading the code (and would […]
I really like NOT_NULL, I added it here.
I was thinking, as next step, merge this with MOCK_HANDLER which is at the moment defined in tests.c, move it to io_mock.h and use everywhere. I like NOT_NULL name more than MOCK_HANDLER.
https://review.coreboot.org/c/flashrom/+/56413/comment/b1f6e95a_1178f2aa PS9, Line 233: const struct linux_mtd_fread_mock_entry entry = fread_mock_map[i];
I think I used a pointer in the original suggestion, but I think I forgot to dereference `fread_mock […]
Sorry, that's my fault, I used your code and fixed compile error into the wrong direction :\ Changed to a pointer, and added &
https://review.coreboot.org/c/flashrom/+/56413/comment/8b72d44a_f68a59ec PS9, Line 236: + 1
I don't think the files in sysfs provide a 0-termination? There's a linebreak […]
Do I understand you correctly, if there is a linebreak sometimes then we still need +1 to strlen?
File tests/io_mock.h:
https://review.coreboot.org/c/flashrom/+/56413/comment/ef149e57_6ad2ae89 PS9, Line 86: /* File I/O */
This is usually referred to as `stdio` or `Standard I/O`.
Done