Skip to content

Commit

Permalink
keywords.robot & CPU-performance-lib: remove unused kwds
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Gołaś <[email protected]>
  • Loading branch information
philipandag committed Jan 13, 2025
1 parent d1dc02f commit 024d98f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 108 deletions.
122 changes: 19 additions & 103 deletions keywords.robot
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
*** Settings ***
Library Collections
Library OperatingSystem
Resource pikvm-rest-api/pikvm_comm.robot
Resource lib/bios/menus.robot
Resource lib/secure-boot-lib.robot
Resource lib/usb-hid-msc-lib.robot
Resource lib/dts-lib.robot
Resource lib/terminal.robot
Resource lib/esp-scanning-lib.robot
Resource lib/dl-cache.robot
Resource lib/dmidecode-lib.robot
Resource lib/docks.robot
Resource lib/flash.robot
Resource lib/self-tests.robot
Resource lib/sleep-lib.robot
Resource lib/CPU-performance-lib.robot
Resource lib/framework.robot
Resource lib/me.robot
Resource lib/network.robot
Variables platform-configs/fan-curve-config.yaml
Library Collections
Library OperatingSystem
Resource pikvm-rest-api/pikvm_comm.robot
Resource lib/bios/menus.robot
Resource lib/secure-boot-lib.robot
Resource lib/usb-hid-msc-lib.robot
Resource lib/dts-lib.robot
Resource lib/terminal.robot
Resource lib/esp-scanning-lib.robot
Resource lib/dl-cache.robot
Resource lib/dmidecode-lib.robot
Resource lib/docks.robot
Resource lib/flash.robot
Resource lib/self-tests.robot
Resource lib/sleep-lib.robot
Resource lib/CPU-performance-lib.robot
Resource lib/framework.robot
Resource lib/me.robot
Resource lib/network.robot


*** Keywords ***
Expand Down Expand Up @@ -484,26 +483,6 @@ Get All USB
${count}= Evaluate ${count_usb}+${external_count}
RETURN ${count}

Prepare Lm-sensors
[Documentation] Install lm-sensors and probe sensors.
Detect Or Install Package lm-sensors
Execute Command In Terminal sudo sensors-detect --auto
IF '${PLATFORM}' == 'raptor-cs_talos2'
Execute Command In Terminal modprobe w83795
END

Get Fan Speed
[Documentation] Returns current fan speed as int.
# Detect or Install Package lm-sensors
# Execute Command In Terminal yes | sudo sensors-detect
# Execute Command In Terminal modprobe w83795
${speed}= Execute Command In Terminal sensors | grep fan1
${speed}= Get Lines Containing String ${speed} RPM)
${speed_split}= Split String ${speed}
${rpm}= Get From List ${speed_split} 1
${rpm}= Convert To Number ${rpm}
RETURN ${rpm}

Prepare Test Suite
[Documentation] Keyword prepares Test Suite by importing specific
... platform configuration keywords and variables and
Expand Down Expand Up @@ -764,25 +743,6 @@ Get USB Devices Windows
${out}= Execute Command In Terminal Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match '^USB' }
RETURN ${out}

Get CPU Temperature And CPU Fan Speed
[Documentation] Get the current CPU temperature in Celsius degrees and
... the current CPU fan speed in rpms.
${output}= Telnet.Execute Command sensors w83795g-i2c-1-2f |grep fan1 -A 16
${rpm}= Get Lines Containing String ${output} fan1
${rpm}= Split String ${rpm} ${SPACE}
${rpm}= Get Substring ${rpm} -8 -7
${rpm}= Get From List ${rpm} 0
${rpm_value}= Convert To Integer ${rpm}
${temperature}= Get Lines Containing String ${output} temp7
${temperature}= Split String ${temperature} ${SPACE}
${temperature}= Get Substring ${temperature} -8 -7
${temperature}= Get From List ${temperature} 0
${temperature}= Remove String ${temperature} +
${temperature}= Remove String ${temperature} °
${temperature}= Remove String ${temperature} C
${temperature_value}= Convert To Number ${temperature}
RETURN ${rpm_value} ${temperature_value}

Execute Linux Command Without Output
[Documentation] Execute linux command over serial console. Do not return
... standard output. There is one optional argument. The
Expand Down Expand Up @@ -1505,50 +1465,6 @@ Get Intel ME Mode State
${actual_state}= Fetch From Left ${menu_me} >
RETURN ${actual_state}

Calculate Smoothing
[Documentation] Compares the actual and expected value of the fan speed,
... taking smoothing into account.
[Arguments] ${pwm} ${expected_speed_percentage}
${pwm}= Evaluate float(${pwm}/2.55)
IF ${expected_speed_percentage} < 35
${smoothing}= Evaluate 1
ELSE
${smoothing}= Evaluate 6
END
${high_limit}= Evaluate ${expected_speed_percentage}+${smoothing}
${low_limit}= Evaluate ${expected_speed_percentage}-${smoothing}
Log To Console \n ----------------------------------------------------------------
Log To Console From PWM: ${pwm}%
Log To Console From Temp: ${expected_speed_percentage}%
Should Be True ${low_limit} < ${pwm} < ${high_limit}

Get PWM Value
[Documentation] Returns current PWN value from hwmon.
# ../hwmon/hwmonX/pwm{1,2}
${hwmon}= Execute Command In Terminal
... ls /sys/devices/LNXSYSTM\:00/LNXSYBUS\:00/17761776\:00/hwmon | grep hwmon
${pwm}= Execute Command In Terminal cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/17761776:00/hwmon/${hwmon}/pwm1
${pwm}= Convert To Number ${pwm}
RETURN ${pwm}

Get Temperature CURRENT
[Documentation] Get current temperature from hwmon.
${hwmon}= Execute Command In Terminal
... ls /sys/devices/LNXSYSTM\:00/LNXSYBUS\:00/17761776\:00/hwmon | grep hwmon
${temperature}= Execute Command In Terminal
... cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/17761776:00/hwmon/${hwmon}/temp1_input
${temperature}= Evaluate ${temperature[:2]}
${temperature}= Convert To Number ${temperature}
RETURN ${temperature}

Get RPM Value From System76 Acpi
[Documentation] Returns current RPM value of CPU fan form driver
... system76_acpi.
${speed}= Execute Command In Terminal sensors | grep "CPU fan"
${speed_split}= Split String ${speed}
${rpm}= Get From List ${speed_split} 2
RETURN ${rpm}

Disable Option In Submenu
[Documentation] Disables selected option in submenu provided in ${menu_construction}
[Arguments] ${menu_construction} ${option_str}
Expand Down
9 changes: 4 additions & 5 deletions lib/CPU-performance-lib.robot
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
*** Settings ***
Resource sensors.robot


*** Keywords ***
Get CPU Frequency MAX
[Documentation] Get max CPU Frequency.
Expand All @@ -21,11 +25,6 @@ Get CPU Frequency MIN
${freq}= Evaluate ${freq}-100
RETURN ${freq}

Get CPU Temperature CURRENT
[Documentation] Get current CPU temperature.
${temperature}= Execute Command In Terminal sensors 2>/dev/null | awk -F '[+°]' '/Package id 0:/ {printf $2}'
RETURN ${temperature}

Get CPU Frequencies In Ubuntu
[Documentation] Get all CPU frequencies in Ubuntu OS. Keyword returns
... list of current CPU frequencies
Expand Down

0 comments on commit 024d98f

Please sign in to comment.