tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/prog_tests_framework.c- Extension
.c- Size
- 4308 bytes
- Lines
- 182
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.htesting_helpers.h
Detected Declarations
function clear_test_statefunction test_prog_tests_frameworkfunction dummy_emit
Annotated Snippet
static void dummy_emit(const char *buf, bool force) {}
void test_prog_tests_framework_expected_msgs(void)
{
struct expected_msgs msgs;
int i, j, error_cnt;
const struct {
const char *name;
const char *log;
const char *expected;
struct expect_msg *pats;
} cases[] = {
{
.name = "simple-ok",
.log = "aaabbbccc",
.pats = (struct expect_msg[]) {
{ .substr = "aaa" },
{ .substr = "ccc" },
{}
}
},
{
.name = "simple-fail",
.log = "aaabbbddd",
.expected = "MATCHED SUBSTR: 'aaa'\n"
"EXPECTED SUBSTR: 'ccc'\n",
.pats = (struct expect_msg[]) {
{ .substr = "aaa" },
{ .substr = "ccc" },
{}
}
},
{
.name = "negative-ok-mid",
.log = "aaabbbccc",
.pats = (struct expect_msg[]) {
{ .substr = "aaa" },
{ .substr = "foo", .negative = true },
{ .substr = "bar", .negative = true },
{ .substr = "ccc" },
{}
}
},
{
.name = "negative-ok-tail",
.log = "aaabbbccc",
.pats = (struct expect_msg[]) {
{ .substr = "aaa" },
{ .substr = "foo", .negative = true },
{}
}
},
{
.name = "negative-ok-head",
.log = "aaabbbccc",
.pats = (struct expect_msg[]) {
{ .substr = "foo", .negative = true },
{ .substr = "ccc" },
{}
}
},
{
.name = "negative-fail-head",
.log = "aaabbbccc",
.expected = "UNEXPECTED SUBSTR: 'aaa'\n",
.pats = (struct expect_msg[]) {
{ .substr = "aaa", .negative = true },
{ .substr = "bbb" },
{}
}
},
{
.name = "negative-fail-tail",
.log = "aaabbbccc",
.expected = "UNEXPECTED SUBSTR: 'ccc'\n",
.pats = (struct expect_msg[]) {
{ .substr = "bbb" },
{ .substr = "ccc", .negative = true },
{}
}
},
{
.name = "negative-fail-mid-1",
.log = "aaabbbccc",
.expected = "UNEXPECTED SUBSTR: 'bbb'\n",
.pats = (struct expect_msg[]) {
{ .substr = "aaa" },
{ .substr = "bbb", .negative = true },
{ .substr = "ccc" },
{}
Annotation
- Immediate include surface: `test_progs.h`, `testing_helpers.h`.
- Detected declarations: `function clear_test_state`, `function test_prog_tests_framework`, `function dummy_emit`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.