virstoragetest: Test backing chain loops with hardcoded images

Provide the images for the self and mutual backing image loop cases in
the repository rather than formatting them with qemu-img.

This makes the code more readable and also decouples the backing chain
tests from each other.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-09-06 16:56:19 +02:00
parent 0a67ae731a
commit df94a4e907
5 changed files with 7 additions and 25 deletions

View File

@ -1563,7 +1563,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
(\.p[yl]$$|\.spec\.in$$|^docs/|^(src/util/vir(file|event)\.c|src/libvirt-stream\.c|tests/(vir.+mock\.c|commandhelper\.c|qemusecuritymock\.c)|tools/nss/libvirt_nss_(leases|macs)\.c)$$)
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
(^tests/(nodedevmdevctl|virhostcpu|virpcitest)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)
(^tests/(nodedevmdevctl|virhostcpu|virpcitest|virstoragetest)data/|docs/js/.*\.js|docs/fonts/.*\.woff|\.diff|tests/virconfdata/no-newline\.conf$$)
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
(^(src/(util/(vircommand|virdaemon)|lxc/lxc_controller)|tests/testutils)\.c$$)

View File

@ -597,31 +597,13 @@ mymain(void)
TEST_CHAIN("qcow2-symlinks", abslink2, VIR_STORAGE_FILE_QCOW2, EXP_PASS);
#endif
/* Rewrite qcow2 to be a self-referential loop */
virCommandFree(cmd);
cmd = virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2",
"-F", "qcow2", "-b", "qcow2", "qcow2", NULL);
if (virCommandRun(cmd, NULL) < 0)
ret = -1;
/* Behavior of an infinite loop chain */
TEST_CHAIN("qcow2-qcow2_infinite-self", absqcow2, VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
/* Rewrite wrap and qcow2 to be mutually-referential loop */
virCommandFree(cmd);
cmd = virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2",
"-F", "qcow2", "-b", "wrap", "qcow2", NULL);
if (virCommandRun(cmd, NULL) < 0)
ret = -1;
virCommandFree(cmd);
cmd = virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2",
"-F", "qcow2", "-b", absqcow2, "wrap", NULL);
if (virCommandRun(cmd, NULL) < 0)
ret = -1;
/* Behavior of an infinite loop chain */
TEST_CHAIN("qcow2-qcow2_infinite-mutual", abswrap, VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
TEST_CHAIN("qcow2-qcow2_infinite-self",
abs_srcdir "/virstoragetestdata/images/loop-self.qcow2",
VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
TEST_CHAIN("qcow2-qcow2_infinite-mutual",
abs_srcdir "/virstoragetestdata/images/loop-2.qcow2",
VIR_STORAGE_FILE_QCOW2, EXP_FAIL);
/* setup data for backing chain lookup testing */
if (chdir(abs_srcdir "/virstoragetestdata/lookup") < 0) {

Binary file not shown.

Binary file not shown.

Binary file not shown.