Use prepared test images instead to simplify and clarify the code instead of rewriting existing images multiple times. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- tests/virstoragetest.c | 39 +++--------------- ...2_qcow2-qcow2-symlink_raw-raw-reldir.qcow2 | Bin 0 -> 196616 bytes .../images/qcow2_raw-raw-reldir.qcow2 | Bin 0 -> 196616 bytes tests/virstoragetestdata/images/sub/link1 | 1 + tests/virstoragetestdata/images/sub/link2 | 1 + tests/virstoragetestdata/out/qcow2-symlinks | 6 +-- 6 files changed, 10 insertions(+), 37 deletions(-) create mode 100644 tests/virstoragetestdata/images/qcow2_qcow2-qcow2-symlink_raw-raw-reldir.qcow2 create mode 100644 tests/virstoragetestdata/images/qcow2_raw-raw-reldir.qcow2 create mode 120000 tests/virstoragetestdata/images/sub/link1 create mode 120000 tests/virstoragetestdata/images/sub/link2 diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index dcb5a8a427..15296cc14f 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -42,8 +42,6 @@ VIR_LOG_INIT("tests.storagetest"); * raw: 1024-byte raw file * qcow2: qcow2 file with 'raw' as backing * wrap: qcow2 file with 'qcow2' as backing - * sub/link1: symlink to qcow2 - * sub/link2: symlink to wrap * * Relative names to these files are known at compile time, but absolute * names depend on where the test is run; for convenience, @@ -54,7 +52,6 @@ static char *qemuimg; static char *absraw; static char *absqcow2; static char *abswrap; -static char *abslink2; static void testCleanupImages(void) @@ -63,7 +60,6 @@ testCleanupImages(void) VIR_FREE(absraw); VIR_FREE(absqcow2); VIR_FREE(abswrap); - VIR_FREE(abslink2); if (chdir(abs_builddir) < 0) { fprintf(stderr, "unable to return to correct directory, refusing to " @@ -133,10 +129,9 @@ testPrepImages(void) absraw = g_strdup_printf("%s/raw", datadir); absqcow2 = g_strdup_printf("%s/qcow2", datadir); abswrap = g_strdup_printf("%s/wrap", datadir); - abslink2 = g_strdup_printf("%s/sub/link2", datadir); - if (g_mkdir_with_parents(datadir "/sub", 0777) < 0) { - fprintf(stderr, "unable to create directory %s\n", datadir "/sub"); + if (g_mkdir_with_parents(datadir, 0777) < 0) { + fprintf(stderr, "unable to create directory %s\n", datadir); goto cleanup; } @@ -177,15 +172,6 @@ testPrepImages(void) if (virCommandRun(cmd, NULL) < 0) goto skip; -#ifdef WITH_SYMLINK - /* Create some symlinks in a sub-directory. */ - if (symlink("../qcow2", datadir "/sub/link1") < 0 || - symlink("../wrap", datadir "/sub/link2") < 0) { - fprintf(stderr, "unable to create symlink"); - goto cleanup; - } -#endif - ret = 0; cleanup: if (ret) @@ -552,25 +538,10 @@ mymain(void) TEST_CHAIN("directory-none", abs_srcdir "/virstoragetestdata/images/", VIR_STORAGE_FILE_NONE, EXP_PASS); TEST_CHAIN("directory-dir", abs_srcdir "/virstoragetestdata/images/", VIR_STORAGE_FILE_DIR, EXP_PASS); -#ifdef WITH_SYMLINK - /* Rewrite qcow2 and wrap file to use backing names relative to a - * symlink from a different directory */ - virCommandFree(cmd); - cmd = virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2", - "-F", "raw", "-b", "../raw", "qcow2", NULL); - if (virCommandRun(cmd, NULL) < 0) - ret = -1; - - virCommandFree(cmd); - cmd = virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2", - "-F", "qcow2", "-b", "../sub/link1", "wrap", - NULL); - if (virCommandRun(cmd, NULL) < 0) - ret = -1; - /* Behavior of symlinks to qcow2 with relative backing files */ - TEST_CHAIN("qcow2-symlinks", abslink2, VIR_STORAGE_FILE_QCOW2, EXP_PASS); -#endif + TEST_CHAIN("qcow2-symlinks", + abs_srcdir "/virstoragetestdata/images/sub/link2", + VIR_STORAGE_FILE_QCOW2, EXP_PASS); /* Behavior of an infinite loop chain */ TEST_CHAIN("qcow2-qcow2_infinite-self", diff --git a/tests/virstoragetestdata/images/qcow2_qcow2-qcow2-symlink_raw-raw-reldir.qcow2 b/tests/virstoragetestdata/images/qcow2_qcow2-qcow2-symlink_raw-raw-reldir.qcow2 new file mode 100644 index 0000000000000000000000000000000000000000..9620410502f21101fb64d0314cb4a0c710870dd2 GIT binary patch literal 196616 zcmeIuJ5Iwu5CG7%104lNa7_V%Lm(m1P*FRHBP@b#97iEkoR4F03M3jfKOu@3`aE0f z8Sjo~z3=Y&<|~9Sh$CL<X?&c-v5N6J+Jq32b+WD6zHR1q75n3=NwZu2Sf0Jd{P=lP zFRo(pF!;QW?cYKemu<JqhGn-a?T^W*Zrgd&{r8Ksc<G9^%BR^l@A7O?PK(|R2BZ3^ zX^YvctgEbBHvQF+YSq6Q7vt>qDl4k4EsI&t21%Iaugk10CZl>@b$zAlE@_A|PkHla z;dak7Y4b()>&!iW^Rsk*eleR5FQ#Snc=<CcBS3%v0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK;U2m z(t|mvgAyP>fB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+z&?Q_Z0>#Q<_QoWK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ Q009C72oNAZ;GhJ)0p$faq5uE@ literal 0 HcmV?d00001 diff --git a/tests/virstoragetestdata/images/qcow2_raw-raw-reldir.qcow2 b/tests/virstoragetestdata/images/qcow2_raw-raw-reldir.qcow2 new file mode 100644 index 0000000000000000000000000000000000000000..1e32c78a46e0ca9881e85ea9e36aef0a67fccaf7 GIT binary patch literal 196616 zcmeIvO-_SA6ae4>jBAg;+C@z~go%k8SFW+pNKz@GG>R+F=P^8mi5sVXX<QWD_Zu?2 zVdn9M`MAHi{SF~yvB#EP#M^o7>loYFHiVFD2D_}?({^s3aXhYzwEN}H;qoJnv#xmA zOg&{^53&4v2xZ;%L;hIz`_%E6Oc!0ZYWx4bkyfvL)iuRDFN?m&XZ5@q-5{GTp4+Zk zF6%{;_d`3L9jVs!o3bkNyX(Aa`mU~)BO4@PUc3!?SIwr2Rnw29ZmOgq$~+hCpNYFY z(<BP#zs@}JHHW3i<ZAzG4wFU%2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXFoQ^<xI!AR<0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBl~B9Mgbb!6Ez0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5)0 GmcS44-!<w0 literal 0 HcmV?d00001 diff --git a/tests/virstoragetestdata/images/sub/link1 b/tests/virstoragetestdata/images/sub/link1 new file mode 120000 index 0000000000..35320292b1 --- /dev/null +++ b/tests/virstoragetestdata/images/sub/link1 @@ -0,0 +1 @@ +../qcow2_raw-raw-reldir.qcow2 \ No newline at end of file diff --git a/tests/virstoragetestdata/images/sub/link2 b/tests/virstoragetestdata/images/sub/link2 new file mode 120000 index 0000000000..6fc44056b2 --- /dev/null +++ b/tests/virstoragetestdata/images/sub/link2 @@ -0,0 +1 @@ +../qcow2_qcow2-qcow2-symlink_raw-raw-reldir.qcow2 \ No newline at end of file diff --git a/tests/virstoragetestdata/out/qcow2-symlinks b/tests/virstoragetestdata/out/qcow2-symlinks index ed37f61e9f..34c3a37c2e 100644 --- a/tests/virstoragetestdata/out/qcow2-symlinks +++ b/tests/virstoragetestdata/out/qcow2-symlinks @@ -1,4 +1,4 @@ -path:ABS_BUILDDIR/virstoragedata/sub/link2 +path:ABS_SRCDIR/virstoragetestdata/images/sub/link2 backingStoreRaw: ../sub/link1 capacity: 1024 encryption: 0 @@ -8,7 +8,7 @@ format:14 protocol:none hostname:<null> -path:ABS_BUILDDIR/virstoragedata/sub/../sub/link1 +path:ABS_SRCDIR/virstoragetestdata/images/sub/../sub/link1 backingStoreRaw: ../raw capacity: 1024 encryption: 0 @@ -18,7 +18,7 @@ format:14 protocol:none hostname:<null> -path:ABS_BUILDDIR/virstoragedata/sub/../sub/../raw +path:ABS_SRCDIR/virstoragetestdata/images/sub/../sub/../raw backingStoreRaw: <null> capacity: 0 encryption: 0 -- 2.31.1