mirror of
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git
synced 2026-10-24 00:48:53 +03:00
This commit is the result of a squash of all the commits created during the development of libgpiod v2. This is done to preserve bisectability of the git tree. It contains significant re-writes of the core C library as well as C++ and python bindings. The tools have been adjusted to work with the new API but have not undergone significant changes yet. This commit contains the bulk of the work on libgpiod v2 but the development continues with more changes planned. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> [Ben: fix format specifier for uint64_t] Signed-off-by: Ben Hutchings <ben.hutchings@mind.be> [Viresh: Fix ioctl number for gpiod_line_request_reconfigure_lines()] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> [Kent: bug fixes, improvements, better pointer contracts, type strictness] Signed-off-by: Kent Gibson <warthog618@gmail.com>
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/* SPDX-FileCopyrightText: 2017-2022 Bartosz Golaszewski <brgl@bgdev.pl> */
|
|
|
|
/*
|
|
* Testing framework for the core library.
|
|
*
|
|
* This file contains functions and definitions extending the GLib unit testing
|
|
* framework with functionalities necessary to test the libgpiod core C API as
|
|
* well as the kernel-to-user-space interface.
|
|
*/
|
|
|
|
#ifndef __GPIOD_TEST_H__
|
|
#define __GPIOD_TEST_H__
|
|
|
|
#include <glib.h>
|
|
|
|
/* These are private definitions and should not be used directly. */
|
|
|
|
struct _gpiod_test_case {
|
|
const gchar *path;
|
|
void (*func)(void);
|
|
};
|
|
|
|
void _gpiod_test_register(struct _gpiod_test_case *test);
|
|
|
|
#define _GPIOD_TEST_PATH(_name) \
|
|
"/gpiod/" GPIOD_TEST_GROUP "/" G_STRINGIFY(_name)
|
|
|
|
/*
|
|
* Register a test case function.
|
|
*/
|
|
#define GPIOD_TEST_CASE(_name) \
|
|
static void _gpiod_test_func_##_name(void); \
|
|
static struct _gpiod_test_case _##_name##_test_case = { \
|
|
.path = _GPIOD_TEST_PATH(_name), \
|
|
.func = _gpiod_test_func_##_name, \
|
|
}; \
|
|
static __attribute__((constructor)) void \
|
|
_##_name##_test_register(void) \
|
|
{ \
|
|
_gpiod_test_register(&_##_name##_test_case); \
|
|
} \
|
|
static void _gpiod_test_func_##_name(void)
|
|
|
|
#endif /* __GPIOD_TEST_H__ */
|