mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-20 21:36:31 +00:00
Resolve compiler warnings for regression tests
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
42881bcdaa
commit
dede22843a
@ -5,7 +5,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sched.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -196,7 +195,6 @@ int test_full_send_buffer(struct sockaddr_in *addr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
int i;
|
|
||||||
ssize_t recv_len;
|
ssize_t recv_len;
|
||||||
|
|
||||||
// Ensure that the parent executes send() first, then the child
|
// Ensure that the parent executes send() first, then the child
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int sock = 0, valread;
|
int sock = 0;
|
||||||
struct sockaddr_in serv_addr;
|
struct sockaddr_in serv_addr;
|
||||||
char *hello = "Hello from client";
|
char *hello = "Hello from client";
|
||||||
char buffer[1024] = { 0 };
|
char buffer[1024] = { 0 };
|
||||||
@ -40,7 +40,7 @@ int main()
|
|||||||
// Send message to the server and receive the reply
|
// Send message to the server and receive the reply
|
||||||
send(sock, hello, strlen(hello), 0);
|
send(sock, hello, strlen(hello), 0);
|
||||||
printf("Hello message sent\n");
|
printf("Hello message sent\n");
|
||||||
valread = read(sock, buffer, 1024);
|
read(sock, buffer, 1024);
|
||||||
printf("Server: %s\n", buffer);
|
printf("Server: %s\n", buffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int server_fd, new_socket, valread;
|
int server_fd, new_socket;
|
||||||
struct sockaddr_in address;
|
struct sockaddr_in address;
|
||||||
int opt = 1;
|
int opt = 1;
|
||||||
int addrlen = sizeof(address);
|
int addrlen = sizeof(address);
|
||||||
@ -60,7 +60,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the message from the client and reply
|
// Read the message from the client and reply
|
||||||
valread = read(new_socket, buffer, 1024);
|
read(new_socket, buffer, 1024);
|
||||||
printf("Client: %s\n", buffer);
|
printf("Client: %s\n", buffer);
|
||||||
send(new_socket, hello, strlen(hello), 0);
|
send(new_socket, hello, strlen(hello), 0);
|
||||||
printf("Hello message sent\n");
|
printf("Hello message sent\n");
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int client_fd, len;
|
int client_fd;
|
||||||
struct sockaddr_un server_addr, peer_addr;
|
struct sockaddr_un server_addr, peer_addr;
|
||||||
char buf[BUFFER_SIZE];
|
char buf[BUFFER_SIZE];
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ int main()
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int addrlen = sizeof(peer_addr);
|
socklen_t addrlen = sizeof(peer_addr);
|
||||||
int rc =
|
int rc =
|
||||||
getpeername(client_fd, (struct sockaddr *)&peer_addr, &addrlen);
|
getpeername(client_fd, (struct sockaddr *)&peer_addr, &addrlen);
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int server_fd, accepted_fd, len;
|
int server_fd, accepted_fd;
|
||||||
struct sockaddr_un server_addr, client_addr;
|
struct sockaddr_un server_addr, client_addr;
|
||||||
char buf[BUFFER_SIZE];
|
char buf[BUFFER_SIZE];
|
||||||
|
|
||||||
@ -45,14 +45,14 @@ int main()
|
|||||||
printf("Server is listening...\n");
|
printf("Server is listening...\n");
|
||||||
|
|
||||||
// Accept the incoming connection
|
// Accept the incoming connection
|
||||||
len = sizeof(client_addr);
|
socklen_t len = sizeof(client_addr);
|
||||||
accepted_fd = accept(server_fd, (struct sockaddr *)&client_addr, &len);
|
accepted_fd = accept(server_fd, (struct sockaddr *)&client_addr, &len);
|
||||||
if (accepted_fd == -1) {
|
if (accepted_fd == -1) {
|
||||||
perror("accept");
|
perror("accept");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int addrlen = sizeof(client_addr);
|
socklen_t addrlen = sizeof(client_addr);
|
||||||
int rc = getpeername(accepted_fd, (struct sockaddr *)&client_addr,
|
int rc = getpeername(accepted_fd, (struct sockaddr *)&client_addr,
|
||||||
&addrlen);
|
&addrlen);
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
|
@ -292,6 +292,7 @@ int main()
|
|||||||
{
|
{
|
||||||
test_mutex_with_concurrent_counter();
|
test_mutex_with_concurrent_counter();
|
||||||
test_robust_mutex_with_concurrent_counter();
|
test_robust_mutex_with_concurrent_counter();
|
||||||
// test_mutex_with_cond_wait();
|
// FIXME: Add the `test_mutex_with_cond_wait` test back.
|
||||||
|
(void)test_mutex_with_cond_wait;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -193,6 +193,7 @@ int test_handle_sigfpe()
|
|||||||
volatile int c;
|
volatile int c;
|
||||||
fxsave(x);
|
fxsave(x);
|
||||||
c = div_maybe_zero(a, b);
|
c = div_maybe_zero(a, b);
|
||||||
|
(void)c;
|
||||||
fxsave(y);
|
fxsave(y);
|
||||||
|
|
||||||
// Asterinas does not save and restore fpregs now, so we emit this check.
|
// Asterinas does not save and restore fpregs now, so we emit this check.
|
||||||
|
@ -13,7 +13,7 @@ C_DEPS := $(addprefix $(DEP_OUTPUT_DIR)/,$(C_SRCS:%.c=%.d))
|
|||||||
ASM_SRCS := $(wildcard *.s)
|
ASM_SRCS := $(wildcard *.s)
|
||||||
ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_SRCS:%.s=%))
|
ASM_OBJS := $(addprefix $(OBJ_OUTPUT_DIR)/,$(ASM_SRCS:%.s=%))
|
||||||
CC := gcc
|
CC := gcc
|
||||||
C_FLAGS :=
|
C_FLAGS := -Wall -Werror
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(C_OBJS) $(ASM_OBJS)
|
all: $(C_OBJS) $(ASM_OBJS)
|
||||||
|
Reference in New Issue
Block a user