tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc
Source file repositories/reference/linux-study-clean/tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/ftrace/test.d/ftrace/func-filter-glob.tc- Extension
.tc- Size
- 1545 bytes
- Lines
- 59
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- 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
function ftrace_filter_check
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: ftrace - function glob filters
# requires: set_ftrace_filter function:tracer
# Make sure that function glob matching filter works.
disable_tracing
clear_trace
ftrace_filter_check() { # glob grep
echo "$1" > set_ftrace_filter
cut -f1 -d" " set_ftrace_filter > $TMPDIR/actual
cut -f1 -d" " available_filter_functions | grep "$2" > $TMPDIR/expected
DIFF=`diff $TMPDIR/actual $TMPDIR/expected`
test -z "$DIFF"
}
# filter by *, front match
ftrace_filter_check '*schedule' '^.*schedule$'
# filter by *, middle match
ftrace_filter_check '*schedule*' '^.*schedule.*$'
# filter by *, end match
ftrace_filter_check 'schedule*' '^schedule.*$'
# filter by *mid*end
ftrace_filter_check '*pin*lock' '.*pin.*lock$'
# filter by start*mid*
ftrace_filter_check 'mutex*unl*' '^mutex.*unl.*'
# Advanced full-glob matching feature is recently supported.
# Skip the tests if we are sure the kernel does not support it.
if grep -q 'accepts: .* glob-matching-pattern' README ; then
# filter by *, both side match
ftrace_filter_check 'sch*ule' '^sch.*ule$'
# filter by char class.
ftrace_filter_check '[Ss]y[Ss]_*' '^[Ss]y[Ss]_.*$'
# filter by ?, schedule is always good
if ! echo "sch?dule" > set_ftrace_filter; then
# test for powerpc 64
if ! echo ".sch?dule" > set_ftrace_filter; then
fail "can not enable schedule filter"
fi
cat set_ftrace_filter | grep '^.schedule$'
else
cat set_ftrace_filter | grep '^schedule$'
fi
fi
echo > set_ftrace_filter
enable_tracing
Annotation
- Detected declarations: `function ftrace_filter_check`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.