From f6a67af4730c28d81035225dfdafe564ea46e459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Fri, 25 Sep 2026 15:50:08 -0300 Subject: [PATCH] test(probe): cover the boot loader download match The xNBA loaders, the upstream iPXE loaders with the UEFI shim, the POWER grub2 image and yaboot count as a boot loader download. Genesis files, pxelinux.0, the POWER grub2 configuration and a similar-looking name do not. --- .../unit/probe_utils_boot_loader_download.t | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 xCAT-test/unit/probe_utils_boot_loader_download.t diff --git a/xCAT-test/unit/probe_utils_boot_loader_download.t b/xCAT-test/unit/probe_utils_boot_loader_download.t new file mode 100644 index 000000000..257206f73 --- /dev/null +++ b/xCAT-test/unit/probe_utils_boot_loader_download.t @@ -0,0 +1,36 @@ +#!/usr/bin/env perl +# xcatprobe osdeploy marks the boot loader stage when a node fetches its loader over TFTP. The file +# names below are the ones the TFTP log shows for each loader, and for downloads that are not one. +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/../../perl-xCAT"; +use lib "$FindBin::Bin/../../xCAT-probe/lib/perl"; + +use Test::More; + +require probe_utils; + +my @loaders = ( + 'xcat/xnba.kpxe', + 'xcat/xnba.efi', + 'xcat/ipxe/i386/undionly.kpxe', + 'xcat/ipxe/x86_64-sb/snponly-shim.efi', + 'xcat/ipxe/x86_64-sb/snponly.efi', + '/boot/grub2/powerpc-ieee1275/core.elf', + '/yb/node/yaboot-cn01', +); +ok( probe_utils::boot_loader_download($_), "$_ is a boot loader download" ) for @loaders; + +my @others = ( + 'xcat/genesis.kernel.x86_64', + 'xcat/genesis.fs.x86_64.gz', + 'pxelinux.0', + '/boot/grub2/grub2.ppc', + 'xcat/ipxeboot.kpxe', +); +ok( !probe_utils::boot_loader_download($_), "$_ is not a boot loader download" ) for @others; +ok( !probe_utils::boot_loader_download(undef), 'no file name is not a boot loader download' ); + +done_testing();