scripts/dtc/of_unittest_expect
Source file repositories/reference/linux-study-clean/scripts/dtc/of_unittest_expect
File Facts
- System
- Linux kernel
- Corpus path
scripts/dtc/of_unittest_expect- Extension
[no extension]- Size
- 12691 bytes
- Lines
- 542
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- Inferred role
- Support Tooling And Documentation: scripts
- Status
- atlas-only
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.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
if ($expect_next ne $got_next) {
return 0;
}
if ($type eq "int") {
if ($got =~ /^[+-]*[0-9]+/) {
$got =~ s/^[+-]*[0-9]+//;
} else {
return 0;
}
} elsif ($type eq "hex") {
if ($got =~ /^(0x)*[0-9a-f]+/) {
$got =~ s/^(0x)*[0-9a-f]+//;
} else {
return 0;
}
} elsif ($type eq "all") {
return 1;
} elsif ($type eq "") {
if ($expect_next ne $got_next) {
return 0;
} else {
return 1;
}
} else {
$internal_err++;
print "** ERROR: special pattern not recognized: <<$type>>, CONSOLE_LOG line: $.\n";
return 0;
}
}
# should not get here
$internal_err++;
print "** ERROR: $script_name internal error, at end of compare(), CONSOLE_LOG line: $.\n";
return 0;
}
#______________________________________________________________________________
sub usage {
# ***** when editing, be careful to not put tabs in the string printed:
print STDERR
"
usage:
$script_name CONSOLE_LOG
-h print program usage
--help print program usage
--hide-expect suppress output of EXPECTed lines
--line-num report line number of CONSOLE_LOG
--no-expect-stats do not report EXPECT statistics
--no-strip-ts do not strip leading console timestamps
--verbose do not suppress EXPECT begin and end lines
--version print program version and exit
Process a console log for EXPECTed test related messages to either
highlight expected devicetree unittest related messages or suppress
the messages. Leading console timestamps will be stripped.
Various unittests may trigger kernel messages from outside the
unittest code. The unittest annotates that it expects the message
to occur with an 'EXPECT \\ : text' (begin) before triggering the
message, and an 'EXPECT / : text' (end) after triggering the message.
Annotation
- Atlas domain: Support Tooling And Documentation / scripts.
- Implementation status: atlas-only.
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.