Attention is currently required from: Nico Huber, Thomas Heijligen, Edward O'Callaghan, Angel Pons. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/57918 )
Change subject: tests: Add init-shutdown test for raiden_debug_spi ......................................................................
Patch Set 5:
(2 comments)
This change is ready for review.
File tests/init_shutdown.c:
https://review.coreboot.org/c/flashrom/+/57918/comment/78f4786d_74f2cf50 PS5, Line 122: (void *) I added cast to avoid warnings about discarding const qualifier, hope it's ok.
File tests/io_mock.h:
https://review.coreboot.org/c/flashrom/+/57918/comment/16a3c10b_09495b96 PS4, Line 42: struct libusb_endpoint_descriptor { : uint8_t offset1[2]; : uint8_t bEndpointAddress; : uint8_t bmAttributes; : uint8_t offset2[5]; : unsigned char *extra; : int extra_length; : }; : typedef struct libusb_endpoint_descriptor libusb_endpoint_descriptor; : : struct libusb_interface_descriptor { : uint8_t offset1[2]; : uint8_t bInterfaceNumber; : uint8_t bAlternateSetting; : uint8_t bNumEndpoints; : uint8_t bInterfaceClass; : uint8_t bInterfaceSubClass; : uint8_t bInterfaceProtocol; : uint8_t offset2; : struct libusb_endpoint_descriptor *endpoint; : }; : typedef struct libusb_interface_descriptor libusb_interface_descriptor; : : struct libusb_interface { : struct libusb_interface_descriptor *altsetting; : int num_altsetting; : }; : typedef struct libusb_interface libusb_interface; : : struct libusb_config_descriptor { : uint8_t offset1[4]; : uint8_t bNumInterfaces; : uint8_t bConfigurationValue; : uint8_t offset2[3]; : struct libusb_interface *interface; : }; : typedef struct libusb_config_descriptor libusb_config_descriptor; : : struct libusb_device {}; : typedef struct libusb_device libusb_device; : : struct libusb_device_descriptor { : uint8_t offset1[8]; : uint16_t idVendor; : uint16_t idProduct; : uint8_t offset2[5]; : uint8_t bNumConfigurations; : }; : typedef struct libusb_device_descriptor libusb_device_descriptor;
I will re-work this patch, so that tests just include libusb.h always. […]
I included the header only once in io_mock.h and it seems to work! One thing I am not sure about, you said to "require libusb to be around to build the tests", does it mean require it in meson build? I haven't done this last bit yet, need to see what is the right way to express the requirement.
As an experiment, I changed the line into #include <libusb666.h> and the error is: ../tests/io_mock.h:41:10: fatal error: libusb666.h: No such file or directory
maybe it's not a user-friendly error...