aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/e1000e-test.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-12-15 21:39:56 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-12-15 21:39:56 +0000
commit4208e6ae114ac8266dcacc9696a443ce5c37b04e (patch)
tree3fc5202ef86dfdd468ab1f74fa9aaee674a5f729 /tests/qtest/e1000e-test.c
parent29dc49f0310ad4439424eeaf179de46d15bd2d6b (diff)
parent4bf1b66908a21a8271f261fe533e4fe3f416f3e3 (diff)
downloadqemu-4208e6ae114ac8266dcacc9696a443ce5c37b04e.zip
qemu-4208e6ae114ac8266dcacc9696a443ce5c37b04e.tar.gz
qemu-4208e6ae114ac8266dcacc9696a443ce5c37b04e.tar.bz2
Merge tag 'pull-request-2022-12-15' of https://gitlab.com/thuth/qemu into staging
* s390x PCI fixes and improvements (for the ISM device) * Fix emulated MVCP and MVCS s390x instructions * Clean-ups for the e1000e qtest * Enable qtests on Windows * Update FreeBSD CI to version 12.4 * Check --disable-tcg for ppc64 in the CI * Improve scripts/make-releases a little bit * Many other misc small clean-ups and fixes here and there # gpg: Signature made Thu 15 Dec 2022 15:05:44 GMT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * tag 'pull-request-2022-12-15' of https://gitlab.com/thuth/qemu: (23 commits) tests/qtest/vhost-user-blk-test: don't abort all qtests on missing envar .gitlab/issue_templates: Move suggestions into comments gitlab-ci: Check building ppc64 without TCG FreeBSD: Upgrade to 12.4 release tests/qtest: Enable qtest build on Windows .gitlab-ci.d/windows.yml: Exclude qTests from 64-bit CI job for now .gitlab-ci.d/windows.yml: Keep 64-bit and 32-bit build scripts consistent .gitlab-ci.d/windows.yml: Unify the prerequisite packages tests/qtest/libqos/e1000e: Correctly group register accesses tests/qtest/e1000e-test: De-duplicate constants tests/qtest/libqos/e1000e: Remove "other" interrupts hw: Include the VMWare devices only in the x86 targets MAINTAINERS: Add documentation files to the corresponding sections util/oslib-win32: Remove obsolete reference to g_poll code util/qemu-config: Fix "query-command-line-options" to provide the right values scripts/make-release: Only clone single branches to speed up the script scripts/make-release: Add a simple help text for the script monitor/misc: Remove superfluous include statements target/s390x: The MVCP and MVCS instructions are not privileged target/s390x/tcg/mem_helper: Test the right bits in psw_key_valid() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/qtest/e1000e-test.c')
-rw-r--r--tests/qtest/e1000e-test.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/tests/qtest/e1000e-test.c b/tests/qtest/e1000e-test.c
index 08adc52..3fc9204 100644
--- a/tests/qtest/e1000e-test.c
+++ b/tests/qtest/e1000e-test.c
@@ -37,15 +37,15 @@
static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *alloc)
{
+ static const char test[] = "TEST";
struct e1000_tx_desc descr;
- static const int data_len = 64;
char buffer[64];
int ret;
uint32_t recv_len;
/* Prepare test data buffer */
- uint64_t data = guest_alloc(alloc, data_len);
- memwrite(data, "TEST", 5);
+ uint64_t data = guest_alloc(alloc, sizeof(buffer));
+ memwrite(data, test, sizeof(test));
/* Prepare TX descriptor */
memset(&descr, 0, sizeof(descr));
@@ -54,7 +54,7 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
E1000_TXD_CMD_EOP |
E1000_TXD_CMD_DEXT |
E1000_TXD_DTYP_D |
- data_len);
+ sizeof(buffer));
/* Put descriptor to the ring */
e1000e_tx_ring_push(d, &descr);
@@ -69,9 +69,9 @@ static void e1000e_send_verify(QE1000E *d, int *test_sockets, QGuestAllocator *a
/* Check data sent to the backend */
ret = recv(test_sockets[0], &recv_len, sizeof(recv_len), 0);
g_assert_cmpint(ret, == , sizeof(recv_len));
- ret = recv(test_sockets[0], buffer, 64, 0);
- g_assert_cmpint(ret, >=, 5);
- g_assert_cmpstr(buffer, == , "TEST");
+ ret = recv(test_sockets[0], buffer, sizeof(buffer), 0);
+ g_assert_cmpint(ret, ==, sizeof(buffer));
+ g_assert_cmpstr(buffer, == , test);
/* Free test data buffer */
guest_free(alloc, data);
@@ -93,7 +93,6 @@ static void e1000e_receive_verify(QE1000E *d, int *test_sockets, QGuestAllocator
},
};
- static const int data_len = 64;
char buffer[64];
int ret;
@@ -102,7 +101,7 @@ static void e1000e_receive_verify(QE1000E *d, int *test_sockets, QGuestAllocator
g_assert_cmpint(ret, == , sizeof(test) + sizeof(len));
/* Prepare test data buffer */
- uint64_t data = guest_alloc(alloc, data_len);
+ uint64_t data = guest_alloc(alloc, sizeof(buffer));
/* Prepare RX descriptor */
memset(&descr, 0, sizeof(descr));
@@ -120,7 +119,7 @@ static void e1000e_receive_verify(QE1000E *d, int *test_sockets, QGuestAllocator
/* Check data sent to the backend */
memread(data, buffer, sizeof(buffer));
- g_assert_cmpstr(buffer, == , "TEST");
+ g_assert_cmpstr(buffer, == , test);
/* Free test data buffer */
guest_free(alloc, data);