-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Maarit Härkönen <maarit.harkonen@unikie.com>
- Loading branch information
Showing
6 changed files
with
224 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
Robot-Framework/test-suites/performance-tests/boot_time_test.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# SPDX-FileCopyrightText: 2022-2024 Technology Innovation Institute (TII) | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
*** Settings *** | ||
Documentation Testing target device bootup time. | ||
Force Tags ssh_boot_test performance | ||
Resource ../../resources/serial_keywords.resource | ||
Resource ../../resources/common_keywords.resource | ||
Resource ../../resources/ssh_keywords.resource | ||
Resource ../../resources/device_control.resource | ||
Resource ../../config/variables.robot | ||
Variables ../../lib/performance_thresholds.py | ||
Library ../../lib/PerformanceDataProcessing.py ${DEVICE} ${BUILD_ID} ${JOB} | ||
Library DateTime | ||
Library Collections | ||
|
||
|
||
*** Variables *** | ||
${BOOT_TIME} ${thresholds}[boot_time][time_to_bootup] | ||
${TIME_TO_RESPOND_TO_SSH} ${thresholds}[boot_time][time_to_respond_to_ssh] | ||
${TIME_TO_RESPOND_TO_PING} ${thresholds}[boot_time][time_to_respond_to_ping] | ||
${TIME_TO_DESKTOP_AFTER_NIXOS_MENU} ${thresholds}[boot_time][time_to_desktop_after_nixos_menu] | ||
|
||
|
||
*** Test Cases *** | ||
|
||
Measure Soft Boot Time | ||
[Documentation] Measure how long it takes to device to boot up with soft reboot | ||
[Tags] SP-T197 lenovo-x1 | ||
Soft Reboot Device | ||
Wait Until Keyword Succeeds 25s 2s Check If Ping Fails | ||
Get Boot times | ||
Log <img src="${DEVICE}_${TEST NAME}.png" alt="Soft Boot Times" width="1200"> HTML | ||
|
||
Measure Hard Boot Time | ||
[Documentation] Measure how long it takes to device to boot up with hard reboot | ||
[Tags] SP-T192 lenovo-x1 | ||
Press Button ${DEVICE}-OFF | ||
Wait Until Keyword Succeeds 15s 2s Check If Ping Fails | ||
Sleep 5 # Wait until switchbot has pressed and returned button | ||
Press Button ${DEVICE}-ON | ||
Get Boot times hard | ||
Log <img src="${DEVICE}_${TEST NAME}.png" alt="Hard Boot Times" width="1200"> HTML | ||
|
||
*** Keywords *** | ||
|
||
Get Boot times | ||
[Documentation] Collect boot times from device | ||
[Arguments] ${bootype}=soft | ||
${ping_response} Set Variable False | ||
${ssh_response} Set Variable False | ||
${cmd1} Catenate SEPARATOR=\n current_timestamp=$(expr $(date '+%s%N') / 1000000000) | ||
... echo $current_timestamp | ||
${cmd2} Catenate SEPARATOR=\n since_nixos_menu=$(awk '{print $1}' /proc/uptime) | ||
... echo $since_nixos_menu | ||
${cmd3} Catenate SEPARATOR=\n | ||
... welcome_note=$(date -d "$(journalctl --output=short-iso | grep gui-vm | grep "Welcome" | tail -1 | awk '{print $1}')" "+%s") | ||
... echo $welcome_note | ||
${cmd4} Catenate SEPARATOR=\n | ||
... bar_configured_note=$(date -d "$(journalctl --output=short-iso | grep "Bar configured" | tail -1 | awk '{print $1}')" "+%s") | ||
... echo $bar_configured_note | ||
|
||
${start_time} DateTime.Get Current Date | ||
Log to console Start checking ping and ssh response | ||
WHILE not (${ping_response} and ${ssh_response}) limit=${BOOT_TIME} seconds | ||
${connection} Open Connection ${DEVICE_IP_ADDRESS} port=22 prompt=\$ timeout=2 | ||
${ssh_response} Run Keyword And Return Status Login username=${LOGIN} password=${PASSWORD} | ||
${ssh_end_time} IF ${ssh_response} DateTime.Get Current Date ELSE Set Variable False | ||
${ping_response} IF not ${ping_response} Ping Host ${DEVICE_IP_ADDRESS} | ||
${ping_end_time} IF ${ping_response} DateTime.Get Current Date ELSE Set Variable False | ||
END | ||
Connect to ghaf host | ||
${current_timestamp} Execute Command ${cmd1} | ||
${time_from_ssh_to_nixos_menu} Execute Command ${cmd2} # uptime | ||
${nixos_menu_timestamp} Subtract Time From Time ${current_timestamp} ${time_from_ssh_to_nixos_menu} | ||
${start_time_epoc} Convert Date ${start_time} epoch | ||
|
||
Connect to netvm | ||
Connect to VM ${GUI_VM} | ||
${time_from_reboot_to_desktop_available} Run Keyword And Continue On Failure | ||
... Wait Until Keyword Succeeds ${TIME_TO_DESKTOP_AFTER_NIXOS_MENU}s 1s Check Log For Notification ${cmd4} ${start_time_epoc} | ||
|
||
${ping_response_seconds} IF ${ping_response} DateTime.Subtract Date From Date ${ping_end_time} ${start_time} exclude_millis=True | ||
${ssh_response_seconds} IF ${ssh_response} DateTime.Subtract Date From Date ${ssh_end_time} ${start_time} exclude_millis=True | ||
|
||
&{final_results} Create Dictionary | ||
Set To Dictionary ${final_results} time_from_ssh_to_nixos_menu ${time_from_ssh_to_nixos_menu} | ||
Set To Dictionary ${final_results} time_from_reboot_to_desktop_available ${time_from_reboot_to_desktop_available} | ||
Set To Dictionary ${final_results} response_to_ping ${ping_response_seconds} | ||
Set To Dictionary ${final_results} response_to_ssh ${ssh_response_seconds} | ||
Save Boot time Data ${TEST NAME} ${final_results} | ||
IF '${bootype}' == 'soft' | ||
Run Keyword And Continue On Failure Should Be True ${ping_response_seconds} <= ${TIME_TO_RESPOND_TO_PING} | ||
Run Keyword And Continue On Failure Should Be True ${ssh_response_seconds} <= ${TIME_TO_RESPOND_TO_SSH} | ||
ELSE | ||
Run Keyword And Continue On Failure Should Be True ${ping_response_seconds} <= ${${TIME_TO_RESPOND_TO_PING} + 10} | ||
Run Keyword And Continue On Failure Should Be True ${ssh_response_seconds} <= ${${TIME_TO_RESPOND_TO_SSH} + 10} | ||
END | ||
Should Be True ${time_from_reboot_to_desktop_available} <= ${TIME_TO_DESKTOP_AFTER_NIXOS_MENU} | ||
|
||
|
||
*** Keywords *** | ||
Check Log For Notification | ||
[Documentation] Check that correct notification is available in journalctl | ||
[Arguments] ${command} ${current_time} | ||
${notification} Execute Command ${command} | ||
Should Not Be Empty ${notification} | ||
${time} Subtract Time From Time ${notification} ${current_time} | ||
Should Be True 0 < ${time} < 120 | ||
|
||
RETURN ${time} |