drivers/comedi/drivers/tests/unittest.h
Source file repositories/reference/linux-study-clean/drivers/comedi/drivers/tests/unittest.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/comedi/drivers/tests/unittest.h- Extension
.h- Size
- 1917 bytes
- Lines
- 63
- Domain
- Driver Families
- Bucket
- drivers/comedi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function exec_unittests
Annotated Snippet
#ifndef _COMEDI_DRIVERS_TESTS_UNITTEST_H
#define _COMEDI_DRIVERS_TESTS_UNITTEST_H
static struct unittest_results {
int passed;
int failed;
} unittest_results;
typedef void (*unittest_fptr)(void);
#define unittest(result, fmt, ...) ({ \
bool failed = !(result); \
if (failed) { \
++unittest_results.failed; \
pr_err("FAIL %s():%i " fmt, __func__, __LINE__, \
##__VA_ARGS__); \
} else { \
++unittest_results.passed; \
pr_debug("pass %s():%i " fmt, __func__, __LINE__, \
##__VA_ARGS__); \
} \
failed; \
})
/**
* Execute an array of unit tests.
* @name: Name of set of unit tests--will be shown at INFO log level.
* @unit_tests: A null-terminated list of unit tests to execute.
*/
static inline void exec_unittests(const char *name,
const unittest_fptr *unit_tests)
{
pr_info("begin comedi:\"%s\" unittests\n", name);
for (; (*unit_tests) != NULL; ++unit_tests)
(*unit_tests)();
pr_info("end of comedi:\"%s\" unittests - %i passed, %i failed\n", name,
unittest_results.passed, unittest_results.failed);
}
#endif /* _COMEDI_DRIVERS_TESTS_UNITTEST_H */
Annotation
- Detected declarations: `function exec_unittests`.
- Atlas domain: Driver Families / drivers/comedi.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.