Clean up and enable more network tests

This commit is contained in:
Ruihan Li
2023-12-25 02:17:17 +08:00
committed by Tate, Hongliang Tian
parent 9a3f95eee2
commit ff7e18b114
3 changed files with 7 additions and 6 deletions

View File

@ -27,7 +27,7 @@ static int new_connected_socket(struct sockaddr_in *addr)
{ {
int sockfd; int sockfd;
sockfd = socket(AF_INET, SOCK_STREAM, 0); sockfd = socket(PF_INET, SOCK_STREAM, 0);
if (sockfd < 0) { if (sockfd < 0) {
perror("new_connected_socket: socket"); perror("new_connected_socket: socket");
return -1; return -1;

View File

@ -31,7 +31,7 @@ static int new_connected_socket(struct sockaddr_in *addr)
{ {
int sockfd; int sockfd;
sockfd = socket(AF_INET, SOCK_STREAM, 0); sockfd = socket(PF_INET, SOCK_STREAM, 0);
if (sockfd < 0) { if (sockfd < 0) {
perror("new_connected_socket: socket"); perror("new_connected_socket: socket");
return -1; return -1;
@ -199,8 +199,7 @@ int test_full_send_buffer(struct sockaddr_in *addr)
// Ensure that the parent executes send() first, then the child // Ensure that the parent executes send() first, then the child
// executes recv(). // executes recv().
for (i = 0; i < 10; ++i) sleep(1);
sched_yield();
fprintf(stderr, "Start receiving...\n"); fprintf(stderr, "Start receiving...\n");
recv_len = receive_all(recvfd); recv_len = receive_all(recvfd);
@ -262,8 +261,6 @@ out_listen:
int main(void) int main(void)
{ {
struct sockaddr_in addr; struct sockaddr_in addr;
int backlog;
int err = 0;
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
addr.sin_port = htons(8080); addr.sin_port = htons(8080);

View File

@ -4,7 +4,9 @@ set -e
NETTEST_DIR=/regression/network NETTEST_DIR=/regression/network
cd ${NETTEST_DIR} cd ${NETTEST_DIR}
echo "Start network test......" echo "Start network test......"
./tcp_server & ./tcp_server &
./tcp_client ./tcp_client
./udp_server & ./udp_server &
@ -12,5 +14,7 @@ echo "Start network test......"
./unix_server & ./unix_server &
./unix_client ./unix_client
./socketpair ./socketpair
./listen_backlog
./send_buf_full
echo "All network test passed" echo "All network test passed"