Skip to content

Add functionality for running tests on a remote machine #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: seabios-support
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/qemu-self-test-seabios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Start QEMU in background
run: |
./scripts/ci/qemu-run.sh nographic seabios &
./scripts/ci/qemu-run.sh nographic none seabios &

- name: Set up Python
uses: actions/setup-python@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qemu-self-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Start QEMU in background
run: |
./scripts/ci/qemu-run.sh nographic uefi &
./scripts/ci/qemu-run.sh nographic none uefi &

- name: Set up Python
uses: actions/setup-python@v2
Expand Down
22 changes: 22 additions & 0 deletions docs/qemu.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,25 @@ robot -b command_log.txt -v snipeit:no -L TRACE -v config:qemu -v rte_ip:127.0.0
> Note: You do not have to reserve QEMU via `snipeit` therefore `-v snipeit:no`
> is being used. Use QEMU config `-v config:qemu`, and, as a RTE IP, use
> `127.0.0.1`. Test suite `dts/dts-tests.robot` is shown here as an example.

## Running tests on a remote machine

This method is useful when you don't want to run QEMU on your local machine due
to security reasons or lack of memory. The assumption here is that you are
primarily using this method while developing tests.

The first step is to continuously sync a local folder, which is this
repository, to a remote machine at `/tmp/osfv` and run QEMU according to the
parameters there.

For example:

```sh
./scripts/ci/remote-runner.sh [email protected] . nographic seabios
```

Then, you can run tests in the following way:

```sh
ssh -t [email protected] 'cd /tmp/osfv && source venv/bin/activate && ./scripts/ci/qemu-self-test-seabios.sh'
```
59 changes: 58 additions & 1 deletion lib/bios/common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Enter Setup Menu
Write Bare Into Terminal ${SETUP_MENU_KEY}
IF '${BIOS_LIB}' == 'seabios'
${menu}= Get Boot Menu Construction
Enter Menu From Snapshot ${menu} \[setup\]
Enter Submenu From Snapshot ${menu} setup
END
END

Expand Down Expand Up @@ -167,3 +167,60 @@ Boot System Or From Connected Disk # robocop: disable=too-long-keyword
${system_index}= Get Index Of Matching Option In Menu ${menu_construction} ${system_name}
END
Select Boot Menu Option ${system_index} ${ARROW_DOWN}

Make Sure That Network Boot Is Enabled
[Documentation] This keywords checks that "Enable network boot" in
... "Networking Options" is enabled when present, so the network
... boot tests can be executed.
IF not ${DASHARO_NETWORKING_MENU_SUPPORT} RETURN
IF '${BIOS_LIB}' == 'seabios'
Power On
Enable Network/PXE Boot
ELSE
Set UEFI Option NetworkBoot ${TRUE}
END

Get IPXE Boot Menu Construction
[Documentation] Keyword allows to get and return iPXE menu construction.
[Arguments] ${lines_top}=1 ${lines_bot}=0 ${checkpoint}=${IPXE_CHECKPOINT}
${menu}= Read From Terminal Until ${checkpoint}
${construction}= Parse Menu Snapshot Into Construction ${menu} ${lines_top} ${lines_bot}
RETURN ${construction}

Press Key N Times And Enter
[Documentation] Enter specified in the first argument times the specified
... in the second argument key and then press Enter.
[Arguments] ${n} ${key}
Press Key N Times ${n} ${key}
Press Enter

Press Key N Times
[Documentation] Enter specified in the first argument times the specified
... in the second argument key.
[Arguments] ${n} ${key}
FOR ${index} IN RANGE 0 ${n}
IF '${DUT_CONNECTION_METHOD}' == 'pikvm'
Single Key PiKVM ${key}
# Key press time as defined in PiKVM library is 200ms. We need some
# additional delay to make sure we can gather all input from terminal after
# key press.
Sleep 2s
ELSE
Write Bare Into Terminal ${key}
# Escape sequences in EDK2 have 2 seconds to complete on serial.
# After 2 seconds if it is not completed, it is returned as a
# keystroke. So we need at least 2 seconds interval for pressing
# ESC for example.
Sleep 2s
END
END

Press Enter
# Before entering new menu, make sure we get rid of all leftovers
Sleep 1s
Read From Terminal
IF '${DUT_CONNECTION_METHOD}' == 'pikvm'
Single Key PiKVM Enter
ELSE
Press Key N Times 1 ${ENTER}
END
52 changes: 0 additions & 52 deletions lib/bios/edk2.robot
Original file line number Diff line number Diff line change
Expand Up @@ -140,44 +140,6 @@ Enter Dasharo Submenu
... opt_only=${TRUE}
RETURN ${submenu}

Press Key N Times And Enter
[Documentation] Enter specified in the first argument times the specified
... in the second argument key and then press Enter.
[Arguments] ${n} ${key}
Press Key N Times ${n} ${key}
Press Enter

Press Enter
# Before entering new menu, make sure we get rid of all leftovers
Sleep 1s
Read From Terminal
IF '${DUT_CONNECTION_METHOD}' == 'pikvm'
Single Key PiKVM Enter
ELSE
Press Key N Times 1 ${ENTER}
END

Press Key N Times
[Documentation] Enter specified in the first argument times the specified
... in the second argument key.
[Arguments] ${n} ${key}
FOR ${index} IN RANGE 0 ${n}
IF '${DUT_CONNECTION_METHOD}' == 'pikvm'
Single Key PiKVM ${key}
# Key press time as defined in PiKVM library is 200ms. We need some
# additional delay to make sure we can gather all input from terminal after
# key press.
Sleep 2s
ELSE
Write Bare Into Terminal ${key}
# Escape sequences in EDK2 have 2 seconds to complete on serial.
# After 2 seconds if it is not completed, it is returned as a
# keystroke. So we need at least 2 seconds interval for pressing
# ESC for example.
Sleep 2s
END
END

Get Option State
[Documentation] Gets menu construction and option name as arguments.
... Returns option state, which can be: True, False, or numeric value.
Expand Down Expand Up @@ -291,13 +253,6 @@ Try To Insert Non-numeric Values Into Numeric Option
Fail Wrong option type (not accept numeric value)
END

Get IPXE Boot Menu Construction
[Documentation] Keyword allows to get and return iPXE menu construction.
[Arguments] ${lines_top}=1 ${lines_bot}=0 ${checkpoint}=${EDK2_IPXE_CHECKPOINT}
${menu}= Read From Terminal Until ${checkpoint}
${construction}= Parse Menu Snapshot Into Construction ${menu} ${lines_top} ${lines_bot}
RETURN ${construction}

############################################################################
### Below keywords still must be reviewed and reworked. We should reuse the
### keywords from above, and remove as much as possible the ones below.
Expand Down Expand Up @@ -481,13 +436,6 @@ Save Changes And Reset
Save Changes
Tianocore Reset System

Make Sure That Network Boot Is Enabled
[Documentation] This keywords checks that "Enable network boot" in
... "Networking Options" is enabled when present, so the network
... boot tests can be executed.
IF not ${DASHARO_NETWORKING_MENU_SUPPORT} RETURN
Set UEFI Option NetworkBoot ${TRUE}

Get Firmware Version From Tianocore Setup Menu
[Documentation] Keyword allows to read firmware version from Tianocore
... Setup menu header.
Expand Down
18 changes: 12 additions & 6 deletions lib/bios/seabios.robot
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Set Option State
[Arguments] ${menu} ${option} ${target_state}
${current_state}= Get Option State ${menu} ${option}
IF '${current_state}' != '${target_state}'
${menu}= Enter Menu From Snapshot ${menu} ${option}
${menu}= Enter Submenu From Snapshot ${menu} ${option}
RETURN ${TRUE}
ELSE
RETURN ${FALSE}
Expand All @@ -54,11 +54,17 @@ Enter Boot Menu From Snapshot
${key}= Extract Boot Menu Key ${menu} ${option}
Write Bare Into Terminal ${key}

Enter Menu From Snapshot
Enter Submenu From Snapshot
[Documentation] Enter given Menu option and return construction
[Arguments] ${menu} ${option}
${key}= Extract Menu Key ${menu} ${option}
Write Bare Into Terminal ${key}
IF '${menu}[3]' == '${EDK2_IPXE_CHECKPOINT}'
${index}= Get Index Of Matching Option In Menu ${menu} ${option}
Should Not Be Equal As Integers ${index} -1 msg=Option ${option} not found in menu
Press Key N Times And Enter ${index} ${ARROW_DOWN}
ELSE
${key}= Extract Menu Key ${menu} ${option}
Write Bare Into Terminal ${key}
END

Extract Boot Menu Key
[Documentation] Extract boot menu which should be hit to enter given Menu in SeaBIOS
Expand Down Expand Up @@ -103,14 +109,14 @@ Enter TPM Configuration
[Documentation] Enter TPM Configuration with Boot Menu Construction.
Enter Boot Menu
${menu}= Get Boot Menu Construction
Enter Menu From Snapshot ${menu} TPM Configuration
Enter Submenu From Snapshot ${menu} TPM Configuration

Enter IPXE
[Documentation] Enter iPXE with Boot Menu Construction.
Enable Network/PXE Boot
Enter Boot Menu
${menu}= Get Boot Menu Construction
Enter Menu From Snapshot ${menu} iPXE
Enter Submenu From Snapshot ${menu} iPXE

# robocop: disable=unused-argument

Expand Down
3 changes: 3 additions & 0 deletions platform-configs/qemu-selftests-seabios.robot
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ ${DASHARO_PCI_PCIE_MENU_SUPPORT}= ${TRUE}
${DASHARO_MEMORY_MENU_SUPPORT}= ${TRUE}

${BIOS_LIB}= seabios
${IPXE_BOOT_SUPPORT}= ${TRUE}
${IPXE_BOOT_ENTRY}= iPXE
${EDK2_IPXE_CHECKPOINT}= iPXE Shell
Loading
Loading