tools/perf/tests/shell/base_probe/test_invalid_options.sh
Source file repositories/reference/linux-study-clean/tools/perf/tests/shell/base_probe/test_invalid_options.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/tests/shell/base_probe/test_invalid_options.sh- Extension
.sh- Size
- 2452 bytes
- Lines
- 87
- 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
#!/bin/bash
# perf_probe :: Reject invalid options (exclusive)
# SPDX-License-Identifier: GPL-2.0
#
# test_invalid_options of perf_probe test
# Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
# Author: Michael Petlan <mpetlan@redhat.com>
#
# Description:
#
# This test checks whether the invalid and incompatible options are reported
#
DIR_PATH="$(dirname $0)"
TEST_RESULT=0
# include working environment
. "$DIR_PATH/../common/init.sh"
if ! check_kprobes_available; then
print_overall_skipped
exit 2
fi
# Check for presence of DWARF
$CMD_PERF check feature -q dwarf
[ $? -ne 0 ] && HINT_FAIL="Some of the tests need DWARF to run"
### missing argument
# some options require an argument
for opt in '-a' '-d' '-L' '-V'; do
! $CMD_PERF probe $opt 2> $LOGS_DIR/invalid_options_missing_argument$opt.err
PERF_EXIT_CODE=$?
"$DIR_PATH/../common/check_all_patterns_found.pl" \
"Error: switch .* requires a value" \
< $LOGS_DIR/invalid_options_missing_argument$opt.err
CHECK_EXIT_CODE=$?
print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "missing argument for $opt"
(( TEST_RESULT += $? ))
done
### unnecessary argument
# some options may omit the argument
for opt in '-F' '-l'; do
$CMD_PERF probe -F > /dev/null 2> $LOGS_DIR/invalid_options_unnecessary_argument$opt.err
PERF_EXIT_CODE=$?
test ! -s $LOGS_DIR/invalid_options_unnecessary_argument$opt.err
CHECK_EXIT_CODE=$?
print_results $PERF_EXIT_CODE $CHECK_EXIT_CODE "unnecessary argument for $opt"
(( TEST_RESULT += $? ))
done
### mutually exclusive options
# some options are mutually exclusive
test -e $LOGS_DIR/invalid_options_mutually_exclusive.log && rm -f $LOGS_DIR/invalid_options_mutually_exclusive.log
for opt in '-a xxx -d xxx' '-a xxx -L foo' '-a xxx -V foo' '-a xxx -l' '-a xxx -F' \
'-d xxx -L foo' '-d xxx -V foo' '-d xxx -l' '-d xxx -F' \
'-L foo -V bar' '-L foo -l' '-L foo -F' '-V foo -l' '-V foo -F' '-l -F'; do
! $CMD_PERF probe $opt > /dev/null 2> $LOGS_DIR/aux.log
PERF_EXIT_CODE=$?
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.