tools/testing/selftests/module/find_symbol.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/module/find_symbol.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/module/find_symbol.sh- Extension
.sh- Size
- 1492 bytes
- Lines
- 82
- 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
# SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1
# Copyright (C) 2023 Luis Chamberlain <mcgrof@kernel.org>
#
# This is a stress test script for kallsyms through find_symbol()
set -e
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
test_reqs()
{
if ! which modprobe 2> /dev/null > /dev/null; then
echo "$0: You need modprobe installed" >&2
exit $ksft_skip
fi
if ! which kmod 2> /dev/null > /dev/null; then
echo "$0: You need kmod installed" >&2
exit $ksft_skip
fi
if ! which perf 2> /dev/null > /dev/null; then
echo "$0: You need perf installed" >&2
exit $ksft_skip
fi
uid=$(id -u)
if [ $uid -ne 0 ]; then
echo $msg must be run as root >&2
exit $ksft_skip
fi
}
load_mod()
{
local STATS="-e duration_time"
STATS="$STATS -e user_time"
STATS="$STATS -e system_time"
STATS="$STATS -e page-faults"
local MOD=$1
local ARCH="$(uname -m)"
case "${ARCH}" in
x86_64)
perf stat $STATS $MODPROBE $MOD
;;
*)
time $MODPROBE $MOD
exit 1
;;
esac
}
remove_all()
{
$MODPROBE -r test_kallsyms_b
for i in a b c d; do
$MODPROBE -r test_kallsyms_$i
done
}
test_reqs
MODPROBE=$(</proc/sys/kernel/modprobe)
remove_all
load_mod test_kallsyms_b
remove_all
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.