From 43e008cf996e7b3903b4a01ef8f0c0355a31a97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Thu, 24 Sep 2026 02:33:01 -0300 Subject: [PATCH] test(mknb): cover the BIOS Genesis BOOTIF format Check both paths that write the script: mknb --configfileonly on an installed Genesis, and a full mknb run from an x86_64 OpenEmbedded export. --- xCAT-test/unit/mknb_exported_genesis.t | 28 ++++++++++++++++++++++++++ xCAT-test/unit/mknb_xcatd_address.t | 14 +++++++++++++ 2 files changed, 42 insertions(+) diff --git a/xCAT-test/unit/mknb_exported_genesis.t b/xCAT-test/unit/mknb_exported_genesis.t index 5f523a9bf..3fd26df00 100644 --- a/xCAT-test/unit/mknb_exported_genesis.t +++ b/xCAT-test/unit/mknb_exported_genesis.t @@ -553,4 +553,32 @@ my $unsafe = xCAT_plugin::mknb::_select_genesis_source( ); is($unsafe, undef, 'unsupported architecture names cannot escape the image root'); +$::XCATROOT = "$tmpdir/openembedded-x86_64-xcatroot"; +prepare_export( + "$::XCATROOT/share/xcat/netboot/genesis-openembedded/x86_64", + 'openembedded x86_64 kernel', + 'openembedded x86_64 initramfs', + 'x86_64', +); +$xCAT::TableUtils::tftpdir = "$tmpdir/openembedded-x86_64-tftpboot"; +@responses = (); +xCAT_plugin::mknb::process_request( + { arg => ['x86_64'] }, + sub { push(@responses, @_); }, +); +ok( + !grep({ ref($_) eq 'HASH' && $_->{error} } @responses), + 'mknb installs an x86_64 OpenEmbedded export', +); +is( + read_file("$xCAT::TableUtils::tftpdir/xcat/genesis.kernel.x86_64"), + 'openembedded x86_64 kernel', + 'mknb publishes the OpenEmbedded x86_64 kernel', +); +like( + read_file("$xCAT::TableUtils::tftpdir/xcat/xnba/nets/192.0.2.0_24"), + qr{^imgfetch -n kernel \S+/xcat/genesis\.kernel\.x86_64 .* BOOTIF=01-\$\{netX/mac:hexhyp\}$}m, + 'the OpenEmbedded BIOS Genesis script takes BOOTIF from mac:hexhyp', +); + done_testing(); diff --git a/xCAT-test/unit/mknb_xcatd_address.t b/xCAT-test/unit/mknb_xcatd_address.t index 0a69dd2e0..281a1af8a 100644 --- a/xCAT-test/unit/mknb_xcatd_address.t +++ b/xCAT-test/unit/mknb_xcatd_address.t @@ -232,6 +232,20 @@ foreach my $relative_path ( ); } +my $bios_genesis = read_config( + "$xCAT::TableUtils::tftpdir/xcat/xnba/nets/192.168.144.0_20" +); +like( + $bios_genesis, + qr{^imgfetch -n kernel \S+/xcat/genesis\.kernel\.x86_64 .* BOOTIF=01-\$\{netX/mac:hexhyp\}$}m, + 'the BIOS Genesis script takes BOOTIF from mac:hexhyp', +); +unlike( + $bios_genesis, + qr/machyp/, + 'the BIOS Genesis script does not use the xNBA-only machyp setting', +); + use_reporter_address_maps(); prepare_tftpdir($tmpdir, 'tftpboot-x86-legacy', 'x86_64', 'legacy'); $responses = run_mknb('x86_64');