summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-09-07 09:59:17 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-09-07 09:59:17 +0100
commit8c6a76cd23979f08d8acf1de97945fb48a3a684b (patch)
treecfc6806d8855f8632328c01b468a44774f8ac3db /tests
parent20784087eb875e22cf0021989e61716304b63c84 (diff)
parentc18aaeb69072b74cb0a66e6638fcb14837c7cd3a (diff)
downloadqemu-8c6a76cd23979f08d8acf1de97945fb48a3a684b.zip
Merge remote-tracking branch 'remotes/juanquintela/tags/tests/20170906' into staging
tests/next for 20170906 # gpg: Signature made Wed 06 Sep 2017 12:42:29 BST # gpg: using RSA key 0xF487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" # gpg: aka "Juan Quintela <quintela@trasno.org>" # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * remotes/juanquintela/tags/tests/20170906: tests: Make vmgenid test compile tests: Use real size for iov tests Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-iov.c10
-rw-r--r--tests/vmgenid-test.c4
2 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-iov.c b/tests/test-iov.c
index fa3d75aee1..458ca25099 100644
--- a/tests/test-iov.c
+++ b/tests/test-iov.c
@@ -81,17 +81,17 @@ static void test_to_from_buf_1(void)
* skip whole vector and process exactly 0 bytes */
/* first set bytes [i..sz) to some "random" value */
- n = iov_memset(iov, niov, 0, 0xff, -1);
+ n = iov_memset(iov, niov, 0, 0xff, sz);
g_assert(n == sz);
/* next copy bytes [i..sz) from ibuf to iovec */
- n = iov_from_buf(iov, niov, i, ibuf + i, -1);
+ n = iov_from_buf(iov, niov, i, ibuf + i, sz - i);
g_assert(n == sz - i);
/* clear part of obuf */
memset(obuf + i, 0, sz - i);
/* and set this part of obuf to values from iovec */
- n = iov_to_buf(iov, niov, i, obuf + i, -1);
+ n = iov_to_buf(iov, niov, i, obuf + i, sz - i);
g_assert(n == sz - i);
/* now compare resulting buffers */
@@ -109,7 +109,7 @@ static void test_to_from_buf_1(void)
* with j in [i..sz]. */
/* clear iovec */
- n = iov_memset(iov, niov, 0, 0xff, -1);
+ n = iov_memset(iov, niov, 0, 0xff, sz);
g_assert(n == sz);
/* copy bytes [i..j) from ibuf to iovec */
@@ -225,7 +225,7 @@ static void test_io(void)
for (i = 0; i <= sz; ++i) {
for (j = i; j <= sz; ++j) {
k = i;
- iov_memset(iov, niov, 0, 0xff, -1);
+ iov_memset(iov, niov, 0, 0xff, sz);
do {
s = g_test_rand_int_range(0, j - k + 1);
r = iov_recv(sv[0], iov, niov, k, s);
diff --git a/tests/vmgenid-test.c b/tests/vmgenid-test.c
index 3d5c1c3615..918c82c82a 100644
--- a/tests/vmgenid-test.c
+++ b/tests/vmgenid-test.c
@@ -40,7 +40,7 @@ static uint32_t acpi_find_vgia(void)
AcpiRsdpDescriptor rsdp_table;
uint32_t rsdt;
AcpiRsdtDescriptorRev1 rsdt_table;
- int tables_nr;
+ size_t tables_nr;
uint32_t *tables;
AcpiTableHeader ssdt_table;
VgidTable vgid_table;
@@ -62,9 +62,9 @@ static uint32_t acpi_find_vgia(void)
ACPI_ASSERT_CMP(rsdt_table.signature, "RSDT");
/* compute the table entries in rsdt */
+ g_assert_cmpint(rsdt_table.length, >, sizeof(AcpiRsdtDescriptorRev1));
tables_nr = (rsdt_table.length - sizeof(AcpiRsdtDescriptorRev1)) /
sizeof(uint32_t);
- g_assert_cmpint(tables_nr, >, 0);
/* get the addresses of the tables pointed by rsdt */
tables = g_new0(uint32_t, tables_nr);