tools/perf/tests/shell/base_probe/test_adding_kernel.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/base_probe/test_adding_kernel.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/base_probe/test_adding_kernel.sh- Extension
.sh- Size
- 11466 bytes
- Lines
- 347
- 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
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
"probe:vfs_link" "probe:vfs_write" < $LOGS_DIR/adding_kernel_adding_wildcard.err
CHECK_EXIT_CODE=$?
if [ $NO_DEBUGINFO ] ; then
print_testcase_skipped $NO_DEBUGINFO $NO_DEBUGINFO "Skipped due to missing debuginfo"
else
print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "wildcard adding support"
fi
(( TEST_RESULT += $? ))
### non-existing variable
# perf probe should survive a non-existing variable probing attempt
{ $CMD_PERF probe 'vfs_read somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64' ; } 2> $LOGS_DIR/adding_kernel_nonexisting.err
PERF_EXIT_CODE=$?
# the exitcode should not be 0 or segfault
test $PERF_EXIT_CODE -ne 139 -a $PERF_EXIT_CODE -ne 0
PERF_EXIT_CODE=$?
# check that the error message is reasonable
"$DIR_PATH/../common/check_all_patterns_found.pl" \
"Failed to find" \
"somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64" \
< $LOGS_DIR/adding_kernel_nonexisting.err
CHECK_EXIT_CODE=$?
"$DIR_PATH/../common/check_all_patterns_found.pl" \
"in this function|at this address" "Error" "Failed to add events" \
< $LOGS_DIR/adding_kernel_nonexisting.err
(( CHECK_EXIT_CODE += $? ))
"$DIR_PATH/../common/check_all_lines_matched.pl" \
"Failed to find" "Error" "Probe point .+ not found" "optimized out" \
"Use.+\-\-range option to show.+location range" \
< $LOGS_DIR/adding_kernel_nonexisting.err
(( CHECK_EXIT_CODE += $? ))
"$DIR_PATH/../common/check_no_patterns_found.pl" \
"$RE_SEGFAULT" < $LOGS_DIR/adding_kernel_nonexisting.err
(( CHECK_EXIT_CODE += $? ))
if [ $NO_DEBUGINFO ]; then
print_testcase_skipped $NO_DEBUGINFO $NO_DEBUGINFO "Skipped due to missing debuginfo"
else
print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "non-existing variable"
fi
(( TEST_RESULT += $? ))
### function with return value
# adding probe with return value
$CMD_PERF probe --add "$TEST_PROBE%return \$retval" 2> $LOGS_DIR/adding_kernel_func_retval_add.err
PERF_EXIT_CODE=$?
"$DIR_PATH/../common/check_all_patterns_found.pl" \
"Added new events?:" "probe:$TEST_PROBE" \
"on $TEST_PROBE%return with \\\$retval" \
< $LOGS_DIR/adding_kernel_func_retval_add.err
CHECK_EXIT_CODE=$?
print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "function with retval :: add"
(( TEST_RESULT += $? ))
# recording some data
$CMD_PERF record -e probe:$TEST_PROBE\* -o $CURRENT_TEST_DIR/perf.data -- cat /proc/cpuinfo > /dev/null 2> $LOGS_DIR/adding_kernel_func_retval_record.err
PERF_EXIT_CODE=$?
"$DIR_PATH/../common/check_all_patterns_found.pl" \
Annotation
- 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.