mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 18:03:25 +00:00
Make zero reads/writes' behavior right
This commit is contained in:
committed by
Jianfeng Jiang
parent
837f908690
commit
4a9977d9a7
@ -148,10 +148,19 @@ FN_TEST(send)
|
||||
char buf[1] = { 'z' };
|
||||
|
||||
TEST_ERRNO(send(sk_unbound, buf, 1, 0), EPIPE);
|
||||
TEST_ERRNO(send(sk_unbound, buf, 0, 0), EPIPE);
|
||||
TEST_ERRNO(write(sk_unbound, buf, 1), EPIPE);
|
||||
TEST_ERRNO(write(sk_unbound, buf, 0), EPIPE);
|
||||
|
||||
TEST_ERRNO(send(sk_bound, buf, 1, 0), EPIPE);
|
||||
TEST_ERRNO(send(sk_bound, buf, 0, 0), EPIPE);
|
||||
TEST_ERRNO(write(sk_bound, buf, 1), EPIPE);
|
||||
TEST_ERRNO(write(sk_bound, buf, 0), EPIPE);
|
||||
|
||||
TEST_ERRNO(send(sk_listen, buf, 1, 0), EPIPE);
|
||||
TEST_ERRNO(send(sk_listen, buf, 0, 0), EPIPE);
|
||||
TEST_ERRNO(write(sk_listen, buf, 1), EPIPE);
|
||||
TEST_ERRNO(write(sk_listen, buf, 0), EPIPE);
|
||||
}
|
||||
END_TEST()
|
||||
|
||||
@ -160,10 +169,24 @@ FN_TEST(recv)
|
||||
char buf[1] = { 'z' };
|
||||
|
||||
TEST_ERRNO(recv(sk_unbound, buf, 1, 0), ENOTCONN);
|
||||
TEST_ERRNO(recv(sk_unbound, buf, 0, 0), ENOTCONN);
|
||||
TEST_ERRNO(read(sk_unbound, buf, 1), ENOTCONN);
|
||||
TEST_SUCC(read(sk_unbound, buf, 0));
|
||||
|
||||
TEST_ERRNO(recv(sk_bound, buf, 1, 0), ENOTCONN);
|
||||
TEST_ERRNO(recv(sk_bound, buf, 0, 0), ENOTCONN);
|
||||
TEST_ERRNO(read(sk_bound, buf, 1), ENOTCONN);
|
||||
TEST_SUCC(read(sk_bound, buf, 0));
|
||||
|
||||
TEST_ERRNO(recv(sk_listen, buf, 1, 0), ENOTCONN);
|
||||
TEST_ERRNO(recv(sk_listen, buf, 0, 0), ENOTCONN);
|
||||
TEST_ERRNO(read(sk_listen, buf, 1), ENOTCONN);
|
||||
TEST_SUCC(read(sk_listen, buf, 0));
|
||||
|
||||
TEST_ERRNO(recv(sk_connected, buf, 1, 0), EAGAIN);
|
||||
TEST_ERRNO(recv(sk_connected, buf, 0, 0), EAGAIN);
|
||||
TEST_ERRNO(read(sk_connected, buf, 1), EAGAIN);
|
||||
TEST_SUCC(read(sk_connected, buf, 0));
|
||||
}
|
||||
END_TEST()
|
||||
|
||||
|
Reference in New Issue
Block a user