From nobody Mon Feb 9 12:11:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1617285237; cv=none; d=zohomail.com; s=zohoarc; b=U8G2mFtIFcSGQQx0zUT603+lKWINL9soQYsVenLJkxRGUOh5ADhHZCuMheR8aTLd6JO2Pq5PjTaieJYXfUGfLWTcEEoz4IaMbplz9VCSwVqL0mfHNvQpnfmOTnzC5/QmW4mAMG5RDbTG4RHAPlHrsgZm02EoDpaDMMmjGvrBRGM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617285237; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=h/nd95xRCpb3bKBqIUWlTqUQtKptUUVv2tK5B70lqz8=; b=hxuRUrk21AfA/7YGS9+H+O+bAl1aXivku9Yv12dvgf2kxQChRk6EEF0v0ymprHipAu5whCzcvcl+IaXyeWJC9Z0U4Gh5CpUIywy1rIvfWKIhlqJCO7wK0s2SQvSG3dSjLKqH+eInH5fWsGRDCldx2H0jbFKM0J9VRtCkDSZ4raQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1617285237667306.9698410796541; Thu, 1 Apr 2021 06:53:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-mn3ux35zPDWmnr1qNf_sWA-1; Thu, 01 Apr 2021 09:53:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BEB6681426D; Thu, 1 Apr 2021 13:53:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9915260C5F; Thu, 1 Apr 2021 13:53:48 +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 54E3A18155DD; Thu, 1 Apr 2021 13:53:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 131Dqvjk023076 for ; Thu, 1 Apr 2021 09:52:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id D21B15C238; Thu, 1 Apr 2021 13:52:57 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3364D5C1A1 for ; Thu, 1 Apr 2021 13:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617285235; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=h/nd95xRCpb3bKBqIUWlTqUQtKptUUVv2tK5B70lqz8=; b=Mj3NmVoEaG3BO1suka++gzuPXuxDyWlW9IFePtKVPDlDYjeVQpUdeoH+pmCjgrPeorxmMr L6E2L2wfwLlHkXdEHhwyI8vtG1E8vHKbQir/W8k94Xp+GrjQhzotZKnclYjRaJn7ip6IDJ oCF1Yyd1T1OvA36GEMeXOOhcyC/+Uuw= X-MC-Unique: mn3ux35zPDWmnr1qNf_sWA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/39] tests: Remove testing of virStorageFileCanonicalizePath Date: Thu, 1 Apr 2021 15:52:05 +0200 Message-Id: <04e13792718ba4143a9ba49edf5f106d46242079.1617285119.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Remove the last code using the function. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virstoragetest.c | 100 ----------------------------------------- 1 file changed, 100 deletions(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 157d577c7d..23cc72d85c 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -398,62 +398,6 @@ testStorageLookup(const void *args) } -struct testPathCanonicalizeData -{ - const char *path; - const char *expect; -}; - -static const char *testPathCanonicalizeSymlinks[][2] =3D -{ - {"/path/blah", "/other/path/huzah"}, - {"/path/to/relative/symlink", "../../actual/file"}, - {"/cycle", "/cycle"}, - {"/cycle2/link", "./link"}, -}; - -static int -testPathCanonicalizeReadlink(const char *path, - char **linkpath, - void *data G_GNUC_UNUSED) -{ - size_t i; - - *linkpath =3D NULL; - - for (i =3D 0; i < G_N_ELEMENTS(testPathCanonicalizeSymlinks); i++) { - if (STREQ(path, testPathCanonicalizeSymlinks[i][0])) { - *linkpath =3D g_strdup(testPathCanonicalizeSymlinks[i][1]); - - return 0; - } - } - - return 1; -} - - -static int -testPathCanonicalize(const void *args) -{ - const struct testPathCanonicalizeData *data =3D args; - g_autofree char *canon =3D NULL; - - canon =3D virStorageFileCanonicalizePath(data->path, - testPathCanonicalizeReadlink, - NULL); - - if (STRNEQ_NULLABLE(data->expect, canon)) { - fprintf(stderr, - "path canonicalization of '%s' failed: expected '%s' got '= %s'\n", - data->path, NULLSTR(data->expect), NULLSTR(canon)); - - return -1; - } - - return 0; -} - static virStorageSource backingchain[12]; static void @@ -602,7 +546,6 @@ mymain(void) int ret; struct testChainData data; struct testLookupData data2; - struct testPathCanonicalizeData data3; struct testPathRelativeBacking data4; struct testBackingParseData data5; virStorageSourcePtr chain2; /* short for chain->backingStore */ @@ -1086,49 +1029,6 @@ mymain(void) TEST_LOOKUP_TARGET(80, "vda", chain3, "vda[2]", 0, NULL, NULL, NULL); TEST_LOOKUP_TARGET(81, "vda", NULL, "vda[3]", 0, NULL, NULL, NULL); -#define TEST_PATH_CANONICALIZE(id, PATH, EXPECT) \ - do { \ - data3.path =3D PATH; \ - data3.expect =3D EXPECT; \ - if (virTestRun("Path canonicalize " #id, \ - testPathCanonicalize, &data3) < 0) \ - ret =3D -1; \ - } while (0) - - TEST_PATH_CANONICALIZE(1, "/", "/"); - TEST_PATH_CANONICALIZE(2, "/path", "/path"); - TEST_PATH_CANONICALIZE(3, "/path/to/blah", "/path/to/blah"); - TEST_PATH_CANONICALIZE(4, "/path/", "/path"); - TEST_PATH_CANONICALIZE(5, "///////", "/"); - TEST_PATH_CANONICALIZE(6, "//", "//"); - TEST_PATH_CANONICALIZE(7, "", ""); - TEST_PATH_CANONICALIZE(8, ".", "."); - TEST_PATH_CANONICALIZE(9, "../", ".."); - TEST_PATH_CANONICALIZE(10, "../../", "../.."); - TEST_PATH_CANONICALIZE(11, "../../blah", "../../blah"); - TEST_PATH_CANONICALIZE(12, "/./././blah", "/blah"); - TEST_PATH_CANONICALIZE(13, ".././../././../blah", "../../../blah"); - TEST_PATH_CANONICALIZE(14, "/././", "/"); - TEST_PATH_CANONICALIZE(15, "./././", "."); - TEST_PATH_CANONICALIZE(16, "blah/../foo", "foo"); - TEST_PATH_CANONICALIZE(17, "foo/bar/../blah", "foo/blah"); - TEST_PATH_CANONICALIZE(18, "foo/bar/.././blah", "foo/blah"); - TEST_PATH_CANONICALIZE(19, "/path/to/foo/bar/../../../../../../../../b= az", "/baz"); - TEST_PATH_CANONICALIZE(20, "path/to/foo/bar/../../../../../../../../ba= z", "../../../../baz"); - TEST_PATH_CANONICALIZE(21, "path/to/foo/bar", "path/to/foo/bar"); - TEST_PATH_CANONICALIZE(22, "//foo//bar", "//foo/bar"); - TEST_PATH_CANONICALIZE(23, "/bar//foo", "/bar/foo"); - TEST_PATH_CANONICALIZE(24, "//../blah", "//blah"); - - /* test paths with symlinks */ - TEST_PATH_CANONICALIZE(25, "/path/blah", "/other/path/huzah"); - TEST_PATH_CANONICALIZE(26, "/path/to/relative/symlink", "/path/actual/= file"); - TEST_PATH_CANONICALIZE(27, "/path/to/relative/symlink/blah", "/path/ac= tual/file/blah"); - TEST_PATH_CANONICALIZE(28, "/path/blah/yippee", "/other/path/huzah/yip= pee"); - TEST_PATH_CANONICALIZE(29, "/cycle", NULL); - TEST_PATH_CANONICALIZE(30, "/cycle2/link", NULL); - TEST_PATH_CANONICALIZE(31, "///", "/"); - #define TEST_RELATIVE_BACKING(id, TOP, BASE, EXPECT) \ do { \ data4.top =3D &TOP; \ --=20 2.29.2