From 7fed9001e8c2063cf2c5cfe0223d3ab8e288d9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sat, 5 Sep 2026 01:49:30 -0300 Subject: [PATCH] test(xCAT-test): cover the riscv64 Ubuntu network drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reads the list imgutils returns. Covers the drivers a node needs to reach its root filesystem, the overlay module, the architectures that already worked keeping theirs, and an unknown architecture still getting an empty list. Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com> --- xCAT-test/unit/ubuntu_riscv64_net_drivers.t | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 xCAT-test/unit/ubuntu_riscv64_net_drivers.t diff --git a/xCAT-test/unit/ubuntu_riscv64_net_drivers.t b/xCAT-test/unit/ubuntu_riscv64_net_drivers.t new file mode 100644 index 000000000..6e98c33a2 --- /dev/null +++ b/xCAT-test/unit/ubuntu_riscv64_net_drivers.t @@ -0,0 +1,38 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use FindBin; +use Test::More; + +# Without a driver list the Ubuntu netboot image ships no network module at all, and a node +# whose NIC is not built into the kernel cannot reach its root filesystem. QEMU hides this, +# because virtio-net is built into the Ubuntu riscv64 kernel; a machine with an r8169 or an +# e1000e does not boot. + +use lib "$FindBin::Bin/../../perl-xCAT"; +use lib "$FindBin::Bin/../../xCAT-server/lib/perl"; +use lib "$FindBin::Bin/../../xCAT-server/share/xcat/netboot/imgutils"; +require imgutils; + +my @riscv = imgutils::default_net_drivers( 'ubuntu', 'riscv64' ); +ok( scalar @riscv, 'a riscv64 Ubuntu image is given network drivers' ); + +for my $driver (qw(virtio_net e1000 e1000e igb r8169 tg3 mlx5_core)) { + ok( scalar( grep { $_ eq $driver } @riscv ), "the list carries $driver" ); +} + +# Every Ubuntu row carries overlay, because the netboot root is an overlay mount. +ok( scalar( grep { $_ eq 'overlay' } @riscv ), 'the list carries overlay' ); + +# The architectures that already worked must keep the drivers they had. +is_deeply( + [ imgutils::default_net_drivers( 'ubuntu', 'x86_64' ) ], + [qw(tg3 bnx2 bnx2x e1000 e1000e igb mlx_en mlx5_core virtio_net overlay)], + 'x86_64 keeps its drivers' ); +ok( scalar( imgutils::default_net_drivers( 'ubuntu', 'ppc64el' ) ), + 'ppc64el keeps its drivers' ); +is_deeply( [ imgutils::default_net_drivers( 'ubuntu', 'sparc' ) ], [], + 'an architecture with no entry still gets an empty list' ); + +done_testing();