1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00
flashrom/tests/usb_unittests.h
Alexander Goncharov d0fc4e76e1 tests: add basic lifecycle test for ch341a_spi
TEST=the following scenarios run tests successfully

1) ch341a_spi is enabled
result: all tests run and pass, including ch341a

2) ch341a_spi is disabled
result: ch341a_spi test is skipped, the rest of tests run and pass

3) libusb isn't presented in the system
result: tests for usb programmers are skipped, the rest of tests run
normally

Change-Id: If28fbe09ad685082152aa3a7e8d5a150169aee9e
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67664
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
2022-11-29 21:05:00 +00:00

63 lines
1.8 KiB
C

/*
* This file is part of the flashrom project.
*
* Copyright 2022 Google LLC
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/*
* This header provides a temporary solution to unblock build system
* work. The main goal is to remove unconditional dependency on libusb
* for unit tests. The dependency is still present, but now it is present
* only when it is needed and only when the header is present in the env.
*
* The contents of the file will be modified in a very near future.
*/
#ifndef _USB_UNITTESTS_H_
#define _USB_UNITTESTS_H_
#if CONFIG_RAIDEN_DEBUG_SPI == 1 || CONFIG_DEDIPROG == 1 || CONFIG_CH341A_SPI == 1
#include <libusb.h>
#else
struct libusb_context;
typedef struct libusb_context libusb_context;
struct libusb_device_handle;
typedef struct libusb_device_handle libusb_device_handle;
struct libusb_device_descriptor;
typedef struct libusb_device_descriptor libusb_device_descriptor;
struct libusb_device;
typedef struct libusb_device libusb_device;
struct libusb_config_descriptor;
typedef struct libusb_config_descriptor libusb_config_descriptor;
struct libusb_interface;
typedef struct libusb_interface libusb_interface;
struct libusb_interface_descriptor;
typedef struct libusb_interface_descriptor libusb_interface_descriptor;
struct libusb_endpoint_descriptor;
typedef struct libusb_endpoint_descriptor libusb_endpoint_descriptor;
struct libusb_transfer;
#endif
#endif /* _USB_UNITTESTS_H_ */