2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-22 18:32:13 +00:00

fix(xcat-core): six xcattest checks pass on the failure they test for

A sweep of xCAT-test/autotest/testcase for the shape found in
nodeset_shell_lzma -- a check whose expected pattern also appears in its own
command -- returns 274 matches. In six of them the self-matching check is the
only proof of the property the case exists to test, so the case is green when
the property is absent.

xdcp_RP and xdcp_R write "test1" into /tmp/xdcp/test1/test1.txt, then read it
back and assert "output=~test1". The path repeats the content, so "cat:
/tmp/xdcp/test1/test1.txt: No such file or directory" matches. These are the
only checks that read the copied bytes; the earlier ls checks prove the name
arrived, not the content. updatenode_diskful_syncfiles_dir has the same shape
for the files updatenode -F syncs.

lsxcatd_null asserts "output=~lsxcatd" on "lsxcatd", which the shell's
"lsxcatd: command not found" satisfies.
export_import_multiple_osimages_by_dir asserts "output=~site" on "ls -R
/opt/inventory/site", which "ls: cannot access '/opt/inventory/site'"
satisfies.

The copied and synced files now carry a content marker that the path does not
repeat, so the check reads the bytes and not the file name. lsxcatd_null
asserts a line of the usage text, and the two inventory listings assert the
exported osimage name.

Verified with the runcmd and check-evaluation code lifted out of
xCAT-test/xcattest. Every replaced check is green both when the behaviour is
present and when it is removed. Every new check is green with the behaviour
present and red without it.

Seven further self-matching checks in xdcp/cases0 ("ls -l /tmp/test1.txt"
with "output=~test1") measure nothing but sit behind a sound "ls -l /tmp"
check, so a real failure is already caught. They are left for a decision.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit 194dd4ec6cbf3dc9d1e341b69445cbd3baa27b34)
This commit is contained in:
Daniel Hilst
2026-09-04 19:27:02 -03:00
parent c406d93bce
commit 0eaed3119f
4 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ start:lsxcatd_null
description:lsxcatd without any flag
label:mn_only,ci_test,xcatd
cmd:lsxcatd
check:output=~lsxcatd
check:output=~\[-v\|--version\]
end
start:lsxcatd_h
@@ -83,9 +83,9 @@ start:updatenode_diskful_syncfiles_dir
label:others,updatenode
cmd:mkdir -p /tmp/sync/
check:rc==0
cmd:echo "test1" > /tmp/sync/test1.txt
cmd:echo "syncdata1" > /tmp/sync/test1.txt
check:rc==0
cmd:echo "test2" > /tmp/sync/test2.txt
cmd:echo "syncdata2" > /tmp/sync/test2.txt
check:rc==0
cmd:echo "/tmp/sync/* -> /tmp/" > /install/custom/install/__GETNODEATTR($$CN,os)__/compute.$$OS.synclist
check:rc==0
@@ -97,9 +97,9 @@ cmd:xdsh $$CN "ls -l /tmp"
check:output=~test1.txt
check:output=~test2.txt
cmd:xdsh $$CN "cat /tmp/test1.txt"
check:output=~test1
check:output=~syncdata1
cmd:xdsh $$CN "cat /tmp/test2.txt"
check:output=~test2
check:output=~syncdata2
cmd:xdsh $$CN "rm -rf /tmp/test1.txt /tmp/test2.txt"
check:rc==0
cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute synclists=
@@ -1040,8 +1040,8 @@ cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".
cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format json -d /opt/inventory/site/osimage
check:rc==0
check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage
cmd: ls -R /opt/inventory/site/osimage
check: output =~ site
cmd:ls -R /opt/inventory/site/osimage
check:output=~test_myimage1
cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist
check:rc==0
cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists
@@ -1073,8 +1073,8 @@ check:rc==0
cmd: rmdef -t osimage -o test_myimage1,test_myimage2
check:rc==0
cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/partitionfile /tmp/pkglist /tmp/template
cmd: ls -R /opt/inventory/site
check: output =~ site
cmd:ls -R /opt/inventory/site
check:output=~test_myimage1
cmd:xcat-inventory import -t osimage -o test_myimage1,test_myimage2 -d /opt/inventory/site/osimage
check:rc==0
check:output=~The object test_myimage1 has been imported
+8 -8
View File
@@ -42,11 +42,11 @@ start:xdcp_RP
label:cn_os_ready,parallel_cmds
cmd:xdsh $$CN "mkdir -p /tmp/xdcp/test1"
check:rc==0
cmd:xdsh $$CN "echo "test1" > /tmp/xdcp/test1/test1.txt"
cmd:xdsh $$CN "echo "xdcpdata1" > /tmp/xdcp/test1/test1.txt"
check:rc==0
cmd:xdsh $$CN "mkdir -p /tmp/xdcp/test2"
check:rc==0
cmd:xdsh $$CN "echo "test2" > /tmp/xdcp/test2/test2.txt"
cmd:xdsh $$CN "echo "xdcpdata2" > /tmp/xdcp/test2/test2.txt"
check:rc==0
cmd:xdcp $$CN -RP /tmp/xdcp /tmp
check:rc==0
@@ -58,9 +58,9 @@ check:output=~test1.txt
cmd:ls -l /tmp/xdcp._$$CN/test2
check:output=~test2.txt
cmd:cat /tmp/xdcp._$$CN/test1/test1.txt
check:output=~test1
check:output=~xdcpdata1
cmd:cat /tmp/xdcp._$$CN/test2/test2.txt
check:output=~test2
check:output=~xdcpdata2
cmd:xdsh $$CN "rm -rf /tmp/xdcp"
check:rc==0
cmd:rm -rf /tmp/xdcp._$$CN
@@ -71,11 +71,11 @@ start:xdcp_R
label:cn_os_ready,parallel_cmds
cmd:mkdir -p /tmp/xdcp/test1
check:rc==0
cmd:echo "test1" > /tmp/xdcp/test1/test1.txt
cmd:echo "xdcpdata1" > /tmp/xdcp/test1/test1.txt
check:rc==0
cmd:mkdir -p /tmp/xdcp/test2
check:rc==0
cmd:echo "test2" > /tmp/xdcp/test2/test2.txt
cmd:echo "xdcpdata2" > /tmp/xdcp/test2/test2.txt
check:rc==0
cmd:xdcp $$CN -R /tmp/xdcp /tmp
check:rc==0
@@ -89,9 +89,9 @@ check:output=~test1.txt
cmd:xdsh $$CN "ls -l /tmp/xdcp/test2"
check:output=~test2.txt
cmd:xdsh $$CN "cat /tmp/xdcp/test1/test1.txt"
check:output=~test1
check:output=~xdcpdata1
cmd:xdsh $$CN "cat /tmp/xdcp/test2/test2.txt"
check:output=~test2
check:output=~xdcpdata2
cmd:xdsh $$CN "rm -rf /tmp/xdcp"
check:rc==0
cmd:rm -rf /tmp/xdcp