From nobody Sat Apr 27 05:01:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553257301247390.3807373288445; Fri, 22 Mar 2019 05:21:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDA83308FBA6; Fri, 22 Mar 2019 12:21:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FAA760DB4; Fri, 22 Mar 2019 12:21:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EF02E41F3D; Fri, 22 Mar 2019 12:21:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2MCLY9e002369 for ; Fri, 22 Mar 2019 08:21:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F82F1FDE1; Fri, 22 Mar 2019 12:21:34 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB06626DE5; Fri, 22 Mar 2019 12:21:29 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Fri, 22 Mar 2019 13:21:24 +0100 Message-Id: <20190322122124.1754-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH] tests: Don't use canonical paths in virstoragetest X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 22 Mar 2019 12:21:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The layout of my home directory is somewhat peculiar: I store all git repositories in ~/src/upstream, but since I spend almost all of my time hacking on libvirt, I also have a convenience symlink ~/src/libvirt -> ~/src/upstream/libvirt that I use to access that specific git repository. The above setup has served me well for years; however, ever since commit ca1471622dd9 dropped our own custom definitions for abs_{,top_}{src,build}dir and started using the ones provided by autotools, virstoragetest has started reliably failing with errors such as 2) Storage backing chain 2 ... Offset 0 Expect [chain member: 0 path:/home/abologna/src/upstream/libvirt/tests/virstoragedata/raw backingStoreRaw: capacity: 0 encryption: 0 relPath: type:1 format:1 protocol:none hostname: ] Actual [chain member: 0 path:/home/abologna/src/libvirt/tests/virstoragedata/raw backingStoreRaw: capacity: 0 encryption: 0 relPath: type:1 format:1 protocol:none hostname: ] ... FAILED Using abolute paths instead of canonical ones in the tests makes the problem go away. Note that all tests that are specifically designed to test path canonicalization via TEST_PATH_CANONICALIZE() were passing even before this patch and are not touched by it. Signed-off-by: Andrea Bolognani --- I'm far from being confident this is the correct approach, but I've grown annoyed enough by the constant 'make check' failures that I figured I'd at least get the discussion going :) tests/virstoragetest.c | 50 +++++++++--------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index fb98903f02..d2be6fffef 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -46,21 +46,16 @@ VIR_LOG_INIT("tests.storagetest"); * sub/link2: symlink to wrap * * Relative names to these files are known at compile time, but absolute - * and canonical names depend on where the test is run; for convenience, + * names depend on where the test is run; for convenience, * we pre-populate the computation of these names for use during the test. */ =20 static char *qemuimg; static char *absraw; -static char *canonraw; static char *absqcow2; -static char *canonqcow2; static char *abswrap; -static char *canonwrap; static char *absqed; -static char *canonqed; static char *absdir; -static char *canondir; static char *abslink2; =20 static void @@ -68,15 +63,10 @@ testCleanupImages(void) { VIR_FREE(qemuimg); VIR_FREE(absraw); - VIR_FREE(canonraw); VIR_FREE(absqcow2); - VIR_FREE(canonqcow2); VIR_FREE(abswrap); - VIR_FREE(canonwrap); VIR_FREE(absqed); - VIR_FREE(canonqed); VIR_FREE(absdir); - VIR_FREE(canondir); VIR_FREE(abslink2); =20 if (chdir(abs_builddir) < 0) { @@ -165,10 +155,6 @@ testPrepImages(void) fprintf(stderr, "unable to create directory %s\n", datadir "/dir"); goto cleanup; } - if (!(canondir =3D virFileCanonicalizePath(absdir))) { - virReportOOMError(); - goto cleanup; - } =20 if (chdir(datadir) < 0) { fprintf(stderr, "unable to test relative backing chains\n"); @@ -180,10 +166,6 @@ testPrepImages(void) fprintf(stderr, "unable to create raw file\n"); goto cleanup; } - if (!(canonraw =3D virFileCanonicalizePath(absraw))) { - virReportOOMError(); - goto cleanup; - } =20 /* Create a qcow2 wrapping relative raw; later on, we modify its * metadata to test other configurations */ @@ -200,10 +182,6 @@ testPrepImages(void) "-F", "raw", "-b", "raw", "qcow2", NULL); if (virCommandRun(cmd, NULL) < 0) goto skip; - if (!(canonqcow2 =3D virFileCanonicalizePath(absqcow2))) { - virReportOOMError(); - goto cleanup; - } =20 /* Create a second qcow2 wrapping the first, to be sure that we * can correctly avoid insecure probing. */ @@ -214,10 +192,6 @@ testPrepImages(void) virCommandAddArg(cmd, "wrap"); if (virCommandRun(cmd, NULL) < 0) goto skip; - if (!(canonwrap =3D virFileCanonicalizePath(abswrap))) { - virReportOOMError(); - goto cleanup; - } =20 /* Create a qed file. */ virCommandFree(cmd); @@ -227,10 +201,6 @@ testPrepImages(void) virCommandAddArg(cmd, "qed"); if (virCommandRun(cmd, NULL) < 0) goto skip; - if (!(canonqed =3D virFileCanonicalizePath(absqed))) { - virReportOOMError(); - goto cleanup; - } =20 #ifdef HAVE_SYMLINK /* Create some symlinks in a sub-directory. */ @@ -731,7 +701,7 @@ mymain(void) =20 /* Raw image, whether with right format or no specified format */ testFileData raw =3D { - .path =3D canonraw, + .path =3D absraw, .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_RAW, }; @@ -743,12 +713,12 @@ mymain(void) testFileData qcow2 =3D { .expBackingStoreRaw =3D "raw", .expCapacity =3D 1024, - .path =3D canonqcow2, + .path =3D absqcow2, .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_QCOW2, }; testFileData qcow2_as_raw =3D { - .path =3D canonqcow2, + .path =3D absqcow2, .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_RAW, }; @@ -772,7 +742,7 @@ mymain(void) testFileData wrap =3D { .expBackingStoreRaw =3D absqcow2, .expCapacity =3D 1024, - .path =3D canonwrap, + .path =3D abswrap, .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_QCOW2, }; @@ -795,7 +765,7 @@ mymain(void) testFileData wrap_as_raw =3D { .expBackingStoreRaw =3D absqcow2, .expCapacity =3D 1024, - .path =3D canonwrap, + .path =3D abswrap, .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_QCOW2, }; @@ -878,12 +848,12 @@ mymain(void) testFileData qed =3D { .expBackingStoreRaw =3D absraw, .expCapacity =3D 1024, - .path =3D canonqed, + .path =3D absqed, .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_QED, }; testFileData qed_as_raw =3D { - .path =3D canonqed, + .path =3D absqed, .type =3D VIR_STORAGE_TYPE_FILE, .format =3D VIR_STORAGE_FILE_RAW, }; @@ -892,12 +862,12 @@ mymain(void) =20 /* directory */ testFileData dir =3D { - .path =3D canondir, + .path =3D absdir, .type =3D VIR_STORAGE_TYPE_DIR, .format =3D VIR_STORAGE_FILE_DIR, }; testFileData dir_as_raw =3D { - .path =3D canondir, + .path =3D absdir, .type =3D VIR_STORAGE_TYPE_DIR, .format =3D VIR_STORAGE_FILE_RAW, }; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list