Skip to content

tests/{install_startup,aem_hw}.pm: update for legacy Dasharo systems #15

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 10 commits into
base: 3mdeb-lab
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 3mdeb-templates.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"JobGroups": [
{
"template": "defaults:\n x86_64:\n machine: qemu\n priority: 70\nproducts:\n qubesos-4.2.3-install-iso-x86_64:\n distri: qubesos\n flavor: install-iso\n version: '4.2.3'\n qubesos-4.2.3-install-iso-iommu-x86_64:\n distri: qubesos\n flavor: install-iso-iommu\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hw-x86_64:\n distri: qubesos\n flavor: install-iso-hw\n version: '4.2.3'\n qubesos-4.2.3-install-iso-optiplex-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-optiplex-uefi\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v1-legacy-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v1-legacy\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v1-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v1-uefi\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v2-legacy-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v2-legacy\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v2-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v2-uefi\n version: '4.2.3'\n qubesos-4.2.3-install-iso-vp4670-legacy-x86_64:\n distri: qubesos\n flavor: install-iso-vp4670-legacy\n version: '4.2.3'\n qubesos-4.2.3-install-iso-vp4670-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-vp4670-uefi\n version: '4.2.3'\nscenarios:\n x86_64:\n qubesos-4.2.3-install-iso-vp4670-uefi-x86_64:\n - installation:\n machine: vp4670\n #- aem-setup:\n # machine: vp4650\n #- aem-first-run:\n # machine: vp4650\n #- aem-second-run:\n # machine: vp4650\n qubesos-4.2.3-install-iso-hpt630v1-legacy-x86_64:\n - installation:\n machine: hpt630v1\n - aem-setup:\n machine: hpt630v1\n - aem-first-run:\n machine: hpt630v1\n - aem-second-run:\n machine: hpt630v1\n qubesos-4.2.3-install-iso-hpt630v1-uefi-x86_64:\n - installation:\n machine: hpt630v1\n - aem-setup:\n machine: hpt630v1\n - aem-first-run:\n machine: hpt630v1\n - aem-second-run:\n machine: hpt630v1\n qubesos-4.2.3-install-iso-hpt630v2-legacy-x86_64:\n - installation:\n machine: hpt630v2\n - aem-setup:\n machine: hpt630v2\n - aem-first-run:\n machine: hpt630v2\n - aem-second-run:\n machine: hpt630v2\n qubesos-4.2.3-install-iso-hpt630v2-uefi-x86_64:\n - installation:\n machine: hpt630v2\n - aem-setup:\n machine: hpt630v2\n - aem-first-run:\n machine: hpt630v2\n - aem-second-run:\n machine: hpt630v2\n qubesos-4.2.3-install-iso-optiplex-uefi-x86_64:\n - installation:\n machine: optiplex\n - aem-setup:\n machine: optiplex\n - aem-first-run:\n machine: optiplex\n - aem-second-run:\n machine: optiplex\n",
"template": "defaults:\n x86_64:\n machine: qemu\n priority: 70\nproducts:\n qubesos-4.2.3-install-iso-x86_64:\n distri: qubesos\n flavor: install-iso\n version: '4.2.3'\n qubesos-4.2.3-install-iso-iommu-x86_64:\n distri: qubesos\n flavor: install-iso-iommu\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hw-x86_64:\n distri: qubesos\n flavor: install-iso-hw\n version: '4.2.3'\n qubesos-4.2.3-install-iso-optiplex-legacy-x86_64:\n distri: qubesos\n flavor: install-iso-optiplex-legacy\n version: '4.2.3'\n qubesos-4.2.3-install-iso-optiplex-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-optiplex-uefi\n version: '4.2.3'\n qubesos-4.2.3-install-iso-vp4670-legacy-x86_64:\n distri: qubesos\n flavor: install-iso-vp4670-legacy\n version: '4.2.3'\n qubesos-4.2.3-install-iso-vp4670-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-vp4670-uefi\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v1-legacy-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v1-legacy\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v1-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v1-uefi\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v2-legacy-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v2-legacy\n version: '4.2.3'\n qubesos-4.2.3-install-iso-hpt630v2-uefi-x86_64:\n distri: qubesos\n flavor: install-iso-hpt630v2-uefi\n version: '4.2.3'\nscenarios:\n x86_64:\n qubesos-4.2.3-install-iso-optiplex-legacy-x86_64:\n - installation:\n machine: optiplex\n - aem-setup:\n machine: optiplex\n - aem-first-run:\n machine: optiplex\n - aem-second-run:\n machine: optiplex\n qubesos-4.2.3-install-iso-optiplex-uefi-x86_64:\n - installation:\n machine: optiplex\n - aem-setup:\n machine: optiplex\n - aem-first-run:\n machine: optiplex\n - aem-second-run:\n machine: optiplex\n qubesos-4.2.3-install-iso-vp4670-legacy-x86_64:\n - installation:\n machine: vp4670\n - aem-setup:\n machine: vp4670\n - aem-first-run:\n machine: vp4670\n - aem-second-run:\n machine: vp4670\n qubesos-4.2.3-install-iso-vp4670-uefi-x86_64:\n - installation:\n machine: vp4670\n - aem-setup:\n machine: vp4670\n - aem-first-run:\n machine: vp4670\n - aem-second-run:\n machine: vp4670\n qubesos-4.2.3-install-iso-hpt630v1-legacy-x86_64:\n - installation:\n machine: hpt630v1\n - aem-setup:\n machine: hpt630v1\n - aem-first-run:\n machine: hpt630v1\n - aem-second-run:\n machine: hpt630v1\n qubesos-4.2.3-install-iso-hpt630v1-uefi-x86_64:\n - installation:\n machine: hpt630v1\n - aem-setup:\n machine: hpt630v1\n - aem-first-run:\n machine: hpt630v1\n - aem-second-run:\n machine: hpt630v1\n qubesos-4.2.3-install-iso-hpt630v2-legacy-x86_64:\n - installation:\n machine: hpt630v2\n - aem-setup:\n machine: hpt630v2\n - aem-first-run:\n machine: hpt630v2\n - aem-second-run:\n machine: hpt630v2\n qubesos-4.2.3-install-iso-hpt630v2-uefi-x86_64:\n - installation:\n machine: hpt630v2\n - aem-setup:\n machine: hpt630v2\n - aem-first-run:\n machine: hpt630v2\n - aem-second-run:\n machine: hpt630v2\n",
"group_name": "Qubes"
}
],
Expand Down
15 changes: 15 additions & 0 deletions needles/aem_hw-bootloader-20250404.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 8,
"ypos": 62,
"width": 226,
"height": 34,
"type": "match"
}
],
"properties": [],
"tags": [
"bootloader"
]
}
Binary file added needles/aem_hw-bootloader-20250404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions needles/aem_hw-bootloader-20250423.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 12,
"ypos": 148,
"width": 358,
"height": 67,
"type": "match"
}
],
"properties": [],
"tags": [
"bootloader"
]
}
Binary file added needles/aem_hw-bootloader-20250423.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions needles/aem_hw-bootloader_with_aem-20250404.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 5,
"ypos": 50,
"width": 227,
"height": 79,
"type": "match"
}
],
"properties": [],
"tags": [
"bootloader"
]
}
Binary file added needles/aem_hw-bootloader_with_aem-20250404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions needles/aem_hw-dasharo_tpm12_clear_enable_activate-20250408.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 211,
"ypos": 279,
"width": 429,
"height": 38,
"type": "match"
}
],
"properties": [],
"tags": [
"dasharo_tpm12_clear_enable_activate"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions needles/aem_hw-dasharo_tpm2_confirm_clear-20250313.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"area": [
{
"xpos": 188,
"ypos": 253,
"width": 426,
"height": 71,
"xpos": 192,
"ypos": 263,
"width": 207,
"height": 34,
"type": "match"
}
],
"properties": [],
"tags": [
"dasharo_tpm2_confirm_clear"
]
}
}
15 changes: 15 additions & 0 deletions needles/aem_hw-dasharo_tpm2_confirm_clear-20250408.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 193,
"ypos": 319,
"width": 383,
"height": 35,
"type": "match"
}
],
"properties": [],
"tags": [
"dasharo_tpm2_confirm_clear"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions needles/install_startup-bootloader-installer-20250403.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 7,
"ypos": 49,
"width": 146,
"height": 80,
"type": "match"
}
],
"properties": [],
"tags": [
"bootloader-installer"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions needles/install_startup-bootloader-installer-20250409.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"area": [
{
"xpos": 14,
"ypos": 147,
"width": 303,
"height": 94,
"type": "match"
}
],
"properties": [],
"tags": [
"bootloader-installer"
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 29 additions & 21 deletions tests/aem_hw.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ if (check_var('MACHINE', 'optiplex') or check_var('MACHINE', 'vp4670')) {
}

my $bios_kind;
if (check_var('MACHINE', 'optiplex') and check_var('OS_INSTALL_LEGACY', '1')) {
if ((check_var('MACHINE', 'optiplex') and check_var('OS_INSTALL_LEGACY', '1')) or
(check_var('MACHINE', 'vp4670') and check_var('OS_INSTALL_LEGACY', '1'))) {
$bios_kind = 'seabios';
} elsif (check_var('MACHINE', 'supermicro')) {
$bios_kind = 'aptio';
Expand Down Expand Up @@ -222,18 +223,31 @@ sub clear_tpm_seabios {
send_key 'esc';

# enter TPM menu
assert_serial 'Select boot device:';
assert_serial 't. TPM Configuration';
send_key 't';

my $owned = assert_serial qr/Ownership has( not)? been taken/, 5;
if (!defined $owned) {
die "Failed to check TPM ownership status in TPM menu of SeaBIOS.";
} elsif ($owned =~ 'Ownership has not been taken') {
# exit TPM menu
my $menu = wait_serial qr/reboot the machine./, 5;

# SeaBIOS spews ANSI Cursor Position code every second, after repeating the
# previously printed character. It so happens that it is often inserted in
# 'Clear ownership' line, which breaks parsing. Remove that one repeated
# character and control sequence to reliably match the line.
$menu =~ s/.\e\[\d+;\d+H//g;

if (!($menu =~ qr/Ownership has( not)? been taken/)) {
# TPM 2.0
send_key '1';
# poor UX, selecting the option loops back to menu with no feedback
send_key 'esc';
} elsif ($menu =~ 'Ownership has not been taken') {
# TPM 1.2 with ownership not taken, exit TPM menu
send_key 'esc';
} else {
# reset the TPM, to allow taking ownership
assert_serial 'c. Clear ownership';
# TPM 1.2 with ownership taken, reset the TPM to allow taking ownership
if (!($menu =~ qr/c. Clear ownership/)) {
# Simulate assert_serial output
die "Failed to match serial output against regexp /c. Clear ownership/";
}
send_key 'c';
assert_serial 'e. Enable the TPM';
send_key 'e';
Expand Down Expand Up @@ -416,16 +430,14 @@ sub clear_tpm_dasharo {
send_key 'down';
sleep 1;
save_screenshot;
# Dasharo BUG: https://github.com/Dasharo/dasharo-issues/issues/1091
send_key 'ret'; # returns directly back to device manager
sleep 1;
send_key 'ret';
assert_screen 'dasharo_tpm12_clear_enable_activate';
} else {
save_screenshot;
send_key 'ret';
assert_screen 'dasharo_tpm2_clearcontrol';
# TODO: move this outside of conditional after Dasharo BUG is fixed
send_key('esc', wait_screen_change => 1); # go back to device manager
}
send_key('esc', wait_screen_change => 1); # go back to device manager

# save, return to main menu and reboot
send_key('f10', wait_screen_change => 1);
Expand All @@ -434,13 +446,9 @@ sub clear_tpm_dasharo {
send_key('pgdn', wait_screen_change => 1);
send_key('ret', wait_screen_change => 1);

# TODO: TPM1.2 should take the same path after Dasharo BUG is fixed
# TPM2 only - last match changed for TPM2, but not TPM1.2, so it can be used
if (not match_has_tag('dasharo_tpm12_operation')) {
# confirm request to clear TPM
assert_screen 'dasharo_tpm2_confirm_clear';
send_key('f12');
}
# confirm request to clear TPM
assert_screen 'dasharo_tpm2_confirm_clear';
send_key('f12');
}

sub setup_acm {
Expand Down
51 changes: 45 additions & 6 deletions tests/install_startup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ sub run {
}
} elsif (check_var('HEADS', '1')) {
heads_boot_usb;
} elsif (check_var('MACHINE', 'optiplex') and check_var('OS_INSTALL_LEGACY', '1')) {
ipxe_boot('dasharo');
} elsif ((check_var('MACHINE', 'optiplex') and check_var('OS_INSTALL_LEGACY', '1')) or
(check_var('MACHINE', 'vp4670') and check_var('OS_INSTALL_LEGACY', '1'))) {
seabios_boot();
#ipxe_boot('dasharo');
} elsif (check_var('MACHINE', 'vp4670') or check_var('MACHINE', 'optiplex')) {
my $ks_url = prepare_kickstart_config();
my $params = "inst.sshd inst.ks=$ks_url";
Expand All @@ -112,7 +114,7 @@ sub run {
send_key_until_needlematch('dasharo_pikvm_bootdev', 'down');
send_key 'ret';

assert_screen 'bootloader';
assert_screen 'bootloader-installer';
grub_boot_with_kernel_parameters($params);
} elsif (check_var('MACHINE', 'supermicro')) {
# FIXME: use per-worker URLs, don't pollute global ones
Expand Down Expand Up @@ -271,7 +273,8 @@ sub run {
select_console('installation', await_console=>0);
}

if (check_var("MACHINE", "hw7") or check_var("MACHINE", "hw12")) {
if (check_var("MACHINE", "hw7") or check_var("MACHINE", "hw12") or
check_var("MACHINE", "optiplex") or check_var("MACHINE", "vp4670")) {
select_root_console();
# RTC battery not connected
script_run("date -s @" . time());
Expand All @@ -287,17 +290,53 @@ sub grub_boot_with_kernel_parameters {
send_key 'up';
# start editing it
send_key 'e';
# menu redraws with serial output take too long, some key presses get lost
# consider building Dasharo without serial redirection after SeaBIOS
sleep 1;
# go to the line with kernel parameters
send_key 'down';
sleep 1;
send_key 'down';
sleep 1;
send_key 'down';
sleep 1;
send_key 'end';
# append them
type_string " $parameters";
sleep 1;
# append them, somewhat slowly
type_string(" $parameters", max_interval => 150);
# boot
send_key 'f10';
}

sub seabios_boot {
assert_serial qr/Press ESC for boot menu./, 30;
send_key 'esc';

my $menu = wait_serial qr/TPM Configuration/, 5;
# SeaBIOS prints ANSI escape code every second (RTC interrupt), log the
# output for easier debugging if it happens while the menu is being printed
diag("SeaBIOS boot menu:\n" . $menu);
$menu =~ /(.)\. USB MSC Drive/;
if (!defined($1)) {
die "No USB MSC Drive detected";
}

diag("Booting entry " . $1);
send_key $1;

my $ks_url = prepare_kickstart_config();
my $params = "inst.sshd inst.ks=$ks_url";

# VP4670 has multiple network controllers, only use the first one
if (check_var('MACHINE', 'vp4670')) {
my $device_ip = get_var('QUBES_OS_HOST_IP');
$params .= " ip=${device_ip}::192.168.10.1:255.255.255.0::enp1s0 bootdev=enp1s0";
}

assert_screen 'bootloader-installer';
grub_boot_with_kernel_parameters($params);
}

sub ipxe_boot {
# Values:
# * dasharo:
Expand Down