include/kunit/test-bug.h
Source file repositories/reference/linux-study-clean/include/kunit/test-bug.h
File Facts
- System
- Linux kernel
- Corpus path
include/kunit/test-bug.h- Extension
.h- Size
- 3142 bytes
- Lines
- 98
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/stddef.hlinux/types.hlinux/jump_label.hlinux/sched.h
Detected Declarations
function kunit_get_current_testfunction kunit_fail_current_testfunction kunit_is_suppressed_warningfunction kunit_is_suppressed_warning
Annotated Snippet
if (static_branch_unlikely(&kunit_running)) { \
/* Guaranteed to be non-NULL when kunit_running true*/ \
kunit_hooks.fail_current_test(__FILE__, __LINE__, \
fmt, ##__VA_ARGS__); \
} \
} while (0)
/**
* kunit_is_suppressed_warning() - Check if warnings are being suppressed
* by the current KUnit test.
* @count: if true, increment the suppression counter on match.
*
* Returns true if the current task has active warning suppression.
* Uses the kunit_running static branch for zero overhead when no tests run.
*
* A single WARN*() may traverse multiple call sites in the warning path
* (e.g., __warn_printk() and __report_bug()). Pass @count = true at the
* primary suppression point to count each warning exactly once, and
* @count = false at secondary points to suppress output without
* inflating the count.
*/
static inline bool kunit_is_suppressed_warning(bool count)
{
if (!static_branch_unlikely(&kunit_running))
return false;
return kunit_hooks.is_suppressed_warning &&
kunit_hooks.is_suppressed_warning(count);
}
#else
static inline struct kunit *kunit_get_current_test(void) { return NULL; }
static inline bool kunit_is_suppressed_warning(bool count) { return false; }
#define kunit_fail_current_test(fmt, ...) do {} while (0)
#endif
#endif /* _KUNIT_TEST_BUG_H */
Annotation
- Immediate include surface: `linux/stddef.h`, `linux/types.h`, `linux/jump_label.h`, `linux/sched.h`.
- Detected declarations: `function kunit_get_current_test`, `function kunit_fail_current_test`, `function kunit_is_suppressed_warning`, `function kunit_is_suppressed_warning`.
- Atlas domain: Repository Root And Misc / include.
- 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.