From nobody Sun Feb 8 23:05:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1631177387; cv=none; d=zohomail.com; s=zohoarc; b=OnOqXQkeK+yNCLQK81VlgWtJttsp3vreXYEBOg6+cWRAB/S/XPsDz5ifqAOjyHhqmWmF0PXg3Jm1tXPEcYUbueijoSqCh2m8K3BEQmIO48c/hgdbtXxvvgTR8mXNbjtYIHZlSdXwbkon0hKnuZ9NqDPphI7ObQy3FlsPIYOmnzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1631177387; 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=H4uVb6zEivz+AApl9Gpmwbm3NHcUtUu875g/q0UghD8=; b=bIMUIdAC1wioN+8Gx4rxDylK+IzrDpnr+KpMOPCGzPIZWqqFG+D3COsTgXkJvigFe94P//23JXa6Iwi0V0SaEVGG9lcPn/r5JKnwvu3dYsMR54EacShRbD38fYSceYdRT8qAIQV3ikJf59RLa/qQTqGEgXwIk9IZVHOpO4cAm0k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1631177387023479.8743803923019; Thu, 9 Sep 2021 01:49:47 -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-314-kZ9yKMG6O0WxkBg9NBz3ng-1; Thu, 09 Sep 2021 04:49:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 66BDC1835ACF; Thu, 9 Sep 2021 08:49:38 +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 48B1B6A907; Thu, 9 Sep 2021 08:49:38 +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 192BC1800FE4; Thu, 9 Sep 2021 08:49:38 +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 1898nYSi030077 for ; Thu, 9 Sep 2021 04:49:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 70E5026DF9; Thu, 9 Sep 2021 08:49:34 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EF6419736 for ; Thu, 9 Sep 2021 08:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631177386; 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=H4uVb6zEivz+AApl9Gpmwbm3NHcUtUu875g/q0UghD8=; b=atnBggSLeVYisO6cy4/uzqRHvXpnMXZMx6tYvHu3h+6MtorYjH4ShBYrL0iprsN+6WSDl1 csW7YYTSoEppz1tKlK4dQFmoPITRuXh7E4bBw9wWMVgbBkJL8MLTTCSfVOjV9AzkShSTQw hStDacHiG0QYHk4dGwxLUxgQpsSUMOg= X-MC-Unique: kZ9yKMG6O0WxkBg9NBz3ng-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/24] virstoragetest: Store output of TEST_CHAIN in output files Date: Thu, 9 Sep 2021 10:49:04 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.15 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) X-ZM-MESSAGEID: 1631177389218100002 Content-Type: text/plain; charset="utf-8" The TEST_CHAIN cases were storing the expected output (or rather data to generate the expected output) in code. This made the code really hard to follow and even harder to modify to add new cases. This patch modifies the code to store the expected output in text files (using the same generator as we've used to) and uses 'virTestCompareToFile' to check the outputs. The result is that the code is way simpler and doesn't require fiddling with 'testFileData' structs when adding new cases. Additionally this removes mixing of code and declaration so we can stop disabling the warning for this file. Another advantage is that the tests are now named so it's easier to figure out if one of them breaks. Signed-off-by: Peter Krempa --- tests/virstoragetest.c | 252 ++++-------------- tests/virstoragetestdata/out/directory-dir | 9 + tests/virstoragetestdata/out/directory-none | 9 + tests/virstoragetestdata/out/directory-raw | 9 + .../virstoragetestdata/out/qcow2-auto_raw-raw | 9 + .../out/qcow2-auto_raw-raw-relative | 9 + .../out/qcow2-qcow2_nbd-raw | 19 ++ .../out/qcow2-qcow2_qcow2-qcow2_raw-raw | 29 ++ .../out/qcow2-qcow2_raw-raw | 19 ++ .../out/qcow2-qcow2_raw-raw-relative | 19 ++ tests/virstoragetestdata/out/qcow2-symlinks | 29 ++ tests/virstoragetestdata/out/qed-auto_raw | 9 + tests/virstoragetestdata/out/qed-qed_raw | 19 ++ tests/virstoragetestdata/out/raw-auto | 9 + tests/virstoragetestdata/out/raw-raw | 9 + 15 files changed, 263 insertions(+), 195 deletions(-) create mode 100644 tests/virstoragetestdata/out/directory-dir create mode 100644 tests/virstoragetestdata/out/directory-none create mode 100644 tests/virstoragetestdata/out/directory-raw create mode 100644 tests/virstoragetestdata/out/qcow2-auto_raw-raw create mode 100644 tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_ra= w-raw create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_raw-raw create mode 100644 tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relati= ve create mode 100644 tests/virstoragetestdata/out/qcow2-symlinks create mode 100644 tests/virstoragetestdata/out/qed-auto_raw create mode 100644 tests/virstoragetestdata/out/qed-qed_raw create mode 100644 tests/virstoragetestdata/out/raw-auto create mode 100644 tests/virstoragetestdata/out/raw-raw diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index f6af1a17ac..4f4fd4e824 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -218,26 +218,6 @@ testPrepImages(void) goto cleanup; } -/* Many fields of virStorageFileMetadata have the same content whether - * we access the file relatively or absolutely; but file names differ - * depending on how the chain was opened. For ease of testing, we - * test both relative and absolute starts, and use a flag to say which - * of the two variations to compare against. */ -typedef struct _testFileData testFileData; -struct _testFileData -{ - const char *expBackingStoreRaw; - unsigned long long expCapacity; - bool expEncrypted; - const char *pathRel; - const char *path; - int type; - int format; - const char *secret; - const char *hostname; - int protocol; -}; - enum { EXP_PASS =3D 0, EXP_FAIL =3D 1, @@ -245,33 +225,23 @@ enum { struct testChainData { + const char *testname; const char *start; virStorageFileFormat format; - const testFileData *files[4]; - int nfiles; unsigned int flags; }; -static const char testStorageChainFormat[] =3D - "chain member: %zu\n" - "path:%s\n" - "backingStoreRaw: %s\n" - "capacity: %lld\n" - "encryption: %d\n" - "relPath:%s\n" - "type:%d\n" - "format:%d\n" - "protocol:%s\n" - "hostname:%s\n"; - static int testStorageChain(const void *args) { const struct testChainData *data =3D args; virStorageSource *elt; - size_t i =3D 0; g_autoptr(virStorageSource) meta =3D NULL; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + g_autofree char *actual =3D NULL; + g_autofree char *expectpath =3D g_strdup_printf("%s/virstoragetestdata= /out/%s", + abs_srcdir, data->testna= me); meta =3D testStorageFileGetMetadata(data->start, data->format, -1, -1); if (!meta) { @@ -290,47 +260,38 @@ testStorageChain(const void *args) return -1; } - elt =3D meta; - while (virStorageSourceIsBacking(elt)) { - g_autofree char *expect =3D NULL; - g_autofree char *actual =3D NULL; + for (elt =3D meta; virStorageSourceIsBacking(elt); elt =3D elt->backin= gStore) { + g_autofree char *strippedPath =3D virTestStablePath(elt->path); + g_autofree char *strippedBackingStoreRaw =3D virTestStablePath(elt= ->backingStoreRaw); + g_autofree char *strippedRelPath =3D virTestStablePath(elt->relPat= h); + + virBufferAsprintf(&buf, + "path:%s\n" + "backingStoreRaw: %s\n" + "capacity: %lld\n" + "encryption: %d\n" + "relPath:%s\n" + "type:%d\n" + "format:%d\n" + "protocol:%s\n" + "hostname:%s\n\n", + strippedPath, + strippedBackingStoreRaw, + elt->capacity, + !!elt->encryption, + strippedRelPath, + elt->type, + elt->format, + virStorageNetProtocolTypeToString(elt->protocol), + NULLSTR(elt->nhosts ? elt->hosts[0].name : NULL)= ); + } - if (i =3D=3D data->nfiles) { - fprintf(stderr, "probed chain was too long\n"); - return -1; - } + virBufferTrim(&buf, "\n"); - expect =3D g_strdup_printf(testStorageChainFormat, i, - NULLSTR(data->files[i]->path), - NULLSTR(data->files[i]->expBackingStoreRa= w), - data->files[i]->expCapacity, - data->files[i]->expEncrypted, - NULLSTR(data->files[i]->pathRel), - data->files[i]->type, - data->files[i]->format, - virStorageNetProtocolTypeToString(data->f= iles[i]->protocol), - NULLSTR(data->files[i]->hostname)); - actual =3D g_strdup_printf(testStorageChainFormat, i, - NULLSTR(elt->path), - NULLSTR(elt->backingStoreRaw), - elt->capacity, - !!elt->encryption, - NULLSTR(elt->relPath), - elt->type, - elt->format, - virStorageNetProtocolTypeToString(elt->pr= otocol), - NULLSTR(elt->nhosts ? elt->hosts[0].name = : NULL)); - if (STRNEQ(expect, actual)) { - virTestDifference(stderr, expect, actual); - return -1; - } - elt =3D elt->backingStore; - i++; - } - if (i !=3D data->nfiles) { - fprintf(stderr, "probed chain was too short\n"); + actual =3D virBufferContentAndReset(&buf); + + if (virTestCompareToFile(actual, expectpath) < 0) return -1; - } return 0; } @@ -561,59 +522,23 @@ mymain(void) if ((ret =3D testPrepImages()) !=3D 0) return ret; -#define TEST_ONE_CHAIN(start, format, flags, ...) \ +#define TEST_CHAIN(testname, start, format, flags) \ do { \ - size_t i; \ - memset(&data, 0, sizeof(data)); \ - data =3D (struct testChainData){ \ - start, format, { __VA_ARGS__ }, 0, flags, \ - }; \ - for (i =3D 0; i < G_N_ELEMENTS(data.files); i++) \ - if (data.files[i]) \ - data.nfiles++; \ - if (virTestRun(virTestCounterNext(), \ - testStorageChain, &data) < 0) \ + data =3D (struct testChainData){ testname, start, format, flags };= \ + if (virTestRun(testname, testStorageChain, &data) < 0) \ ret =3D -1; \ } while (0) -#define VIR_FLATTEN_2(...) __VA_ARGS__ -#define VIR_FLATTEN_1(_1) VIR_FLATTEN_2 _1 - -#define TEST_CHAIN(path, format, chain, flags) \ - TEST_ONE_CHAIN(path, format, flags, VIR_FLATTEN_1(chain)); - - /* The actual tests, in several groups. */ - virTestCounterReset("Storage backing chain "); - /* Missing file */ - TEST_ONE_CHAIN("bogus", VIR_STORAGE_FILE_RAW, EXP_FAIL); + TEST_CHAIN("missing", "bogus", VIR_STORAGE_FILE_RAW, EXP_FAIL); - VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT /* Raw image, whether with right format or no specified format */ - testFileData raw =3D { - .path =3D absraw, - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_RAW, - }; - TEST_CHAIN(absraw, VIR_STORAGE_FILE_RAW, (&raw), EXP_PASS); - TEST_CHAIN(absraw, VIR_STORAGE_FILE_AUTO, (&raw), EXP_PASS); + TEST_CHAIN("raw-raw", absraw, VIR_STORAGE_FILE_RAW, EXP_PASS); + TEST_CHAIN("raw-auto", absraw, VIR_STORAGE_FILE_AUTO, EXP_PASS); /* Qcow2 file with relative raw backing, format provided */ - raw.pathRel =3D "raw"; - testFileData qcow2 =3D { - .expBackingStoreRaw =3D "raw", - .expCapacity =3D 1024, - .path =3D absqcow2, - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_QCOW2, - }; - testFileData qcow2_as_raw =3D { - .path =3D absqcow2, - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_RAW, - }; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &raw), EXP_PASS); - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS); + TEST_CHAIN("qcow2-qcow2_raw-raw-relative", absqcow2, VIR_STORAGE_FILE_= QCOW2, EXP_PASS); + TEST_CHAIN("qcow2-auto_raw-raw-relative", absqcow2, VIR_STORAGE_FILE_A= UTO, EXP_PASS); /* Rewrite qcow2 file to use absolute backing name */ virCommandFree(cmd); @@ -621,22 +546,13 @@ mymain(void) "-F", "raw", "-b", absraw, "qcow2", NULL); if (virCommandRun(cmd, NULL) < 0) ret =3D -1; - qcow2.expBackingStoreRaw =3D absraw; - raw.pathRel =3D NULL; /* Qcow2 file with raw as absolute backing, backing format provided */ - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &raw), EXP_PASS); - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_AUTO, (&qcow2_as_raw), EXP_PASS); - - /* Wrapped file access */ - testFileData wrap =3D { - .expBackingStoreRaw =3D absqcow2, - .expCapacity =3D 1024, - .path =3D abswrap, - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_QCOW2, - }; - TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap, &qcow2, &raw), EXP= _PASS); + TEST_CHAIN("qcow2-qcow2_raw-raw", absqcow2, VIR_STORAGE_FILE_QCOW2, EX= P_PASS); + TEST_CHAIN("qcow2-auto_raw-raw", absqcow2, VIR_STORAGE_FILE_AUTO, EXP_= PASS); + + /* qcow2 with a longer backing chain */ + TEST_CHAIN("qcow2-qcow2_qcow2-qcow2_raw-raw", abswrap, VIR_STORAGE_FIL= E_QCOW2, EXP_PASS); /* Rewrite qcow2 to a missing backing file, with backing type */ virCommandFree(cmd); @@ -645,10 +561,9 @@ mymain(void) "qcow2", NULL); if (virCommandRun(cmd, NULL) < 0) ret =3D -1; - qcow2.expBackingStoreRaw =3D datadir "/bogus"; /* Qcow2 file with missing backing file but specified type */ - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_FAIL); + TEST_CHAIN("qcow2-qcow2_missing", absqcow2, VIR_STORAGE_FILE_QCOW2, EX= P_FAIL); /* Rewrite qcow2 to use an nbd: protocol as backend */ @@ -658,48 +573,18 @@ mymain(void) "qcow2", NULL); if (virCommandRun(cmd, NULL) < 0) ret =3D -1; - qcow2.expBackingStoreRaw =3D "nbd+tcp://example.org:6000/blah"; /* Qcow2 file with backing protocol instead of file */ - testFileData nbd2 =3D { - .path =3D "blah", - .type =3D VIR_STORAGE_TYPE_NETWORK, - .format =3D VIR_STORAGE_FILE_RAW, - .protocol =3D VIR_STORAGE_NET_PROTOCOL_NBD, - .hostname =3D "example.org", - }; - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &nbd2), EXP_PASS= ); + TEST_CHAIN("qcow2-qcow2_nbd-raw", absqcow2, VIR_STORAGE_FILE_QCOW2, EX= P_PASS); /* qed file */ - testFileData qed =3D { - .expBackingStoreRaw =3D absraw, - .expCapacity =3D 1024, - .path =3D absqed, - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_QED, - }; - testFileData qed_as_raw =3D { - .path =3D absqed, - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_RAW, - }; - TEST_CHAIN(absqed, VIR_STORAGE_FILE_QED, (&qed, &raw), EXP_PASS); - TEST_CHAIN(absqed, VIR_STORAGE_FILE_AUTO, (&qed_as_raw), EXP_PASS); + TEST_CHAIN("qed-qed_raw", absqed, VIR_STORAGE_FILE_QED, EXP_PASS); + TEST_CHAIN("qed-auto_raw", absqed, VIR_STORAGE_FILE_AUTO, EXP_PASS); /* directory */ - testFileData dir =3D { - .path =3D absdir, - .type =3D VIR_STORAGE_TYPE_DIR, - .format =3D VIR_STORAGE_FILE_DIR, - }; - testFileData dir_as_raw =3D { - .path =3D absdir, - .type =3D VIR_STORAGE_TYPE_DIR, - .format =3D VIR_STORAGE_FILE_RAW, - }; - TEST_CHAIN(absdir, VIR_STORAGE_FILE_RAW, (&dir_as_raw), EXP_PASS); - TEST_CHAIN(absdir, VIR_STORAGE_FILE_NONE, (&dir), EXP_PASS); - TEST_CHAIN(absdir, VIR_STORAGE_FILE_DIR, (&dir), EXP_PASS); + TEST_CHAIN("directory-raw", absdir, VIR_STORAGE_FILE_RAW, EXP_PASS); + TEST_CHAIN("directory-none", absdir, VIR_STORAGE_FILE_NONE, EXP_PASS); + TEST_CHAIN("directory-dir", absdir, VIR_STORAGE_FILE_DIR, EXP_PASS); #ifdef WITH_SYMLINK /* Rewrite qcow2 and wrap file to use backing names relative to a @@ -718,26 +603,7 @@ mymain(void) ret =3D -1; /* Behavior of symlinks to qcow2 with relative backing files */ - testFileData link1 =3D { - .expBackingStoreRaw =3D "../raw", - .expCapacity =3D 1024, - .pathRel =3D "../sub/link1", - .path =3D datadir "/sub/../sub/link1", - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_QCOW2, - }; - testFileData link2 =3D { - .expBackingStoreRaw =3D "../sub/link1", - .expCapacity =3D 1024, - .path =3D abslink2, - .type =3D VIR_STORAGE_TYPE_FILE, - .format =3D VIR_STORAGE_FILE_QCOW2, - }; - - raw.path =3D datadir "/sub/../sub/../raw"; - raw.pathRel =3D "../raw"; - TEST_CHAIN(abslink2, VIR_STORAGE_FILE_QCOW2, - (&link2, &link1, &raw), EXP_PASS); + TEST_CHAIN("qcow2-symlinks", abslink2, VIR_STORAGE_FILE_QCOW2, EXP_PAS= S); #endif /* Rewrite qcow2 to be a self-referential loop */ @@ -746,10 +612,9 @@ mymain(void) "-F", "qcow2", "-b", "qcow2", "qcow2", NULL= ); if (virCommandRun(cmd, NULL) < 0) ret =3D -1; - qcow2.expBackingStoreRaw =3D "qcow2"; /* Behavior of an infinite loop chain */ - TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2), EXP_FAIL); + TEST_CHAIN("qcow2-qcow2_infinite-self", absqcow2, VIR_STORAGE_FILE_QCO= W2, EXP_FAIL); /* Rewrite wrap and qcow2 to be mutually-referential loop */ virCommandFree(cmd); @@ -763,12 +628,9 @@ mymain(void) "-F", "qcow2", "-b", absqcow2, "wrap", NULL= ); if (virCommandRun(cmd, NULL) < 0) ret =3D -1; - qcow2.expBackingStoreRaw =3D "wrap"; /* Behavior of an infinite loop chain */ - TEST_CHAIN(abswrap, VIR_STORAGE_FILE_QCOW2, (&wrap, &qcow2), EXP_FAIL); - - VIR_WARNINGS_RESET + TEST_CHAIN("qcow2-qcow2_infinite-mutual", abswrap, VIR_STORAGE_FILE_QC= OW2, EXP_FAIL); /* Rewrite wrap and qcow2 back to 3-deep chain, absolute backing */ virCommandFree(cmd); diff --git a/tests/virstoragetestdata/out/directory-dir b/tests/virstoraget= estdata/out/directory-dir new file mode 100644 index 0000000000..cff67595b4 --- /dev/null +++ b/tests/virstoragetestdata/out/directory-dir @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/dir +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:3 +format:2 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/directory-none b/tests/virstorage= testdata/out/directory-none new file mode 100644 index 0000000000..cff67595b4 --- /dev/null +++ b/tests/virstoragetestdata/out/directory-none @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/dir +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:3 +format:2 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/directory-raw b/tests/virstoraget= estdata/out/directory-raw new file mode 100644 index 0000000000..ebe23cbbd6 --- /dev/null +++ b/tests/virstoragetestdata/out/directory-raw @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/dir +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:3 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qcow2-auto_raw-raw b/tests/virsto= ragetestdata/out/qcow2-auto_raw-raw new file mode 100644 index 0000000000..4a01b24589 --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-auto_raw-raw @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/qcow2 +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative b/tes= ts/virstoragetestdata/out/qcow2-auto_raw-raw-relative new file mode 100644 index 0000000000..4a01b24589 --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-auto_raw-raw-relative @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/qcow2 +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw b/tests/virst= oragetestdata/out/qcow2-qcow2_nbd-raw new file mode 100644 index 0000000000..64acdb880a --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-qcow2_nbd-raw @@ -0,0 +1,19 @@ +path:ABS_BUILDDIR/virstoragedata/qcow2 +backingStoreRaw: nbd+tcp://example.org:6000/blah +capacity: 1024 +encryption: 0 +relPath: +type:1 +format:14 +protocol:none +hostname: + +path:blah +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:4 +format:1 +protocol:nbd +hostname:example.org diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw b= /tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw new file mode 100644 index 0000000000..5f93fe746b --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-qcow2_qcow2-qcow2_raw-raw @@ -0,0 +1,29 @@ +path:ABS_BUILDDIR/virstoragedata/wrap +backingStoreRaw: ABS_BUILDDIR/virstoragedata/qcow2 +capacity: 1024 +encryption: 0 +relPath: +type:1 +format:14 +protocol:none +hostname: + +path:ABS_BUILDDIR/virstoragedata/qcow2 +backingStoreRaw: ABS_BUILDDIR/virstoragedata/raw +capacity: 1024 +encryption: 0 +relPath: +type:1 +format:14 +protocol:none +hostname: + +path:ABS_BUILDDIR/virstoragedata/raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw b/tests/virst= oragetestdata/out/qcow2-qcow2_raw-raw new file mode 100644 index 0000000000..57ce62a376 --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw @@ -0,0 +1,19 @@ +path:ABS_BUILDDIR/virstoragedata/qcow2 +backingStoreRaw: ABS_BUILDDIR/virstoragedata/raw +capacity: 1024 +encryption: 0 +relPath: +type:1 +format:14 +protocol:none +hostname: + +path:ABS_BUILDDIR/virstoragedata/raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative b/te= sts/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative new file mode 100644 index 0000000000..a1fb142e98 --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-qcow2_raw-raw-relative @@ -0,0 +1,19 @@ +path:ABS_BUILDDIR/virstoragedata/qcow2 +backingStoreRaw: raw +capacity: 1024 +encryption: 0 +relPath: +type:1 +format:14 +protocol:none +hostname: + +path:ABS_BUILDDIR/virstoragedata/raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath:raw +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qcow2-symlinks b/tests/virstorage= testdata/out/qcow2-symlinks new file mode 100644 index 0000000000..ed37f61e9f --- /dev/null +++ b/tests/virstoragetestdata/out/qcow2-symlinks @@ -0,0 +1,29 @@ +path:ABS_BUILDDIR/virstoragedata/sub/link2 +backingStoreRaw: ../sub/link1 +capacity: 1024 +encryption: 0 +relPath: +type:1 +format:14 +protocol:none +hostname: + +path:ABS_BUILDDIR/virstoragedata/sub/../sub/link1 +backingStoreRaw: ../raw +capacity: 1024 +encryption: 0 +relPath:../sub/link1 +type:1 +format:14 +protocol:none +hostname: + +path:ABS_BUILDDIR/virstoragedata/sub/../sub/../raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath:../raw +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qed-auto_raw b/tests/virstoragete= stdata/out/qed-auto_raw new file mode 100644 index 0000000000..e8ab498038 --- /dev/null +++ b/tests/virstoragetestdata/out/qed-auto_raw @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/qed +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/qed-qed_raw b/tests/virstoragetes= tdata/out/qed-qed_raw new file mode 100644 index 0000000000..70a75c4e37 --- /dev/null +++ b/tests/virstoragetestdata/out/qed-qed_raw @@ -0,0 +1,19 @@ +path:ABS_BUILDDIR/virstoragedata/qed +backingStoreRaw: ABS_BUILDDIR/virstoragedata/raw +capacity: 1024 +encryption: 0 +relPath: +type:1 +format:15 +protocol:none +hostname: + +path:ABS_BUILDDIR/virstoragedata/raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/raw-auto b/tests/virstoragetestda= ta/out/raw-auto new file mode 100644 index 0000000000..8d6c525896 --- /dev/null +++ b/tests/virstoragetestdata/out/raw-auto @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: diff --git a/tests/virstoragetestdata/out/raw-raw b/tests/virstoragetestdat= a/out/raw-raw new file mode 100644 index 0000000000..8d6c525896 --- /dev/null +++ b/tests/virstoragetestdata/out/raw-raw @@ -0,0 +1,9 @@ +path:ABS_BUILDDIR/virstoragedata/raw +backingStoreRaw: +capacity: 0 +encryption: 0 +relPath: +type:1 +format:1 +protocol:none +hostname: --=20 2.31.1