aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/microbit-test.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2022-09-28 17:04:11 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2022-09-28 17:04:11 -0400
commitc8de6ec63d766ca1998c5af468483ce912fdc0c2 (patch)
treea52db66c3f796445b2923ac2d752d497baebab6b /tests/qtest/microbit-test.c
parent36cd0aeac3337af06875e08683380389df48ccd0 (diff)
parent0b49bc1b713d6e3896179f9700c8c35e511075f6 (diff)
Merge tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu into staging
* Fixes for qtests and unit tests to be more portable to non-POSIX platforms # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmMz9MQRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbVUKRAAnubo/wtHqjxg/yVO68odX2LFI2koligA # LcEAnhGkVJ/Pe/+Qo9yVbcOY6k6xfGQU3VIipqvLEwPAdSF0E43EJxlImBNm8/Zq # MggjNoepXRhdFGULONSmSNm7HJykLH/CHdmBjPLrbpkTCwWG1gg64xP9fI+b8mGf # vST0ADuYloLDA9J45UbC33AD+9dQsy2GeOs8X99O6ysKF3htEqMD3vBdqKiJSwgT # 2c7UqySGECn6kMHl7iAdipRNUghSgzpUe8LcH4jP7Y1XnoB3zwC/+VrOVwFESI6y # LVFsC8u7cEKKSYunoowfQTgHvYbCuSdrDqljy17NE5qRMziKMTnhXaQNR5wtBKNt # HZxvc082P/QDFdBYYY3MIjB27r/I6x0t6Xl4IVwLz7bK0xfHFF8Ba2Lr57/2RTc/ # SMPDxGrMicTPnPDU/Cw5VROMmw0OC/tVpJMGo1VjVnNESo581RAMApyzkWiUyfZj # ktKd+4ihmqrBXcZHVjKbIufa6eKNuktlkfv72dnJY4XoUlDHlbDYaVuknybZmxWK # 9/CDVDG72s5Cqm+M47Q56IagVVZwIGrUP0u3j3h/v0rnHZehY8Qzr3SLEfeqmUb6 # nP7MP+ItZFZtMITdvXb3OtyeVuM0ZSw8kt+/evpvC9zB6FjgYl/e5FppsO0HxB/O # PeeV43Bk270= # =n+FM # -----END PGP SIGNATURE----- # gpg: Signature made Wed 28 Sep 2022 03:16:20 EDT # 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-09-28' of https://gitlab.com/thuth/qemu: (37 commits) docs/devel: testing: Document writing portable test cases tests/qtest: boot-serial-test: Close the serial file before starting QEMU tests/qtest: vhost-user-test: Avoid using hardcoded /tmp tests/qtest: qmp-test: Avoid using hardcoded /tmp tests/qtest: pflash-cfi02-test: Avoid using hardcoded /tmp tests/qtest: hd-geo-test: Avoid using hardcoded /tmp tests/x86: Move common code to function in device-plug-test .gitlab-ci.d/windows.yml: Display meson test logs tests/qtest: migration-test: Skip running some TLS cases for win32 tests/qtest: libqtest: Replace the call to close a socket with closesocket() tests/qtest: microbit-test: Fix socket access for win32 tests/qtest: virtio-net-failover: Disable migration tests for win32 tests/qtest: ide-test: Open file in binary mode tests/qtest: migration-test: Disable IO redirection for win32 tests/qtest: bios-tables-test: Adapt the case for win32 tests/qtest: {ahci, ide}-test: Use relative path for temporary files for win32 tests/qtest: libqtest: Exclude the *_fds APIs for win32 tests/qtest: libqtest: Adapt global_qtest declaration for win32 tests/qtest: qmp-test: Skip running test_qmp_oob for win32 tests/qtest: Build test-filter-{mirror, redirector} cases for posix only ... Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tests/qtest/microbit-test.c')
-rw-r--r--tests/qtest/microbit-test.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/qtest/microbit-test.c b/tests/qtest/microbit-test.c
index b71daae9a9..4bc267020b 100644
--- a/tests/qtest/microbit-test.c
+++ b/tests/qtest/microbit-test.c
@@ -51,7 +51,7 @@ static void uart_rw_to_rxd(QTestState *qts, int sock_fd, const char *in,
{
int i, in_len = strlen(in);
- g_assert_true(write(sock_fd, in, in_len) == in_len);
+ g_assert_true(send(sock_fd, in, in_len, 0) == in_len);
for (i = 0; i < in_len; i++) {
g_assert_true(uart_wait_for_event(qts, NRF51_UART_BASE +
A_UART_RXDRDY));
@@ -77,7 +77,7 @@ static void test_nrf51_uart(void)
char s[10];
QTestState *qts = qtest_init_with_serial("-M microbit", &sock_fd);
- g_assert_true(write(sock_fd, "c", 1) == 1);
+ g_assert_true(send(sock_fd, "c", 1, 0) == 1);
g_assert_cmphex(qtest_readl(qts, NRF51_UART_BASE + A_UART_RXD), ==, 0x00);
qtest_writel(qts, NRF51_UART_BASE + A_UART_ENABLE, 0x04);
@@ -97,17 +97,17 @@ static void test_nrf51_uart(void)
qtest_writel(qts, NRF51_UART_BASE + A_UART_STARTTX, 0x01);
uart_w_to_txd(qts, "d");
- g_assert_true(read(sock_fd, s, 10) == 1);
+ g_assert_true(recv(sock_fd, s, 10, 0) == 1);
g_assert_cmphex(s[0], ==, 'd');
qtest_writel(qts, NRF51_UART_BASE + A_UART_SUSPEND, 0x01);
qtest_writel(qts, NRF51_UART_BASE + A_UART_TXD, 'h');
qtest_writel(qts, NRF51_UART_BASE + A_UART_STARTTX, 0x01);
uart_w_to_txd(qts, "world");
- g_assert_true(read(sock_fd, s, 10) == 5);
+ g_assert_true(recv(sock_fd, s, 10, 0) == 5);
g_assert_true(memcmp(s, "world", 5) == 0);
- close(sock_fd);
+ closesocket(sock_fd);
qtest_quit(qts);
}