fan_speed¶
Source code: fan_speed.py
A factory test to ensure the functionality of CPU fan.
Description¶
It provides two types of test:
target_rpm mode
spin_max_then_half mode.
For mode B, it first spins fan up to a max_rpm to get an empirical maximum fan rpm; then it runs mode A with half of the empirical max rpm as target_rpm.
In mode A, the steps are:
Sets the fan speed to a target RPM.
Monitors the fan speed for a given period (duration_secs) with sampling interval (probe_interval_secs). Then it takes average of the latest num_samples_to_use samples as the stabilized fan speed reading.
Checks that the averaged reading is within range [target_rpm - error_margin, target_rpm + error_margin].
Some system services like dptf may change the fan speed while testing so users have to disable them with test object option “disable_services”. See Examples.
Test Procedure¶
This is an automatic test that doesn’t need any user interaction.
Dependency¶
Device API
cros.factory.device.fan
.
Examples¶
An example:
{
"pytest_name": "fan_speed",
"label": "Fan Speed",
"run_if": "constants.has_fan",
"disable_services": [
"dptf"
],
"args": {
"probe_interval_secs": 0.2,
"target_rpm": [
3000,
4500,
6000
],
"error_margin": 300
}
}
If you prefer to use 7% as error margin:
{
"pytest_name": "fan_speed",
"label": "Fan Speed",
"run_if": "constants.has_fan",
"disable_services": [
"dptf"
],
"args": {
"probe_interval_secs": 0.2,
"target_rpm": [
3000,
4500,
6000
],
"error_margin": 7,
"error_margin_use_percentage": true
}
}
Test Arguments¶
Name |
Type |
Description |
---|---|---|
target_rpm |
int, list |
(optional; default: |
error_margin |
int |
(optional; default: |
duration_secs |
int, float |
(optional; default: |
spin_max_then_half |
bool |
(optional; default: |
max_rpm |
int |
(optional; default: |
probe_interval_secs |
float |
(optional; default: |
num_samples_to_use |
int |
(optional; default: |
speed_use_percentage |
bool |
(optional; default: |
error_margin_use_percentage |
bool |
(optional; default: |
fan_id |
int, None |
(optional; default: |