mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
tests: add more wrappers for libusb funcs
The patch adds wrappers for libusb functions that are used in the ch341a programmer and have not yet been introduced. Change-Id: Ic11efb9fd746cb91911dbe87e1c0028759f5bb0b Signed-off-by: Alexander Goncharov <chat@joursoir.net> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69872 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
This commit is contained in:
parent
de016a17f2
commit
571a9ac832
@ -34,6 +34,17 @@ int __wrap_libusb_init(libusb_context **ctx)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __wrap_libusb_set_debug(libusb_context *ctx, int level)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __wrap_libusb_set_option(libusb_context *ctx, int option, ...)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __wrap_libusb_open(libusb_device *dev, libusb_device_handle **devh)
|
int __wrap_libusb_open(libusb_device *dev, libusb_device_handle **devh)
|
||||||
{
|
{
|
||||||
LOG_ME;
|
LOG_ME;
|
||||||
@ -58,6 +69,19 @@ int __wrap_libusb_attach_kernel_driver(libusb_device_handle *dev_handle, int int
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct libusb_device_handle *__wrap_libusb_open_device_with_vid_pid(
|
||||||
|
libusb_context *ctx, uint16_t vendor_id, uint16_t product_id)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
return not_null();
|
||||||
|
}
|
||||||
|
|
||||||
|
libusb_device *__wrap_libusb_get_device(libusb_device_handle *dev_handle)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
return not_null();
|
||||||
|
}
|
||||||
|
|
||||||
ssize_t __wrap_libusb_get_device_list(libusb_context *ctx, libusb_device ***list)
|
ssize_t __wrap_libusb_get_device_list(libusb_context *ctx, libusb_device ***list)
|
||||||
{
|
{
|
||||||
LOG_ME;
|
LOG_ME;
|
||||||
@ -161,6 +185,29 @@ void __wrap_libusb_unref_device(libusb_device *dev)
|
|||||||
LOG_ME;
|
LOG_ME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct libusb_transfer *__wrap_libusb_alloc_transfer(int iso_packets)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
return not_null();
|
||||||
|
}
|
||||||
|
|
||||||
|
int __wrap_libusb_submit_transfer(struct libusb_transfer *transfer)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void __wrap_libusb_free_transfer(struct libusb_transfer *transfer)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
}
|
||||||
|
|
||||||
|
int __wrap_libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv)
|
||||||
|
{
|
||||||
|
LOG_ME;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void __wrap_libusb_exit(libusb_context *ctx)
|
void __wrap_libusb_exit(libusb_context *ctx)
|
||||||
{
|
{
|
||||||
LOG_ME;
|
LOG_ME;
|
||||||
|
@ -21,10 +21,15 @@
|
|||||||
void *__wrap_usb_dev_get_by_vid_pid_number(
|
void *__wrap_usb_dev_get_by_vid_pid_number(
|
||||||
libusb_context *usb_ctx, uint16_t vid, uint16_t pid, unsigned int num);
|
libusb_context *usb_ctx, uint16_t vid, uint16_t pid, unsigned int num);
|
||||||
int __wrap_libusb_init(libusb_context **ctx);
|
int __wrap_libusb_init(libusb_context **ctx);
|
||||||
|
void __wrap_libusb_set_debug(libusb_context *ctx, int level);
|
||||||
|
int __wrap_libusb_set_option(libusb_context *ctx, int option, ...);
|
||||||
int __wrap_libusb_open(libusb_device *dev, libusb_device_handle **devh);
|
int __wrap_libusb_open(libusb_device *dev, libusb_device_handle **devh);
|
||||||
int __wrap_libusb_set_auto_detach_kernel_driver(libusb_device_handle *devh, int enable);
|
int __wrap_libusb_set_auto_detach_kernel_driver(libusb_device_handle *devh, int enable);
|
||||||
int __wrap_libusb_detach_kernel_driver(libusb_device_handle *dev_handle, int interface_number);
|
int __wrap_libusb_detach_kernel_driver(libusb_device_handle *dev_handle, int interface_number);
|
||||||
int __wrap_libusb_attach_kernel_driver(libusb_device_handle *dev_handle, int interface_number);
|
int __wrap_libusb_attach_kernel_driver(libusb_device_handle *dev_handle, int interface_number);
|
||||||
|
struct libusb_device_handle *__wrap_libusb_open_device_with_vid_pid(
|
||||||
|
libusb_context *ctx, uint16_t vendor_id, uint16_t product_id);
|
||||||
|
libusb_device *__wrap_libusb_get_device(libusb_device_handle *dev_handle);
|
||||||
ssize_t __wrap_libusb_get_device_list(libusb_context *ctx, libusb_device ***list);
|
ssize_t __wrap_libusb_get_device_list(libusb_context *ctx, libusb_device ***list);
|
||||||
void __wrap_libusb_free_device_list(libusb_device **list, int unref_devices);
|
void __wrap_libusb_free_device_list(libusb_device **list, int unref_devices);
|
||||||
uint8_t __wrap_libusb_get_bus_number(libusb_device *dev);
|
uint8_t __wrap_libusb_get_bus_number(libusb_device *dev);
|
||||||
@ -43,6 +48,10 @@ int __wrap_libusb_release_interface(libusb_device_handle *devh, int interface_nu
|
|||||||
void __wrap_libusb_close(libusb_device_handle *devh);
|
void __wrap_libusb_close(libusb_device_handle *devh);
|
||||||
libusb_device *__wrap_libusb_ref_device(libusb_device *dev);
|
libusb_device *__wrap_libusb_ref_device(libusb_device *dev);
|
||||||
void __wrap_libusb_unref_device(libusb_device *dev);
|
void __wrap_libusb_unref_device(libusb_device *dev);
|
||||||
|
struct libusb_transfer *__wrap_libusb_alloc_transfer(int iso_packets);
|
||||||
|
int __wrap_libusb_submit_transfer(struct libusb_transfer *transfer);
|
||||||
|
void __wrap_libusb_free_transfer(struct libusb_transfer *transfer);
|
||||||
|
int __wrap_libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv);
|
||||||
void __wrap_libusb_exit(libusb_context *ctx);
|
void __wrap_libusb_exit(libusb_context *ctx);
|
||||||
|
|
||||||
#endif /* LIBUSB_WRAPS_H */
|
#endif /* LIBUSB_WRAPS_H */
|
||||||
|
@ -79,10 +79,14 @@ mocks = [
|
|||||||
'-Wl,--wrap=INL',
|
'-Wl,--wrap=INL',
|
||||||
'-Wl,--wrap=usb_dev_get_by_vid_pid_number',
|
'-Wl,--wrap=usb_dev_get_by_vid_pid_number',
|
||||||
'-Wl,--wrap=libusb_init',
|
'-Wl,--wrap=libusb_init',
|
||||||
|
'-Wl,--wrap=libusb_set_debug',
|
||||||
|
'-Wl,--wrap=libusb_set_option',
|
||||||
'-Wl,--wrap=libusb_open',
|
'-Wl,--wrap=libusb_open',
|
||||||
'-Wl,--wrap=libusb_set_auto_detach_kernel_driver',
|
'-Wl,--wrap=libusb_set_auto_detach_kernel_driver',
|
||||||
'-Wl,--wrap=libusb_detach_kernel_driver',
|
'-Wl,--wrap=libusb_detach_kernel_driver',
|
||||||
'-Wl,--wrap=libusb_attach_kernel_driver',
|
'-Wl,--wrap=libusb_attach_kernel_driver',
|
||||||
|
'-Wl,--wrap=libusb_open_device_with_vid_pid',
|
||||||
|
'-Wl,--wrap=libusb_get_device',
|
||||||
'-Wl,--wrap=libusb_get_device_list',
|
'-Wl,--wrap=libusb_get_device_list',
|
||||||
'-Wl,--wrap=libusb_free_device_list',
|
'-Wl,--wrap=libusb_free_device_list',
|
||||||
'-Wl,--wrap=libusb_get_bus_number',
|
'-Wl,--wrap=libusb_get_bus_number',
|
||||||
@ -98,6 +102,10 @@ mocks = [
|
|||||||
'-Wl,--wrap=libusb_ref_device',
|
'-Wl,--wrap=libusb_ref_device',
|
||||||
'-Wl,--wrap=libusb_unref_device',
|
'-Wl,--wrap=libusb_unref_device',
|
||||||
'-Wl,--wrap=libusb_close',
|
'-Wl,--wrap=libusb_close',
|
||||||
|
'-Wl,--wrap=libusb_alloc_transfer',
|
||||||
|
'-Wl,--wrap=libusb_submit_transfer',
|
||||||
|
'-Wl,--wrap=libusb_free_transfer',
|
||||||
|
'-Wl,--wrap=libusb_handle_events_timeout',
|
||||||
'-Wl,--wrap=libusb_exit',
|
'-Wl,--wrap=libusb_exit',
|
||||||
'-Wl,--gc-sections',
|
'-Wl,--gc-sections',
|
||||||
]
|
]
|
||||||
|
@ -55,6 +55,8 @@ typedef struct libusb_interface_descriptor libusb_interface_descriptor;
|
|||||||
struct libusb_endpoint_descriptor;
|
struct libusb_endpoint_descriptor;
|
||||||
typedef struct libusb_endpoint_descriptor libusb_endpoint_descriptor;
|
typedef struct libusb_endpoint_descriptor libusb_endpoint_descriptor;
|
||||||
|
|
||||||
|
struct libusb_transfer;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _USB_UNITTESTS_H_ */
|
#endif /* _USB_UNITTESTS_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user