• Home
  • Raw
  • Download

Lines Matching +full:recv +full:- +full:empty

1 // SPDX-License-Identifier: GPL-2.0-only
3 * vsock_test - vsock.ko test suite
36 .svm_cid = opts->peer_cid, in test_stream_connection_reset()
51 if (ret != -1) { in test_stream_connection_reset()
72 .svm_cid = opts->peer_cid, in test_stream_bind_only_client()
90 if (ret != -1) { in test_stream_bind_only_client()
139 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_client_close_client()
160 * -EPIPE error on send. in test_stream_client_close_server()
164 send_byte(fd, -EPIPE, 0); in test_stream_client_close_server()
174 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_server_close_client()
181 * -EPIPE error on send. in test_stream_server_close_client()
185 send_byte(fd, -EPIPE, 0); in test_stream_server_close_client()
216 fds[i] = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_multiconn_client()
269 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_msg_peek_client()
271 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_msg_peek_client()
317 /* Peek from empty socket. */ in test_msg_peek_server()
318 res = recv(fd, buf_peek, sizeof(buf_peek), MSG_PEEK | MSG_DONTWAIT); in test_msg_peek_server()
319 if (res != -1) { in test_msg_peek_server()
320 fprintf(stderr, "expected recv(2) failure, got %zi\n", res); in test_msg_peek_server()
332 res = recv(fd, buf_half, sizeof(buf_half), MSG_PEEK); in test_msg_peek_server()
334 fprintf(stderr, "recv(2) + MSG_PEEK, expected %zu, got %zi\n", in test_msg_peek_server()
340 res = recv(fd, buf_peek, sizeof(buf_peek), MSG_PEEK); in test_msg_peek_server()
342 fprintf(stderr, "recv(2) + MSG_PEEK, expected %zu, got %zi\n", in test_msg_peek_server()
358 res = recv(fd, buf_half, sizeof(buf_half), MSG_PEEK | in test_msg_peek_server()
362 "recv(2) + MSG_PEEK | MSG_TRUNC, exp %zu, got %zi\n", in test_msg_peek_server()
368 res = recv(fd, buf_normal, sizeof(buf_normal), 0); in test_msg_peek_server()
370 fprintf(stderr, "recv(2), expected %zu, got %zi\n", in test_msg_peek_server()
405 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_msg_bounds_client()
428 (rand() % (max_msg_size - page_size)); in test_seqpacket_msg_bounds_client()
467 * broken - two values must be equal. in test_seqpacket_msg_bounds_client()
558 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_msg_trunc_client()
631 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_timeout_client()
640 if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void *)&tv, sizeof(tv)) == -1) { in test_seqpacket_timeout_client()
647 if (read(fd, &dummy, sizeof(dummy)) != -1) { in test_seqpacket_timeout_client()
658 read_overhead_ns = current_nsec() - read_enter_ns - in test_seqpacket_timeout_client()
696 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_bigmsg_client()
717 if (send_size != -1) { in test_seqpacket_bigmsg_client()
760 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_seqpacket_invalid_rec_buffer_client()
813 broken_buf = mmap(NULL, buf_size, prot, flags, -1, 0); in test_seqpacket_invalid_rec_buffer_server()
825 valid_buf = mmap(NULL, buf_size, prot, flags, -1, 0); in test_seqpacket_invalid_rec_buffer_server()
833 if (res != -1) { in test_seqpacket_invalid_rec_buffer_server()
896 for (i = 0; i < RCVLOWAT_BUF_SIZE - 1; i++) in test_stream_poll_rcvlowat_server()
914 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_poll_rcvlowat_client()
965 read_res = recv(fd, buf, sizeof(buf), MSG_DONTWAIT); in test_stream_poll_rcvlowat_client()
967 fprintf(stderr, "Unexpected recv result %zi\n", in test_stream_poll_rcvlowat_client()
986 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_inv_buf_client()
988 fd = vsock_seqpacket_connect(opts->peer_cid, 1234); in test_inv_buf_client()
998 ret = recv(fd, NULL, sizeof(data), 0); in test_inv_buf_client()
999 if (ret != -1) { in test_inv_buf_client()
1000 fprintf(stderr, "expected recv(2) failure, got %zi\n", ret); in test_inv_buf_client()
1005 fprintf(stderr, "unexpected recv(2) errno %d\n", errno); in test_inv_buf_client()
1009 ret = recv(fd, data, sizeof(data), MSG_DONTWAIT); in test_inv_buf_client()
1014 fprintf(stderr, "expected recv(2) success, got %zi\n", ret); in test_inv_buf_client()
1019 /* For SOCK_SEQPACKET socket's queue must be empty. */ in test_inv_buf_client()
1020 if (ret != -1) { in test_inv_buf_client()
1021 fprintf(stderr, "expected recv(2) failure, got %zi\n", ret); in test_inv_buf_client()
1026 fprintf(stderr, "unexpected recv(2) errno %d\n", errno); in test_inv_buf_client()
1093 fd = vsock_stream_connect(opts->peer_cid, 1234); in test_stream_virtio_skb_merge_client()
1139 res = recv(fd, buf, 2, 0); in test_stream_virtio_skb_merge_server()
1141 fprintf(stderr, "expected recv(2) returns 2 bytes, got %zi\n", res); in test_stream_virtio_skb_merge_server()
1148 res = recv(fd, buf + 2, sizeof(buf) - 2, 0); in test_stream_virtio_skb_merge_server()
1150 fprintf(stderr, "expected recv(2) returns 8 bytes, got %zi\n", res); in test_stream_virtio_skb_merge_server()
1154 res = recv(fd, buf, sizeof(buf) - 8 - 2, MSG_DONTWAIT); in test_stream_virtio_skb_merge_server()
1155 if (res != -1) { in test_stream_virtio_skb_merge_server()
1156 fprintf(stderr, "expected recv(2) failure, got %zi\n", res); in test_stream_virtio_skb_merge_server()
1266 .name = "control-host",
1271 .name = "control-port",
1281 .name = "peer-cid",
1305 …rr, "Usage: vsock_test [--help] [--control-host=<host>] --control-port=<port> --mode=client|server… in usage()
1307 " Server: vsock_test --control-port=1234 --mode=server --peer-cid=3\n" in usage()
1308 " Client: vsock_test --control-host=192.168.0.1 --control-port=1234 --mode=client --peer-cid=2\n" in usage()
1311 "and host. One side must use --mode=client and\n" in usage()
1312 "the other side must use --mode=server.\n" in usage()
1319 "The CID of the other side must be given with --peer-cid=<cid>.\n" in usage()
1322 " --help This help message\n" in usage()
1323 " --control-host <host> Server IP address to connect to\n" in usage()
1324 " --control-port <port> Server port to listen on/connect to\n" in usage()
1325 " --mode client|server Server or client mode\n" in usage()
1326 " --peer-cid <cid> CID of the other side\n" in usage()
1327 " --list List of tests that will be executed\n" in usage()
1328 " --skip <test_id> Test ID to skip;\n" in usage()
1329 " use multiple --skip options to skip more tests\n" in usage()
1349 if (opt == -1) in main()
1362 fprintf(stderr, "--mode must be \"client\" or \"server\"\n"); in main()
1376 skip_test(test_cases, ARRAY_SIZE(test_cases) - 1, in main()