tools/testing/selftests/cpufreq/module.sh
Source file repositories/reference/linux-study-clean/tools/testing/selftests/cpufreq/module.sh
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/cpufreq/module.sh- Extension
.sh- Size
- 4946 bytes
- Lines
- 243
- 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
#
# Modules specific tests cases
# protect against multiple inclusion
if [ $FILE_MODULE ]; then
return 0
else
FILE_MODULE=DONE
fi
source cpu.sh
source cpufreq.sh
source governor.sh
# Check basic insmod/rmmod
# $1: module
test_basic_insmod_rmmod()
{
printf "** Test: Running ${FUNCNAME[0]} **\n\n"
printf "Inserting $1 module\n"
# insert module
insmod $1
if [ $? != 0 ]; then
ktap_exit_fail_msg "Insmod $1 failed\n"
fi
printf "Removing $1 module\n"
# remove module
rmmod $1
if [ $? != 0 ]; then
ktap_exit_fail_msg "rmmod $1 failed\n"
fi
printf "\n"
}
# Insert cpufreq driver module and perform basic tests
# $1: cpufreq-driver module to insert
# $2: If we want to play with CPUs (1) or not (0)
module_driver_test_single()
{
printf "** Test: Running ${FUNCNAME[0]} for driver $1 and cpus_hotplug=$2 **\n\n"
if [ $2 -eq 1 ]; then
# offline all non-boot CPUs
for_each_non_boot_cpu offline_cpu
printf "\n"
fi
# insert module
printf "Inserting $1 module\n\n"
insmod $1
if [ $? != 0 ]; then
printf "Insmod $1 failed\n"
return;
fi
if [ $2 -eq 1 ]; then
# online all non-boot CPUs
for_each_non_boot_cpu online_cpu
printf "\n"
fi
# run basic tests
cpufreq_basic_tests
# remove module
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.