84 lines
3.0 KiB
Diff
84 lines
3.0 KiB
Diff
|
From c4b66437f7b829efa0ab6c6007347061ca257719 Mon Sep 17 00:00:00 2001
|
||
|
Message-ID: <c4b66437f7b829efa0ab6c6007347061ca257719.1707394627.git.jdenemar@redhat.com>
|
||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||
|
Date: Wed, 24 Jan 2024 14:55:47 +0100
|
||
|
Subject: [PATCH] tests: virpcivpdtest: Remove 'testVirPCIVPDReadVPDBytes' case
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
The case checks only the 'virPCIVPDReadVPDBytes' which is also tested
|
||
|
multiple times via 'virPCIVPDParse' as it's used to read the data, thus
|
||
|
having a special case for this is pointless.
|
||
|
|
||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||
|
(cherry picked from commit 1a994a9dc6424ff7ea9d0f5d325059ffd234408b)
|
||
|
|
||
|
https://issues.redhat.com/browse/RHEL-22314 [9.4.0]
|
||
|
---
|
||
|
tests/virpcivpdtest.c | 41 -----------------------------------------
|
||
|
1 file changed, 41 deletions(-)
|
||
|
|
||
|
diff --git a/tests/virpcivpdtest.c b/tests/virpcivpdtest.c
|
||
|
index ae5772d3f5..aadd1b222b 100644
|
||
|
--- a/tests/virpcivpdtest.c
|
||
|
+++ b/tests/virpcivpdtest.c
|
||
|
@@ -429,45 +429,6 @@ testPCIVPDGetFieldValueFormat(const void *data G_GNUC_UNUSED)
|
||
|
'Y', 'E', 0x00, \
|
||
|
'R', 'W', 0x02, 0x00, 0x00
|
||
|
|
||
|
-static int
|
||
|
-testVirPCIVPDReadVPDBytes(const void *opaque G_GNUC_UNUSED)
|
||
|
-{
|
||
|
- VIR_AUTOCLOSE fd = -1;
|
||
|
- g_autofree uint8_t *buf = NULL;
|
||
|
- uint8_t csum = 0;
|
||
|
- size_t readBytes = 0;
|
||
|
- size_t dataLen = 0;
|
||
|
-
|
||
|
- /* An example of a valid VPD record with one VPD-R resource and 2 fields. */
|
||
|
- uint8_t fullVPDExample[] = {
|
||
|
- VPD_STRING_RESOURCE_EXAMPLE_HEADER, VPD_STRING_RESOURCE_EXAMPLE_DATA,
|
||
|
- VPD_R_FIELDS_EXAMPLE_HEADER, VPD_R_FIELDS_EXAMPLE_DATA,
|
||
|
- PCI_VPD_RESOURCE_END_VAL
|
||
|
- };
|
||
|
- dataLen = G_N_ELEMENTS(fullVPDExample) - 2;
|
||
|
- buf = g_malloc0(dataLen);
|
||
|
-
|
||
|
- if ((fd = virCreateAnonymousFile(fullVPDExample, dataLen)) < 0)
|
||
|
- return -1;
|
||
|
-
|
||
|
- readBytes = virPCIVPDReadVPDBytes(fd, buf, dataLen, 0, &csum);
|
||
|
-
|
||
|
- if (readBytes != dataLen) {
|
||
|
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||
|
- "The number of bytes read %zu is lower than expected %zu ",
|
||
|
- readBytes, dataLen);
|
||
|
- return -1;
|
||
|
- }
|
||
|
-
|
||
|
- if (csum) {
|
||
|
- virReportError(VIR_ERR_INTERNAL_ERROR,
|
||
|
- "The sum of all VPD bytes up to and including the checksum byte"
|
||
|
- "is equal to zero: 0x%02x", csum);
|
||
|
- return -1;
|
||
|
- }
|
||
|
- return 0;
|
||
|
-}
|
||
|
-
|
||
|
static int
|
||
|
testVirPCIVPDParseVPDStringResource(const void *opaque G_GNUC_UNUSED)
|
||
|
{
|
||
|
@@ -1003,8 +964,6 @@ mymain(void)
|
||
|
if (virTestRun("Determining a field value format by a key ",
|
||
|
testPCIVPDGetFieldValueFormat, NULL) < 0)
|
||
|
ret = -1;
|
||
|
- if (virTestRun("Reading VPD bytes ", testVirPCIVPDReadVPDBytes, NULL) < 0)
|
||
|
- ret = -1;
|
||
|
if (virTestRun("Parsing VPD string resources ", testVirPCIVPDParseVPDStringResource, NULL) < 0)
|
||
|
ret = -1;
|
||
|
if (virTestRun("Parsing a VPD resource with a zero-length RW ",
|
||
|
--
|
||
|
2.43.0
|