Skip to content

Commit

Permalink
Develop the power measurement keywords
Browse files Browse the repository at this point in the history
Added keyword: Stop recording power

Signed-off-by: Samuli Leivo <[email protected]>
  • Loading branch information
leivos-unikie committed Nov 12, 2024
1 parent 4ab92c4 commit c4d891e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
31 changes: 22 additions & 9 deletions Robot-Framework/resources/power_meas_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
Resource ../config/variables.robot
Library SSHLibrary

*** Variables ***
${MEAS_IP_ADDRESS} 192.168.100.41
${LOGIN_PI}
${PASSWORD_PI}
${ssh_measurement} ${EMPTY}


*** Keywords ***

Expand All @@ -15,18 +21,25 @@ Start power measurement
Start recording power ${build_id}

Connect to measurement agent
[Documentation] Set up SSH connection to the measurement agent
[Arguments] ${IP}=${MEAS_IP_ADDRESS} ${PORT}=22 ${target_output}=ghaf@raspberrypi
${connection}= Open Connection ${IP} port=${PORT} prompt=\$ timeout=15
${output}= Login username=${LOGIN_PI} password=${PASSWORD_PI}
Should Contain ${output} ${target_output}
RETURN ${connection}
[Documentation] Set up SSH connection to the measurement agent
[Arguments] ${IP}=${MEAS_IP_ADDRESS} ${PORT}=22 ${target_output}=ghaf@raspberrypi
Log To Console Connecting to measurement agent
${connection}= Open Connection ${IP} port=${PORT} prompt=\$ timeout=15
${output}= Login username=${LOGIN_PI} password=${PASSWORD_PI}
Should Contain ${output} ${target_output}
Set Global Variable ${ssh_measurement} ${connection}
RETURN ${ssh_measurement}

Start recording power
[Arguments] ${file_name}=power_data.csv
Run Keyword And Ignore Error Execute Command -b python ~/ghaf/ghaf-power-meas/measure_power.py ${file_name} timeout=3
[Arguments] ${file_name}=power_data
Log To Console Starting to record power measurements
Run Keyword And Ignore Error Execute Command nohup python /home/ghaf/ghaf/ghaf-power-measurement/measure_power.py ${file_name}.csv > output.log 2>&1 & timeout=3

Stop recording power
Log To Console Stopping power recording
Run Keyword And Ignore Error Execute Command pkill python timeout=3

Get power record
[Arguments] ${file_name}=power_data.csv
Connect to measurement agent
SSHLibrary.Get File ~/ghaf/ghaf-power-meas/power_data/${file_name}
SSHLibrary.Get File /home/ghaf/ghaf/power_data/${file_name}
3 changes: 2 additions & 1 deletion Robot-Framework/test-suites/gui-tests/__init__.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Resource ../../resources/ssh_keywords.resource
Resource ../../resources/serial_keywords.resource
Resource ../../resources/gui_keywords.resource
Resource ../../resources/common_keywords.resource
Resource ../../resources/power_meas_keywords.resource
Library ../../lib/gui_testing.py
Suite Setup Common Setup
Suite Teardown Common Teardown
Expand All @@ -33,7 +34,7 @@ Common Setup
${lock} Check if locked
IF ${lock}
Log To Console Screen lock detected
Unlock
GUI Unlock
ELSE
Log To Console Screen lock not active
GUI Log in
Expand Down

0 comments on commit c4d891e

Please sign in to comment.