2024-07-21 13:43:13 +02:00
*** Settings ***
Library Collections
2026-02-04 16:39:03 +01:00
Library Dialogs
2024-07-21 13:43:13 +02:00
Library OperatingSystem
Library Process
Library String
Library Telnet timeout=30 seconds connection_timeout=120 seconds
Library SSHLibrary timeout=90 seconds
Library RequestsLibrary
# Library ../osfv-scripts/osfv_cli/src/osfv/rf/rte_robot.py
# TODO: maybe have a single file to include if we need to include the same
# stuff in all test cases
Resource ../variables.robot
Resource ../keywords.robot
Resource ../keys.robot
2024-09-06 12:23:48 +02:00
Resource ../keys-and-keywords/ubuntu-keywords.robot
2026-02-04 16:39:03 +01:00
Resource ../lib/custom_bootentries.robot
2024-07-21 13:43:13 +02:00
# TODO:
# - document which setup/teardown keywords to use and what are they doing
# - go threough them and make sure they are doing what the name suggest (not
# exactly the case right now)
2025-03-27 17:34:05 +01:00
Suite Setup Run Keyword
2024-07-21 13:43:13 +02:00
... Prepare Test Suite
Suite Teardown Run Keyword
... Log Out And Close Connection
2025-09-24 07:47:30 +02:00
Default Tags automated minimal-regression
2024-07-21 13:43:13 +02:00
*** Test Cases ***
2026-02-04 16:39:03 +01:00
BPS009.001 Create Custom Bootentry For Default Boot OS
[Documentation] Creates a custom bootentry for the default boot os, which
... will always stay the first bootentry.
... Must be performed before any other BPS on platforms without Serial.
[Tags] semiauto automated
Skip If '${OPTIONS_LIB}' != 'options-lib_dcu' Only supported when testing via SSH without Serial
${default_boot}= Get From Dictionary ${ENV_ID_OS_BOOTMENU_NAMES} ${DEFAULT_BOOT_OS_ID}
Power On
Boot System Or From Connected Disk ${DEFAULT_BOOT_OS_ID}
Log In To Linux
Switch To Root User
${windows_entries}= Get Bootnums For OS ${ENV_ID_WINDOWS}
${windows_amount}= Get Length ${windows_entries}
IF ${windows_amount} == 1 and ${TEST_TAGS} is not @{EMPTY} and "semiauto" in ${TEST_TAGS}
Execute Manual Step
... Boot Windows once and reboot. Make sure a second `Windows Boot Manager` boot entry was created in the Boot Menu. Boot back to DEFAULT_BOOT_OS_ID (${default_boot}).
Boot System Or From Connected Disk ${DEFAULT_BOOT_OS_ID}
Login To Linux
Switch To Root User
END
${custom_bootnum}= Ensure Custom Entry ${DEFAULT_BOOT_OS_ID} force=${TRUE}
${bootorder}= Get BootOrder
BootOrder Should Start With Bootnum ${bootorder} ${custom_bootnum}
2025-03-12 12:26:30 +01:00
BPS001.001 Power Control - PSU ON and serial output
[Documentation] Verifies if PSU can be turned ON and if the serial output can be read.
2025-03-27 17:34:24 +01:00
Skip If '${INITIAL_DUT_CONNECTION_METHOD}' == 'SSH'
Skip If '${POWER_CTRL}' == 'none'
2024-07-21 13:43:13 +02:00
Power On
2025-12-01 11:21:11 +01:00
${result}= Wait For Serial Output 300
2024-07-21 13:43:13 +02:00
Should Be True ${result} msg=Power On keyword failed
2025-03-12 12:26:30 +01:00
BPS002.001 Power control - PSU OFF
[Documentation] Verifies if PSU can be turned OFF
2025-03-27 17:34:24 +01:00
Skip If '${INITIAL_DUT_CONNECTION_METHOD}' == 'SSH'
Skip If '${POWER_CTRL}' == 'none'
2024-07-21 13:43:13 +02:00
Power On
${result}= Wait For Serial Output
Should Be True ${result} msg=Power On keyword failed
2025-03-12 12:26:30 +01:00
Rte Psu Off
2024-07-21 13:43:13 +02:00
Read From Terminal
${result}= Wait For Serial Output timeout=10
2025-03-12 12:26:30 +01:00
Should Not Be True ${result} msg=Failed to switch PSU OFF
2024-07-21 13:43:13 +02:00
2025-03-12 12:26:30 +01:00
BPS003.001 RTE Power On
[Documentation] Verifies if Power Button can turn DUT ON/OFF.
2024-07-21 13:43:13 +02:00
# TODO: do we have platforms in the lab that might not use
# power/reset buttons? If so, we do not have flag for it.
2025-03-27 17:34:24 +01:00
Skip If '${INITIAL_DUT_CONNECTION_METHOD}' == 'SSH'
Skip If '${POWER_CTRL}' == 'none'
2025-08-05 10:45:23 +02:00
Skip If not ${DUT_HAS_POWER_BUTTON}
2024-07-21 13:43:13 +02:00
Power On
${result}= Wait For Serial Output
Should Be True ${result} msg=Power On keyword failed
2025-03-14 09:59:58 +01:00
Power Off Ex
2024-07-21 13:43:13 +02:00
Sleep 10s
Read From Terminal
${result}= Wait For Serial Output timeout=10
Should Not Be True ${result} msg=Failed to power off DUT via power button
2025-03-14 09:59:58 +01:00
Power On Ex
2024-07-21 13:43:13 +02:00
${result}= Wait For Serial Output
Should Be True ${result} msg=Failed to power on DUT via power button
2025-03-12 12:26:30 +01:00
BPS004.001 RTE Reset
[Documentation] Verifies if reset button can reset the DUT.
2025-03-27 17:34:24 +01:00
Skip If '${INITIAL_DUT_CONNECTION_METHOD}' == 'SSH'
Skip If '${POWER_CTRL}' == 'none'
2025-08-05 10:45:23 +02:00
Skip If not ${DUT_HAS_RESET_BUTTON}
2024-07-21 13:43:13 +02:00
Power On
2025-03-14 09:59:58 +01:00
${result}= Wait For Serial Output
Should Be True ${result} msg=Power On keyword failed
2024-07-21 13:43:13 +02:00
Rte Reset
Read From Terminal
${result}= Wait For Serial Output
Should Be True ${result} msg=Failed to reset DUT via reset button
2025-03-12 12:26:30 +01:00
BPS005.001 Boot to OS - Ubuntu
2024-07-21 13:43:13 +02:00
[Documentation] This test verifies if platform can be booted to Ubunto and if correct credentials are set.
2025-03-27 17:34:24 +01:00
Skip If "${ENV_ID_UBUNTU}" not in "${TESTED_LINUX_DISTROS}"
2024-07-21 13:43:13 +02:00
Power On
2025-02-24 18:10:21 +01:00
Boot System Or From Connected Disk ${ENV_ID_UBUNTU}
2024-07-21 13:43:13 +02:00
Login To Linux
Switch To Root User
2024-09-06 12:23:48 +02:00
${logging}= Get Logging Level
IF ${logging} != 0
Log To Console Changing logging level from ${logging} to 0
Set Logging Level 0
END
${logging}= Get Logging Level
Should Be Equal As Integers ${logging} 0
2024-07-21 13:43:13 +02:00
2025-03-12 12:26:30 +01:00
BPS005.002 Boot to OS - Windows
2024-07-21 13:43:13 +02:00
[Documentation] This test verifies if platform can be booted to Windows, if SSH server is enabled and if correct credentials are set.
2025-11-21 16:24:20 +01:00
Skip If not ${TESTS_IN_WINDOWS_SUPPORT} ${TEST_NAME} not supported
2024-07-21 13:43:13 +02:00
Power On
Login To Windows
2025-03-27 17:43:56 +01:00
BPS006.001 Ensure test dependencies
[Documentation] Ensure that all the dependencies for the tests are
... installed on all supported OSes
Run Ansible Playbooks
BPS007.001 External flashing
2024-07-21 13:43:13 +02:00
[Documentation] This test verifies if the flash die can be detected.
2025-03-27 17:34:24 +01:00
Skip If '${FLASHING_METHOD}' != 'external'
2025-11-24 11:24:20 +01:00
IF '${APU_FLASH_WP_GPIO}' != '${TBD}'
2025-11-21 16:24:20 +01:00
Rte Gpio Set ${APU_FLASH_WP_GPIO} low
END
2024-07-21 13:43:13 +02:00
${rc}= Rte Flash Probe
2025-11-24 11:24:20 +01:00
IF '${APU_FLASH_WP_GPIO}' != '${TBD}'
2025-11-21 16:24:20 +01:00
Rte Gpio Set ${APU_FLASH_WP_GPIO} high-z
END
2024-07-21 13:43:13 +02:00
Should Be Equal As Integers ${rc} 0
2025-03-27 17:43:56 +01:00
BPS007.002 Internal flashing
2024-07-21 13:43:13 +02:00
[Documentation] This test verifies if flashrom can detect the die.
2025-03-27 17:34:24 +01:00
Skip If '${FLASHING_METHOD}' == 'none'
2024-07-21 13:43:13 +02:00
Power On
2025-02-24 18:10:21 +01:00
Boot System Or From Connected Disk ${ENV_ID_UBUNTU}
2024-07-21 13:43:13 +02:00
Login To Linux
Switch To Root User
${out_flashrom}= Execute Command In Terminal flashrom -p internal
Should Contain ${out_flashrom} Found chipset
2025-03-27 17:43:56 +01:00
BPS008.001 RTE CMOS clear
2025-03-12 15:29:55 +01:00
[Documentation] This test verifies if CMOS clear works with the platform setup.
2025-03-27 17:34:24 +01:00
Skip If '${POWER_CTRL}' == 'none'
2025-08-05 10:45:23 +02:00
Skip If not ${DUT_HAS_CMOS_RESET}
2025-03-12 15:29:55 +01:00
# CMOS should be cleared when platform is cut off from power
Rte Psu Off
Rte Clear Cmos
Power On
# TODO: Can we do it without Linux?
Boot System Or From Connected Disk ${ENV_ID_UBUNTU}
Login To Linux
Switch To Root User
# Test relies entirely on coreboot console to print the CMOS invalid message
${out}= Execute Command In Terminal
... cbmem -1 | grep -i rtc
Should Contain Any ${out}
2025-03-13 18:28:48 +01:00
... RTC: Clear requested
... rtc_failed \= 0x1
2025-03-12 15:29:55 +01:00
... ignore_case=True
Execute Reboot Command
# Now check if the CMOS is not reset again after reboot. If CMOS fails it
# means that either the CMOS battery is not connected at all or the
# platform setup is incorrect.
Boot System Or From Connected Disk ${ENV_ID_UBUNTU}
Login To Linux
Switch To Root User
${out}= Execute Command In Terminal
... cbmem -1 | grep -i rtc
Should Not Contain Any
... ${out}
2025-03-13 18:28:48 +01:00
... RTC: Clear requested
... rtc_failed \= 0x1
2025-03-12 15:29:55 +01:00
... ignore_case=True
... msg=CMOS is invalid after reboot. Either the CMOS battery is not connected or the connection is wrong. Check DUT setup.
2024-07-21 13:43:13 +02:00
*** Keywords ***
Check If Empty
[Documentation] Checks if string is empty. Ignores spaces and newline.
[Arguments] ${str}
${str_length}= Get Length ${str}
IF ${str_length} != 0
@{str}= Split String To Characters ${str}
FOR ${char} IN @{str}
IF '${char.replace('\n','').strip()}' != '${SPACE}'
RETURN ${FALSE}
END
END
END
RETURN ${TRUE}
Wait For Serial Output
[Documentation] This keywords checks every second if non-whitespace
... characters had appeared on the serial output. As soon as it happens,
... it returns True. If it fails to receive any non-whitespace
... characters as output during period defined as ${timeout} argument,
... it returns False.
2025-12-01 11:21:11 +01:00
[Arguments] ${timeout}=300
2024-07-21 13:43:13 +02:00
FOR ${i} IN RANGE ${timeout}
Sleep 1s
${out}= Read From Terminal
${result}= Check If Empty ${out}
IF ${result} == ${FALSE} RETURN ${TRUE}
END
RETURN ${FALSE}
2025-03-14 09:59:58 +01:00
# TODO: incorporate LED checks into RTE OSFV lib
Power Off Ex
Rte Power Off
IF '${CHECK_POWER_LED_SUPPORT}' == '${TRUE}'
FOR ${i} IN RANGE 20
${out}= Rte Check Power Led
IF '${out}' == 'low' RETURN
Sleep 0.5s
END
IF '${out}' != 'high'
FAIL Power LED didn't light up! Setup needs manual verification,
... or Power State After Power Failure is set incorrectly.
END
END
Power On Ex
Rte Power On
IF '${CHECK_POWER_LED_SUPPORT}' == '${TRUE}'
FOR ${i} IN RANGE 10
${out}= Rte Check Power Led
IF '${out}' == 'high' RETURN
Sleep 0.5s
END
IF '${out}' != 'high'
FAIL Power LED didn't light up! Setup needs manual verification,
... or Power State After Power Failure is set incorrectly.
END
2025-03-27 18:31:30 +01:00
END
2025-03-24 19:26:37 +01:00
Run Ansible Playbooks
[Documentation] Runs all supported Ansible plabooks from os-config/ansible
... according to ${TESTED_LINUX_DISTROS}
2025-03-27 17:34:24 +01:00
2025-03-24 19:26:37 +01:00
IF not ${USE_ANSIBLE}
Log To Console USE_ANSIBLE is set to ${USE_ANSIBLE}, skipping ansible setup.
RETURN
END
FOR ${distro_id} IN @{TESTED_LINUX_DISTROS}
Log To Console "Ansible setup for ENV_ID ${distro_id}"
Power On
Boot System Or From Connected Disk ${distro_id}
# ansible will fail no matter the timeouts if host is unreachable
# (not booted yet)
2025-08-06 08:30:21 +02:00
VAR ${DUT_CONNECTION_METHOD}= SSH scope=GLOBAL
2025-03-24 19:26:37 +01:00
Login To Linux
2025-04-10 11:50:30 +02:00
Check Internet Connection On Linux
2025-03-24 19:26:37 +01:00
# Create temporary inventory file for given platform and OS
2025-07-25 15:29:43 +02:00
VAR ${inventory_file}=
... [host] \n
2025-03-24 19:26:37 +01:00
... ${DEVICE_IP} ansible_user=${DEVICE_OS_USERNAME}
... ansible_ssh_pass=${DEVICE_OS_PASSWORD} ansible_sudo_pass=${DEVICE_OS_PASSWORD}
2025-03-26 09:50:24 +01:00
... ansible_ssh_common_args='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
2025-07-25 15:29:43 +02:00
... separator=${SPACE}
2025-03-24 19:26:37 +01:00
${tmp_file_rand}= Generate Random String length=16
2025-07-25 15:29:43 +02:00
VAR ${tmp_inventory_filename}= ansible_inventory_${tmp_file_rand}.yaml
2025-03-24 19:26:37 +01:00
Create File ${tmp_inventory_filename} ${inventory_file}
# Prepare and run ansible-playbook command
2025-07-25 15:29:43 +02:00
VAR ${ansible_cmd}=
... ansible-playbook
2025-03-24 19:26:37 +01:00
... os-config/ansible/linux-packages-playbook.yaml
... -i ${tmp_inventory_filename}
2025-03-26 17:27:45 +01:00
... --extra-vars "os_id=${distro_id}"
2025-03-24 19:26:37 +01:00
... --timeout 300
2025-07-25 15:29:43 +02:00
... separator=${SPACE}
2025-03-24 19:26:37 +01:00
${rc} ${out}= Run And Return Rc And Output ${ansible_cmd}
Log To Console ${out}
# Cleanup
2025-08-06 08:30:21 +02:00
Restore Initial DUT Connection Method
2025-03-24 19:26:37 +01:00
Remove File ${tmp_inventory_filename}
Should Be Equal As Integers ${rc} 0
2025-03-14 09:59:58 +01:00
END