Dasharo / open-source-firmware-validation

OSFV infrastructure with automated tests and scripts for managing test results
Apache License 2.0
9 stars 2 forks source link

Open Source Firmware Remote Test Environment

Warning

!!! WARNING !!! This repository is in the process of migration and multiple major reworks. If you do not know what you are doing, consider not using it until at least v0.5.0 is released. When this is scheduled, link to such a milestone will appear here. !!! WARNING !!!

regression-architecture

The following repository contains set of tests and other features to conduct Dasharo firmware validation procedures.

Test environment overview

Dasharo OSFV consists of following modules:

In addition, keep in mind that due to the approach to generating release files, for the raptor-CS talos2 platform dedicated mechanism for testing environment and running tests have been implemented.

Supported platforms

Manufacturer Platform Firmware $CONFIG
NovaCustom NV41MZ Dasharo novacustom-nv41mz
NovaCustom NV41MB Dasharo novacustom-nv41mb
NovaCustom NS50MU Dasharo novacustom-ns50mu
NovaCustom NS70MU Dasharo movacustom-ns70mu
NovaCustom NV41PZ Dasharo novacustom-nv41pz
NovaCustom NS50PU Dasharo novacustom-ns50pu
NovaCustom NS70PU Dasharo novacustom-ns70pu
MSI PRO Z690 A WIFI DDR4 Dasharo msi-pro-z690-a-wifi-ddr4
MSI PRO Z690 A DDR5 Dasharo msi-pro-z690-a-ddr5
Protectli V1210 Dasharo protectli-v1210
Protectli V1410 Dasharo protectli-v1410
Protectli V1610 Dasharo protectli-v1610
Protectli VP2410 Dasharo protectli-vp2410
Protectli VP2420 Dasharo protectli-vp2420
Protectli VP4630 Dasharo protectli-vp4630
Protectli VP4650 Dasharo protectli-vp4650
Protectli VP4670 Dasharo protectli-vp4670
Raptor-CS TalosII Dasharo raptor-cs_talos2
Raspberry Pi RaspberryPi 3B Yocto rpi-3b
QEMU Q35 Dasharo (UEFI) qemu

Getting started

Initializing environment

git clone https://github.com/Dasharo/open-source-firmware-validation
cd open-source-firmware-validation
git submodule update --init --checkout
python3 -m virtualenv venv
source venv/bin/activate
pip install -U -r requirements-openbmc.txt
pip install -r requirements.txt
source venv/bin/activate

NOTE: keywords.robot requires osfv_cli to be installed on the host system. Go through these steps to configure the scripts

Running tests

When running tests on Dasharo platforms use the following commands:

robot -L TRACE -v rte_ip:$RTE_IP -v config:$CONFIG -v device_ip:$DEVICE_IP \
-t $TEST_CASE_ID $TEST_MODULE/$TEST_SUITE
robot -L TRACE -v rte_ip:$RTE_IP -v config:$CONFIG -v device_ip:$DEVICE_IP \
$TEST_MODULE/$TEST_SUITE
robot -L TRACE -v rte_ip:$RTE_IP -v config:$CONFIG -v device_ip:$DEVICE_IP \
$TEST_MODULE

Parameters should be defined as follows:

You can also run tests with -v snipeit:no in order to skip checking whether the platform is available on snipeit. By default, this is enabled.

When running tests on Talos2 platform use the following commands:

WARNING The support state of this platform in the main branch may vary. We should have a single documentation for all platforms. This effort is tracked in this issue.

robot -L TRACE -v device_ip:$DEVICE_IP -v config:raptor-cs_talos2 -v fw_file:$FW_FILE \
-v bootblock_file:$BOOTBLOCK_FILE -v zImage_file:$ZIMAGE_FILE -v pnor_file:$PNOR_FILE \
-t $TEST_CASE_ID $TEST_MODULE/$TEST_SUITE
robot -L TRACE -v device_ip:$DEVICE_IP -v config:raptor-cs_talos2 -v fw_file:$FW_FILE \
-v bootblock_file:$BOOTBLOCK_FILE -v zImage_file:$ZIMAGE_FILE -v pnor_file:$PNOR_FILE \
$TEST_MODULE/$TEST_SUITE
robot -L TRACE -v device_ip:$DEVICE_IP -v config:raptor-cs_talos2 -v fw_file:$FW_FILE \
-v bootblock_file:$BOOTBLOCK_FILE -v zImage_file:$ZIMAGE_FILE -v pnor_file:$PNOR_FILE \
./$TEST_MODULE

Parameters should be defined as follows:

You can also run tests with -v snipeit:no in order to skip checking whether the platform is available on snipeit.

QEMU workflow

Make sure to proceed with Getting started section first.

Many of the test and keywords can be tested in emulation environment. This can greatly increase the development speed:

Booting

Following script assume that you have OVMF_CODE.fd and OVMF_VARS.fd in you current working directory. If those binaries will not be found script will download latest release of Dasharo (UEFI) for QEMU Q35.

If you want to use script in development workflow, most likely you have already built Dasharo (UEFI) for QEMU Q35 according to this instruction. In that case you would like to provide directory with Dasharo (UEFI) binaries as environment variable (DIR).

You may also decide to not use graphics user interface for QEMU. In that case choose mode nographic. If you run QEMU on a remote machine you may consider to use mode vnc with default port for graphical output being 5900.

Dasharo (UEFI) in QEMU can be started with:

./scripts/ci/qemu-run.sh graphic firmware

In this mode, a graphical QEMU window would popup, so you can observe the test flow, or control it manually. The actual testing will happen over serial, which is exposed via telnet. For more modes and options, please refer to the script's help text.

You may also build customized Dasharo firmware for QEMU (e.g. with some Dasharo options enabled or disabled). In such a case, please refer to:

Refer to the latest releases to see which test have been proven to work on QEMU so far.

You may also refer to the ./scripts/ci/qemu-self-test.sh, where we aim to keep testing common keywords, to ensure of their correct operation.

Contributing

pre-commit install

Guidelines

A list of guidelines we shall follow during transition to improve the quality of this repository. We start with getting rid of duplicated keywords, reducing the size of keywords.robot file, and improving their overall quality.

There are other areas of interest that we will look into in the next steps and add as guidelines:

Pre-commit and CI checks

  1. Make sure to use pre-commit locally. All pre-commit and other CI checks must pass of course, prior requesting for review. Please check the status of checks in your PR. If the failure is questionable, provide your arguments for that, rather than silently ignoring this fact.

Code style

  1. It is automatically handled by robotidy. The current rules can be found here.

Keywords

  1. No new keywords in keywords.robot will be accepted
    • new keywords must be placed in a logically divided modules, under lib/ directory
    • see openbmc-test-automation as a reference
    • if you need to modify something in keywords.robot, you should create a new module under lib/
    • if you add new keyword module, you should review the keywords.module and move related keywords there as well, if suitable
  2. If keyword from keywords.robot can be reused or improved, do that instead of creating a new one
    • keyword duplication will not be accepted,
    • you will be asked to use/improve existing keywords instead.
  3. You are encouraged to use Python for more sophisticaed or complex keywords (e.g. more convoluted data parsing and processing). We are not forced to use RF for all keywords. Especially when it is simply easier to use Python.
  4. For reading from terminal (no matter if it is Telnet, or SSH), following keywords must be used:
    • Read From Terminal Until Prompt
    • Read From Terminal Until
    • Read From Terminal Usage of other keywords is prohibited. Whenever you modify a test/keyword, you should rework it to use one of the above.
  5. For writing into terminal, following keywords must be used:
    • Execute Command In Terminal
    • Write Into Terminal
    • Write Bare Into Terminal Usage of other keywords is prohibited. Whenever you modify a test/keyword, you should rework it to use one of the above. You should use Execute Command In Terminal unless you have a very good reason not to. Thanks to that, your keyword will not leave floating output in buffer to be received by another keywords, not expecting that.

Documentation

Useful refactoring tools