Attention is currently required from: Anastasia Klimchuk.
Evan Benn has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/69263 )
Change subject: tests: Mock the mode_t variant of open ......................................................................
Patch Set 6:
(4 comments)
File tests/io_mock.h:
https://review.coreboot.org/c/flashrom/+/69263/comment/463e3631_3bf22d6c PS4, Line 37: #include <fcntl.h>
Is this a platform-specific header? Is this header present on non-Linux environments? The unit tests […]
this one is posix, and posix says: `The <fcntl.h> header shall define the mode_t`
Not sure if we need to support non-posix, or what we can do if so.
File tests/tests.c:
https://review.coreboot.org/c/flashrom/+/69263/comment/2820ca3f_9eef68d8 PS4, Line 21: #include <fcntl.h>
If you need to include the same header twice, this means it needs to be included on a higher level, […]
Done
https://review.coreboot.org/c/flashrom/+/69263/comment/97060a59_91af6f82 PS4, Line 103: mode_t mode = 0; : if (flags & O_CREAT) { : va_list ap; : va_start(ap, flags); : mode = va_arg(ap, mode_t); : va_end(ap); : }
This code repeats for all variants of open wraps, can this code go to mock_open?
It has to be in the varargs function. On the other hand, I don't know the reason for the open64 and open64_2 functions, so maybe they can be removed?
File tests/wraps.h:
https://review.coreboot.org/c/flashrom/+/69263/comment/3bbdd5d0_042af44e PS4, Line 31: int __wrap_open(const char *pathname, int flags, ...); : int __wrap_open64(const char *pathname, int flags, ...); : int __wrap___open64_2(const char *pathname, int flags, ...);
Just to check, will the wraps still capture two-args variant of `open` calls?
yes, at link time there is no information about function type, only the name. This just tells the current translation unit that this is a vararg function.