Skip to content

Commit

Permalink
Update RF return keyword
Browse files Browse the repository at this point in the history
Signed-off-by: Maarit Härkönen <[email protected]>
  • Loading branch information
maaharko committed Oct 15, 2024
1 parent 5fd3c47 commit 458cc55
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Robot-Framework/resources/performance_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ Library Collections
Create fail message
[Arguments] ${stats}
${fail_message}= Set Variable Significant deviation detected\nThreshold ${stats}[threshold]\nMeasurement result ${stats}[measurement]\nPrevious measurement ${stats}[prev_meas] (d: ${stats}[d_previous])\nFirst meas of the last stable period ${stats}[baseline1] (d: ${stats}[d_baseline1])\nMean of last stable period ${stats}[mean] (d: ${stats}[d_mean])\n
[Return] ${fail_message}
RETURN ${fail_message}

Create improved message
[Arguments] ${stats}
${improve_message}= Set Variable Significant improvement detected!\nThreshold ${stats}[threshold]\nMeasurement result ${stats}[measurement]\nPrevious measurement ${stats}[prev_meas] (d: ${stats}[d_previous])\nFirst meas of the last stable period ${stats}[baseline1] (d: ${stats}[d_baseline1])\nMean of last stable period ${stats}[mean] (d: ${stats}[d_mean])\n
[Return] ${improve_message}
RETURN ${improve_message}
22 changes: 11 additions & 11 deletions Robot-Framework/resources/ssh_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ Connect
${connection}= Open Connection ${IP} port=${PORT} prompt=\$ timeout=30
${output}= Login username=${LOGIN} password=${PASSWORD}
Should Contain ${output} ${target_output}
[Return] ${connection}
RETURN ${connection}

Connect to ghaf host
[Documentation] Open ssh connection to ghaf host
Log To Console Connecting to Ghaf Host
${connection} Connect
Set Global Variable ${ghaf_host_ssh} ${connection}
[Return] ${connection}
RETURN ${connection}

Connect to netvm
[Documentation] Connect to netvm directly from test run machine, using
Expand All @@ -82,7 +82,7 @@ Connect to netvm
END
IF ${failed_connection} FAIL Couldn't connect NetVM
Set Global Variable ${netvm_ssh} ${connection}
[Return] ${netvm_ssh}
RETURN ${netvm_ssh}

Connect to VM
[Arguments] ${vm_name}
Expand All @@ -102,7 +102,7 @@ Connect to VM
END
IF ${failed_connection} FAIL Couldn't connect ${vm_name}

[Return] ${connection}
RETURN ${connection}

Verify Systemctl status
[Arguments] ${range}=60
Expand Down Expand Up @@ -154,7 +154,7 @@ Is process started
[Arguments] ${pid}
${rc}= Execute Command ps -p ${pid} return_rc=True
${status}= Run Keyword And Return Status Should Be Equal As Integers ${rc[1]} 0
[Return] ${status}
RETURN ${status}

Find pid by name
[Arguments] ${proc_name}
Expand All @@ -163,7 +163,7 @@ Find pid by name
Log ${output}
@{pids}= Find Pid ${output} ${proc_name}
Log To Console Found PIDs for process '${proc_name}':\n${pids}
[Return] @{pids}
RETURN @{pids}

Kill process
[Arguments] @{pids} ${sig}=15
Expand Down Expand Up @@ -209,7 +209,7 @@ Verify service status
ELSE
Fail systemctl status ${service} ${result}, expected: ${expected_status} and ${expected_state}
END
[Return] ${status} ${state}
RETURN ${status} ${state}

Verify service shutdown status
[Documentation] Check if service was stopped properly
Expand Down Expand Up @@ -273,7 +273,7 @@ Get Ghaf Version
Should Be Equal As Integers ${rc} 0 Couldn't get ghaf version, command return code
Log To Console ghaf-version: ${output}
${major} ${minor} Parse Ghaf Version ${output}
[Return] ${major} ${minor}
RETURN ${major} ${minor}

Get Nixos Version
[Documentation] Get version of NixOS, Example:
Expand All @@ -282,7 +282,7 @@ Get Nixos Version
Should Be Equal As Integers ${rc} 0 Couldn't get ghaf version, command return code
Log To Console nixos-version: ${output}
${major} ${minor} ${date} ${commit} ${name} Parse Nixos Version ${output}
[Return] ${major} ${minor} ${date} ${commit} ${name}
RETURN ${major} ${minor} ${date} ${commit} ${name}

Save log
Connect
Expand Down Expand Up @@ -345,7 +345,7 @@ Install iperf tool

Get Wifi Interface name
${if_name}= Execute Command iw dev | awk '$1=="Interface"{print $2}'
[Return] ${if_name}
RETURN ${if_name}

Get wifi IP
[Documentation] Parse ifconfig output and looks for wifi IP
Expand Down Expand Up @@ -383,7 +383,7 @@ Check if ssh is ready on device
Log to console Port 22 (ssh) of ${DEVICE} is not ready after ${timeout}
END

[Return] ${is_ready}
RETURN ${is_ready}

Check QSPI Version is up to date
${output} Execute Command ota-check-firmware
Expand Down
6 changes: 3 additions & 3 deletions Robot-Framework/resources/virtualization_keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Get list of PCI IDs
${stdout} ${stderr} ${rc}= Execute Command ${cmd} return_stdout=True return_stderr=True return_rc=True
Should Be Equal As Integers ${rc} 0
@{lines}= Split To Lines ${stdout}
[return] @{lines}
RETURN @{lines}

Get microvm PCI passthrough list
[Documentation] Returns PCI Addresses, like 0001:01:00.0
Expand All @@ -42,7 +42,7 @@ Get microvm PCI passthrough list
${stdout} ${stderr} ${rc}= Execute Command ${cmd} return_stdout=True return_stderr=True return_rc=True
Should Be Equal As Integers ${rc} 0
@{lines}= Split To Lines ${stdout}
[return] @{lines}
RETURN @{lines}

Get PCI ID from PCI Address
[Documentation] Gets VENDORID:DEVICEID pair from sysfs
Expand All @@ -51,4 +51,4 @@ Get PCI ID from PCI Address
${stdout} ${stderr} ${rc}= Execute Command ${cmd} return_stdout=True return_stderr=True return_rc=True
Should Be Equal As Integers ${rc} 0
${stripped}= Strip String ${stdout}
[return] ${stripped}
RETURN ${stripped}
2 changes: 1 addition & 1 deletion Robot-Framework/test-suites/bat_test_nuc.robot
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Get VM Device Path
END
END
IF ${status} == False FAIL Device path was not found!
[Return] ${device}
RETURN ${device}

Open Serial Port
Add Port /dev/ttyUSB0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,4 @@ Check Log For Notification
Should Not Be Empty ${notification}
${time} Subtract Time From Time ${notification} ${current_time}
Should Be True 0 < ${time} < 120

RETURN ${time}
4 changes: 2 additions & 2 deletions Robot-Framework/test-suites/performance-tests/network.robot
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ Run TCP test
Should Contain ${output.stdout} iperf Done.
Log ${output.stdout}
&{tcp_speed} Parse iperf output ${output.stdout}
[Return] &{tcp_speed}
RETURN &{tcp_speed}

Run UDP test
${output} Run Process iperf3 -c ${DEVICE_IP_ADDRESS} -u -b 100G -f M -t 10 shell=True
Should Contain ${output.stdout} iperf Done.
Log ${output.stdout}
&{udp_speed} Parse iperf output ${output.stdout}
[Return] &{udp_speed}
RETURN &{udp_speed}

Clear iptables rules
[Documentation] Clear IP tables rules to open ports
Expand Down

0 comments on commit 458cc55

Please sign in to comment.