void test_free_chip_iter_noclose(struct gpiod_chip_iter **iter);
void test_free_line_iter(struct gpiod_line_iter **iter);
+#define TEST_CLEANUP_CHIP TEST_CLEANUP(test_close_chip)
+
bool test_regex_match(const char *str, const char *pattern);
/*
static void chip_open_good(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
chip = gpiod_chip_open(test_chip_path(0));
TEST_ASSERT_NOT_NULL(chip);
static void chip_open_by_name_good(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
chip = gpiod_chip_open_by_name(test_chip_name(0));
TEST_ASSERT_NOT_NULL(chip);
static void chip_open_by_number_good(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
chip = gpiod_chip_open_by_number(test_chip_num(0));
TEST_ASSERT_NOT_NULL(chip);
static void chip_open_lookup(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip_by_label = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip_by_name = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip_by_path = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip_by_num = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip_by_label = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip_by_name = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip_by_path = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip_by_num = NULL;
chip_by_name = gpiod_chip_open_lookup(test_chip_name(1));
chip_by_path = gpiod_chip_open_lookup(test_chip_path(1));
static void chip_open_by_label_good(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
chip = gpiod_chip_open_by_label("gpio-mockup-D");
TEST_ASSERT_NOT_NULL(chip);
static void chip_open_by_label_bad(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
chip = gpiod_chip_open_by_label("nonexistent_gpio_chip");
TEST_ASSERT_NULL(chip);
static void chip_name(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip0 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip1 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip2 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip0 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip1 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip2 = NULL;
chip0 = gpiod_chip_open(test_chip_path(0));
chip1 = gpiod_chip_open(test_chip_path(1));
static void chip_label(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip0 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip1 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip2 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip0 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip1 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip2 = NULL;
chip0 = gpiod_chip_open(test_chip_path(0));
chip1 = gpiod_chip_open(test_chip_path(1));
static void chip_num_lines(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip0 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip1 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip2 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip3 = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip4 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip0 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip1 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip2 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip3 = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip4 = NULL;
chip0 = gpiod_chip_open(test_chip_path(0));
chip1 = gpiod_chip_open(test_chip_path(1));
static void chip_get_lines(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_bulk bulk;
unsigned int offsets[4];
struct gpiod_line *line;
static void chip_get_all_lines(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_bulk bulk;
struct gpiod_line *line;
int rv;
static void chip_find_line_good(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
chip = gpiod_chip_open(test_chip_path(1));
static void chip_find_line_not_found(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
chip = gpiod_chip_open(test_chip_path(1));
static void event_rising_edge_good(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
static void event_falling_edge_good(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
static void event_rising_edge_ignore_falling(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct timespec ts = { 0, 300 };
struct gpiod_line *line;
int rv;
static void event_rising_edge_active_low(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
static void event_get_value(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
static void event_get_value_active_low(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct timespec ts = { 1, 0 };
struct gpiod_line_event ev;
struct gpiod_line *line;
static void event_wait_multiple(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_bulk bulk, event_bulk;
struct timespec ts = { 1, 0 };
struct gpiod_line *line;
static void event_get_fd_when_values_requested(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int rv, fd;
static void event_request_bulk_fail(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_bulk bulk = GPIOD_LINE_BULK_INITIALIZER;
struct gpiod_line *line;
int rv, i;
static void gpioinfo_dump_all_chips_one_exported(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int rv;
{
TEST_CLEANUP(test_free_chip_iter_noclose)
struct gpiod_chip_iter *iter = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipA = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipB = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipC = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipA = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipB = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipC = NULL;
struct gpiod_chip *chip;
bool A, B, C;
static void line_iter(void)
{
TEST_CLEANUP(test_free_line_iter) struct gpiod_line_iter *iter = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
unsigned int i = 0;
static void line_request_output(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line_0;
struct gpiod_line *line_1;
int status;
static void line_request_already_requested(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int status;
static void line_consumer(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int status;
static void line_consumer_long_string(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int status;
static void line_request_bulk_output(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipA = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipB = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipA = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipB = NULL;
struct gpiod_line_bulk bulkB = GPIOD_LINE_BULK_INITIALIZER;
struct gpiod_line_bulk bulkA;
struct gpiod_line *lineA0;
static void line_request_bulk_different_chips(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipA = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipB = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipA = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipB = NULL;
struct gpiod_line_request_config req;
struct gpiod_line_bulk bulk;
struct gpiod_line *lineA0;
static void line_request_null_default_vals_for_output(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_bulk bulk = GPIOD_LINE_BULK_INITIALIZER;
struct gpiod_line *line;
int rv, vals[3];
static void line_set_value(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int status;
static void line_get_value_different_chips(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipA = NULL;
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chipB = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipA = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chipB = NULL;
struct gpiod_line *lineA1, *lineA2, *lineB1, *lineB2;
struct gpiod_line_bulk bulkA, bulkB, bulk;
int rv, vals[4];
static void line_direction(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int status;
static void line_active_state(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int status;
static void line_misc_flags(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_request_config config;
struct gpiod_line *line;
int status;
static void line_open_source_open_drain_input_invalid(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int rv;
static void line_open_source_open_drain_simultaneously(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line *line;
int rv;
static void line_null_consumer(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_request_config config;
struct gpiod_line *line;
int rv;
static void line_empty_consumer(void)
{
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_request_config config;
struct gpiod_line *line;
int rv;
"gpio-mockup-A-2",
"gpio-mockup-A-3" };
- TEST_CLEANUP(test_close_chip) struct gpiod_chip *chip = NULL;
+ TEST_CLEANUP_CHIP struct gpiod_chip *chip = NULL;
struct gpiod_line_bulk bulk = GPIOD_LINE_BULK_INITIALIZER;
struct gpiod_line *line, **lineptr;
int i;