diff --git a/xCAT-test/unit/genesis_openembedded.t b/xCAT-test/unit/genesis_openembedded.t index 45f9f0764..a1615fda8 100644 --- a/xCAT-test/unit/genesis_openembedded.t +++ b/xCAT-test/unit/genesis_openembedded.t @@ -104,12 +104,13 @@ like( $ppc64_kas, qr{includes:\s*\n\s*- xCAT-genesis-builder/oe/kas/common\.yml} like( $ppc64_kas, qr/^machine: xcat-genesis-ppc64$/m, 'ppc64 build selects its machine' ); -my $build = read_file('xCAT-genesis-builder/oe/build'); my $build_path = File::Spec->catfile( $repo_root, qw(xCAT-genesis-builder oe build) ); -my @listed_architectures = `$build_path --list-architectures`; -is($? >> 8, 0, 'build reports its supported architectures'); +open(my $architecture_report, '-|', $build_path, '--list-architectures') + or die "Unable to query $build_path: $!"; +my @listed_architectures = <$architecture_report>; +ok(close($architecture_report), 'build reports its supported architectures'); chomp @listed_architectures; is_deeply( \@listed_architectures, @@ -136,6 +137,8 @@ chmod(0755, $kas_stub) or die "Unable to make $kas_stub executable: $!"; 'build accepts s390x'); is(system($build_path, 'not-an-architecture') >> 8, 2, 'build rejects an unsupported architecture'); + is(system($build_path, 'x86*') >> 8, 2, + 'build treats architecture names literally'); } open(my $kas_log_file, '<', $kas_log) or die "Unable to read $kas_log: $!"; my @kas_invocations = <$kas_log_file>; @@ -914,9 +917,6 @@ my $smoke_extension = read_file( ); like( $smoke_extension, qr/^XCAT_GENESIS_EXTENSION_NAME = "xcat-smoke"$/m, 'open smoke extension exercises the build path' ); -like( $smoke_extension, - qr/^XCAT_GENESIS_EXTENSION_ARCHITECTURE = "\$\{XCAT_GENESIS_ARCHITECTURE\}"$/m, - 'smoke extension uses the target architecture identity' ); my $preset = read_file( 'xCAT-genesis-builder/oe/meta-xcat-genesis/recipes-core/xcat-genesis-init/files/00-xcat-genesis.preset' diff --git a/xCAT-test/unit/genesis_openembedded_activation.t b/xCAT-test/unit/genesis_openembedded_activation.t index da2c7c572..a550cbe09 100644 --- a/xCAT-test/unit/genesis_openembedded_activation.t +++ b/xCAT-test/unit/genesis_openembedded_activation.t @@ -112,9 +112,12 @@ like( qr{/opt/xcat/share/xcat/netboot/genesis-openembedded/ARCH}, 'the mknb man page documents the OpenEmbedded install namespace', ); +my ($architecture_names) = $mknb_pod =~ + /OpenEmbedded images use the exact architecture names ([^.]+)\./; +ok(defined($architecture_names), 'the mknb man page has an architecture list'); for my $architecture (qw(x86 x86_64 ppc64 ppc64le armv7hf aarch64 riscv64 s390x)) { like( - $mknb_pod, + $architecture_names, qr/\b\Q$architecture\E\b/, "the mknb man page lists $architecture", ); diff --git a/xCAT-test/unit/mknb_xcatd_address.t b/xCAT-test/unit/mknb_xcatd_address.t index 699daf3f6..7983f879e 100644 --- a/xCAT-test/unit/mknb_xcatd_address.t +++ b/xCAT-test/unit/mknb_xcatd_address.t @@ -10,6 +10,7 @@ use File::Path qw(make_path); use File::Temp qw(tempdir); use Test::More; use XCAT::Test::File qw(repo_path); +use xCAT::DHCP::BootPolicy; BEGIN { package xCAT::Utils; @@ -521,6 +522,17 @@ is((stat "$xCAT::TableUtils::tftpdir/pxelinux.cfg")[2] & 07777, 0755, my $s390x_qemu_path = "$xCAT::TableUtils::tftpdir/pxelinux.cfg/s390x/192.168.144.0_20"; ok(-f $s390x_qemu_path, 's390x writes a QEMU network IPL configuration'); +my $s390x_classes = xCAT::DHCP::BootPolicy->kea_s390x_network_classes( + net => '192.168.144.0', prefix => 20, +); +my ($s390x_conf_file) = map { $_->{data} } + grep { $_->{name} eq 'conf-file' } + @{ $s390x_classes->[0]{'option-data'} }; +is( + "$xCAT::TableUtils::tftpdir/pxelinux.cfg/$s390x_conf_file", + $s390x_qemu_path, + 'the DHCP configuration name resolves to the file written by mknb', +); is( read_config($s390x_qemu_path), "# pxelinux.cfg xCAT Genesis s390x\n" @@ -536,6 +548,17 @@ unlike( qr/192\.168\.149\.100/, 's390x configurations do not use the later floating address', ); +%xCAT::TableUtils::site_extra = ( dhcpinterfaces => 'eth0,eth1:noboot' ); +$xCAT::NetworkUtils::nic_ips = { eth0 => '10.0.0.1', eth1 => '192.168.148.10' }; +$responses = run_mknb('s390x'); +generation_succeeded($responses, 's390x honors :noboot on the selected xcatd address'); +ok(!-e $s390x_qemu_path, + 'a selected xcatd address on :noboot gets no s390x configuration'); +%xCAT::TableUtils::site_extra = (); +$xCAT::NetworkUtils::nic_ips = undef; +$responses = run_mknb('s390x'); +generation_succeeded($responses, 's390x configuration is restored after :noboot'); + write_text($s390x_qemu_path, "admin network configuration\n"); $responses = run_mknb('s390x'); ok( @@ -548,6 +571,21 @@ unlink($s390x_qemu_path); $responses = run_mknb('s390x'); generation_succeeded($responses, 's390x configuration is restored after removing the unmanaged file'); +unlink($s390x_qemu_path); +my $s390x_symlink_target = "$tmpdir/s390x-symlink-target"; +symlink($s390x_symlink_target, $s390x_qemu_path) + or die "Unable to create s390x test symlink: $!"; +$responses = run_mknb('s390x'); +ok( + scalar(grep { ref($_) eq 'HASH' && $_->{error} && "@{$_->{error}}" =~ /Refusing to replace unmanaged/ } @{$responses}), + 's390x refuses to follow an unmanaged configuration symlink', +); +ok(!-e $s390x_symlink_target, + 'an unmanaged configuration symlink target is unchanged'); +unlink($s390x_qemu_path); +$responses = run_mknb('s390x'); +generation_succeeded($responses, 's390x configuration is restored after removing the symlink'); + my $s390x_legacy_root = "$tmpdir/tftpboot-s390x-legacy"; make_path("$s390x_legacy_root/pxelinux.cfg/s390x"); my ($s390x_legacy_path, $s390x_legacy_error) = @@ -568,7 +606,7 @@ like( ); my $s390x_failure_root = "$tmpdir/tftpboot-s390x-failure"; -make_path("$s390x_failure_root/pxelinux.cfg/s390x/192.168.144.0_20"); +make_path("$s390x_failure_root/pxelinux.cfg"); my (undef, $s390x_write_error) = xCAT_plugin::mknb::_write_s390x_discovery_config( tftpdir => $s390x_failure_root,