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

Allow for running tests without RTE #198

Open macpijan opened 10 months ago

macpijan commented 10 months ago

The problem you're addressing (if any)

Currently, it is assumed in the environment, that each setup needs RTE. This is not true anymore. In some cases we already have some workarounds for that (e.g. in QEMU).

Describe the solution you'd like

Some tests can be run with no power control at all (we power up the device manually, the tests are executed over serial or SSH).

Some tests can be run with manual power control.

Where is the value to a user, and who might that user be?

Existing users of OSFV can get rid of workarounds.

New users of OSFV can actually benefit from it more, by running tests themselves. At this moment, it is very demanding on the hardware side, as very few users have RTE, or other equipment.

Describe alternatives you've considered

No response

Additional context

Some more context can be extracted from this discussion: https://github.com/Dasharo/dasharo-issues/issues/468

macpijan commented 10 months ago

Another use-case we faced was testing the TwPM. We did not need RTE here, using it made our setup more complex and testing more time-consuming. We have applied the following diff (on 0d1b25c revision) to disable the power control via RTE, it was assumed the the DUT was powered on with SSH enabled, which can be the case for many end users as well:

diff --git a/dasharo-security/tpm2-commands.robot b/dasharo-security/tpm2-commands.robot
index 031f1d4a533b..aec1c174b82e 100644
--- a/dasharo-security/tpm2-commands.robot
+++ b/dasharo-security/tpm2-commands.robot
@@ -248,8 +248,8 @@ TPM2 Test Setup

 TPM2 Suite Setup
     Prepare Test Suite
-    Power On
-    Boot System Or From Connected Disk    ubuntu
+    #Power On
+    #Boot System Or From Connected Disk    ubuntu
     Login To Linux
     Switch To Root User
     Detect Or Install Package    tpm2-tools
diff --git a/os-config/ubuntu-credentials.robot b/os-config/ubuntu-credentials.robot
index def24c2674fb..4755a9896f2e 100644
--- a/os-config/ubuntu-credentials.robot
+++ b/os-config/ubuntu-credentials.robot
@@ -1,5 +1,5 @@
 *** Variables ***
-${UBUNTU_USERNAME}=         user
+${UBUNTU_USERNAME}=         ubuntu
 ${UBUNTU_PASSWORD}=         ubuntu
-${UBUNTU_USER_PROMPT}=      ubuntu@3mdeb:~$
-${UBUNTU_ROOT_PROMPT}=      root@3mdeb:/home/ubuntu#
+${UBUNTU_USER_PROMPT}=      ubuntu@ubuntu-VP4670:~$
+${UBUNTU_ROOT_PROMPT}=      root@ubuntu-VP4670:/home/ubuntu#
diff --git a/platform-configs/protectli-vp4670.robot b/platform-configs/protectli-vp4670.robot
index 8c33ecd4c1fa..e21cc8bbfb97 100644
--- a/platform-configs/protectli-vp4670.robot
+++ b/platform-configs/protectli-vp4670.robot
@@ -3,7 +3,7 @@ Resource    ../os-config/ubuntu-credentials.robot

 *** Variables ***
-${DUT_CONNECTION_METHOD}=                           Telnet
+${DUT_CONNECTION_METHOD}=                           SSH
 ${PAYLOAD}=                                         tianocore
 ${RTE_S2_N_PORT}=                                   13541
 ${FLASH_SIZE}=                                      ${16*1024*1024}
pietrushnic commented 10 months ago

@macpijan I would love to see this as an option in executing OSFV. This was my request from the beginning of the project. It would be great if this issue would be assigned to some publicly known milestone with deadline.

WiktorG351 commented 7 months ago

I'm thinking a command-line passed variable could be implemented, that allows for running a test without RTE (for example: -v RTE:NONE).

Some keywords that would definitely need to be changed are:

In these something like this would have to be added:

IF  '${RTE}' == 'NONE'
    Run     echo -n "Turn power ON/OFF. Press ENTER once done in order to continue... " && read ignore
    RETURN
END

The serial connection seems to be a lot simpler, it appears that only 1 keyword is relevant here, that being Serial Setup.

All we would have to do is provide the end user a guide on how to connect directly from host to the serial port of the machine they are trying to run the tests on, and how to use ser2net in such a way so that the existing test infrastructure can be reused.

(edit: Then once that is all implemented, it would be worthwhile to prove that it all works by running a simple test on a chosen platform in the lab once with the RTE, then without by being there with the ser2net configured on host and manually controlling the power in order to prove that it all works)

artur-rs commented 7 months ago

@WiktorG351

  1. I'm thinking about the usage of already existing flags (we should try to not introduce more variables whenever we can). What about setting rte_ip to NONE - is it doable? The second idea is to use ${POWER_CTRL} (that can be found in the platform-configs/ files) and set it to manual or something similar.
  2. It's better to use Dialogs standard RF lib to introduce interaction with the user: https://robotframework.org/robotframework/latest/libraries/Dialogs.html
macpijan commented 4 months ago

@BeataZdunczyk This should rather be a separate power control library (manual power control), to be integrated while following approach listed in this issue: https://github.com/Dasharo/open-source-firmware-validation/issues/159

Some keywords that would definitely need to be changed are:

Instead of adding more complexity to existing keywords, we would prefer to provide a few implementations of these keywords, if possible, isolating changes in a separate libraries. See example in the linked issue.

macpijan commented 4 months ago
It's better to use Dialogs standard RF lib to introduce interaction with the user: https://robotframework.org/robotframework/latest/libraries/Dialogs.html

+1 for Dialogs

krystian-hebel commented 2 months ago

Loosely related: issue templates ask for RTE branch and commit in first question, which usually isn't relevant. I believe this may be a leftover from before the repo was renamed.