2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-21 01:42:15 +00:00
Commit Graph

29 Commits

Author SHA1 Message Date
Daniel Hilst 2107bd6069 fix(xcat-core): chtab receives only the first setting of a [Table_*] value
With [Table_vm] othersettings=cpumode:host-passthrough;firmware:efi-secureboot,
xcattest gives chtab only cpumode:host-passthrough, and bash runs
firmware:efi-secureboot as a command. The environment setup then fails.

chtab_command joined its words unquoted, and xcattest runs the command
through /bin/bash -c. chtab_command now quotes every word, the row selector
included, with the same _quote that chdef_command uses.

xcattest_conf_chtab_command.t passes with this change and fails 3 of 4
checks on the previous commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-30 10:01:30 -03:00
Daniel Hilst e813f1eed0 fix(xcat-core): no test shows a [Table_*] semicolon breaks the chtab command
xcattest builds the chtab command for a [Table_*] row with unquoted words and
runs it through /bin/bash -c. A [Table_vm] othersettings value such as
cpumode:host-passthrough;firmware:efi-secureboot ends the command at the
semicolon: chtab receives only the first setting, and bash runs the second as
a command, so the environment setup fails.

Move the command builder from setup_env_by_configure_file into
xCAT::Test::Conf::chtab_command, with the same output, so a test can read the
words chtab receives. xcattest_conf_chtab_command.t splits the command the way
the shell does. Three of its four checks fail on this commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-30 10:01:22 -03:00
Daniel Hilst 9f4a296310 Merge branch 'master' into fix/xcattest-table-value-class
xCAT-server/lib/xcat/plugins/anaconda.pm conflicted in the module
imports: this branch adds "use xCAT::MediaPerms" and master adds
"use xCAT::SELinux" on the same line. Both imports are kept. The two
modules are used in different subs, and no other hunk conflicted.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-29 14:45:55 -03:00
Daniel Hilst 839117f9ef fix(xcattest): a [Table_*] value stops at its first colon or slash
xcattest applies a conf's [Table_*] blocks itself, once, before the first case
runs, so whatever table_attr returns is what reaches chtab. Its value class was
([\w\.\-]+), which stops at a colon or a slash and writes the truncated value
with no warning: on a management node provisioning over IPv6,
`net=2001:db8:176::/64` reached chtab as `net=2001`, and xcattest re-applied that
junk row on every run. [Table_site] value= has the same hole, so site.master
cannot be an IPv6 address either, and any table value holding a path or a
comma-separated list loses everything after the first slash or colon.

object_attr, beside it in the same module, already accepts ":,;/" -- which is
why an [Object_node] ip= carries an IPv6 address and a [Table_networks] net=
silently could not. table_attr now uses the same class. Both are faithful to
what they replaced: upstream xcattest still matches tables with ([\w\.\-]+) at
line 817 and objects with ([\w\.\-\+\ \/:]+) at line 854, and moving the pair
into xCAT::Test::Conf is what made the asymmetry visible and testable.

The class holds no whitespace and no '#', so a trailing inline comment is still
excluded -- asserted, because that is the behaviour a wider class could have
broken.

xcattest_conf_table_value_class.t covers one line per kind of value a table
holds. Seven of its 22 assertions fail without the fix, including the three IPv6
forms and the absolute path; xcattest_conf_object_attr.t stays green, which is
the control that colons were never meant to be refused.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 10:23:16 -03:00
Daniel Hilst f47541e19b fix(xcat-core): an openSUSE management node is not recognised, so no case runs
current_os reads /etc/os-release and returns undef for openSUSE. The word sles
appears nowhere in Leap's os-release -- ID is opensuse-leap on 15.x and
opensuse on 42.3 -- and Leap ships none of /etc/redhat-release,
/etc/lsb-release or /etc/SuSE-release, so no other arm is reached. xcattest
rejects every case on the resulting undef, and 328 of the shipped cases declare
os:Linux.

openSUSE now answers with the SLE family whose package set it shares, which is
the answer decided on 2026-09-18 for the same bug: sles.pm claims leap15 and
xcat.org publishes the Leap dependencies under sles15. It also lets the 18
cases written os:sles select a Leap node, which a name of its own would not.
current_os has one consumer -- the os: comparison at xcattest:1052 -- so the
answer affects nothing else.

The match is on the whole file rather than on ID alone, because Leap 42.3
spells its ID opensuse and Tumbleweed opensuse-tumbleweed. It is placed after
the sles test, so a real SLES node is unaffected.

xcattest_os_selection.t passes, 19 of 19. Reverting this file alone fails its
five openSUSE assertions and nothing else.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-26 10:22:32 -03:00
Daniel Hilst 6e0b113edf fix(xcattest): an [Object_*] value stops at its first semicolon
A conf that declares vmothersetting=cpumode:host-passthrough;firmware:efi
reaches the node as vmothersetting=cpumode:host-passthrough. The value
class of object_attr held no semicolon, so the reader kept the characters
up to it and dropped the rest without a message. vm.othersettings
separates its settings with a semicolon, so no conf could set two of them.

object_attr now keeps the semicolon, and chdef_command quotes every word
it takes from the conf. The quoting is what makes the semicolon safe:
xcattest runs each command through /bin/bash -c, where an unquoted
semicolon ends the command. chdef_command also sorts the assignments, so
one conf builds one command.

xcattest_conf_object_attr.t covers both halves.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:36:45 -03:00
Daniel Hilst b5181574ea test(xcattest): a conf cannot set a vm.othersettings with two settings
An [Object_*] line of an xcattest conf declares an xCAT node attribute.
vm.othersettings holds several settings separated by a semicolon, which
is the syntax the kvm plugin reads, and such a line reaches the node cut
at its first semicolon with no message. The reader drops the rest, and
the chdef that applies it runs through /bin/bash -c unquoted, so the
shell would read the semicolon as a command separator.

load_config_file read each line with a regular expression written inline
and built the chdef by concatenation, so neither could be measured
without a database. xCAT::Test::Conf now holds the three readers and the
command builder, and xcattest calls them. The routines keep the behaviour
they replace, and both packages install the module.

xcattest_conf_object_attr.t fails five of its nine checks on this commit:
the semicolon value, the quoting and the order of the assignments.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 19:36:45 -03:00
Daniel Hilst b74a0f27aa Merge upstream/master into refactor/r26-fips-policy
Two files needed a resolution. Both are unions of independent additions.

XCAT::Test::Lifecycle::build_deb takes master's new $source argument and its
-xpf extraction, and keeps the control-$arch selection this branch adds for
xCAT-genesis-scripts. $source defaults to the repository root, so the branch
behaviour does not change.

.github/workflows/xcat_test.yml keeps master's profile_package_payload.t on
both lifecycle prove lines and master's Perl module list, and keeps this
branch's FIPS steps, bzip2 and openssl.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-21 10:32:47 -03:00
Vinícius Ferrão fa233e6d36 test(packaging): cover Debian profile permissions from writable sources
Preserve source modes when staging Debian package builds and accept a
private source fixture. Build group-writable profiles under umasks 0022
and 0002, then check the extracted data, postscripts and directories.

Verify that staging and packaging leave source permissions unchanged,
including a world-writable data file. Reuse the payload checks for normal,
reduced and permission-regression builds.
2026-10-19 19:33:33 -03:00
Vinícius Ferrão 6a8755ac13 test(fips): verify generated policy and package payloads 2026-10-17 02:57:05 -03:00
Vinícius Ferrão 509a60def2 test(provisioning): isolate install disk selection checks 2026-10-16 19:06:25 -03:00
Daniel Hilst 82a658ff23 Merge pull request #7917 from VersatusHPC/test/r26-package-artifacts
test(packaging): exercise package and repository behavior
2026-10-14 11:44:03 -03:00
Vinícius Ferrão aebc350e1a test(probe): exercise the built RPM payload 2026-10-13 11:38:10 -03:00
Vinícius Ferrão 14d0ac27da test(genimage): check driver selection after driver updates 2026-10-13 11:38:09 -03:00
Daniel Hilst be9c063981 Merge pull request #7913 from VersatusHPC/test/r26-ubuntu-image-behavior
test(ubuntu): exercise media imports and genimage behavior
2026-10-13 11:21:29 -03:00
Daniel Hilst abf0f2228f Merge pull request #7935 from VersatusHPC/refactor/r26-package-lifecycle
refactor(packaging): share package lifecycle helpers
2026-10-13 10:00:14 -03:00
Vinícius Ferrão 320a1a1299 test(ubuntu): inspect resolver files in generated initrds
Run the unchanged initrd builder with fixture binaries and inspect both generated archives. Replace source extraction with checks for selected libraries and their contents.
2026-10-12 13:58:45 -03:00
Vinícius Ferrão a4e14299ee test(ubuntu): exercise genimage mirror selection
Read site settings from an isolated database and inspect the sources.list written into the image. Stop at an injected package-metadata failure without downloading packages.
2026-10-12 13:58:45 -03:00
Vinícius Ferrão 5013f85774 test(ubuntu): check debootstrap architecture arguments
Run genimage and inspect the arguments passed to debootstrap instead of evaluating an extracted assignment. Keep the existing ppc64le pass-through explicit.
2026-10-12 13:58:45 -03:00
Vinícius Ferrão 114efc35e1 test(ubuntu): exercise live-media imports and warnings
Replace source-text assertions with real media imports in an isolated filesystem and database. Run the native fixture before the package build in CI.
2026-10-12 13:58:32 -03:00
Vinícius Ferrão eb2df9cb70 test(packaging): stage shared shell scriptlet sources
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-10-12 12:31:56 -03:00
Daniel Hilst 2b1fb5a090 Merge pull request #7927 from VersatusHPC/test/r26-process-helper
test(process): share command execution across unit tests
2026-10-12 10:31:36 -03:00
Vinícius Ferrão f11b740b56 test(packaging): stage shared Lua scriptlet sources
Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com>
2026-10-11 11:32:21 -03:00
Vinícius Ferrão 7fdb437ea3 docs(test): describe the shared command runner 2026-10-09 22:43:07 -03:00
Vinícius Ferrão df1fe8c7c9 test(process): share command output and exit status capture 2026-10-09 22:43:06 -03:00
Vinícius Ferrão 3abd11220a test(packaging): exercise RPM service lifecycle 2026-10-09 03:22:46 -03:00
Vinícius Ferrão e83ddfe0d9 test(packaging): exercise Debian service lifecycle 2026-10-09 03:22:46 -03:00
Daniel Hilst 3582c6ab19 fix(xcat-core): xcattest runs no test case on an openEuler management node
xcattest reports "Test case <name> has an invalid OS option - Linux" and then
"There is no valid case to run", so every case is skipped on openEuler.
Recorded on an openEuler 24.03 LTS SP4 management node with xCAT 2.20.0: both
flat provisioning cases were rejected and the run measured nothing.

Two causes, both in the os: comparison in xCAT-test/xcattest. get_current_os
takes the /etc/os-release branch, finds no sles, and falls off the end of that
branch, so it returns the exit status of the failed grep, 256, which names no
distribution. And a case marked os:Linux expands to exactly rhels, sles and
ubuntu, so openEuler would be rejected even by a correct get_current_os.

Both halves move into xCAT::Test::OS. xcattest finds it beside itself and the
package installs it at <prefix>/lib/perl. current_os takes a path prefix, so a
test describes a system by writing release files into a scratch tree. openEuler
is named in both halves and nothing else changes.

xCAT-test/unit/xcattest_os_selection.t covers it. Removing openeuler from
linux_aliases fails two checks, and removing the openEuler branch from
current_os fails three. A further case gives a root both /etc/redhat-release
and an openEuler /etc/os-release and asserts rhels10, so the precedence is
named: openEuler ships neither that file nor /etc/lsb-release.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-30 19:59:41 -03:00
Vinícius Ferrão 2f2cabf86e test: centralize repository file reads 2026-08-24 21:50:51 -03:00