tests: fix clang warnings
Change-Id: I5dddc85169d7ef515c99dd1ab824573cbc1b5f2b
This commit is contained in:
parent
e296281ce2
commit
cbc8a0df90
9 changed files with 65 additions and 73 deletions
|
@ -1,5 +1,4 @@
|
|||
NOGCCERROR:= yes
|
||||
NOCLANGERROR:= yes
|
||||
|
||||
BINDIR?= /usr/tests/minix-posix
|
||||
FILESDIR?= /usr/tests/minix-posix
|
||||
|
@ -23,12 +22,6 @@ SUBDIR+= blocktest
|
|||
SUBDIR+= ddekit
|
||||
|
||||
# Some have special flags compiling
|
||||
.if ${MACHINE_ARCH} == "i386"
|
||||
# LSC FIXME: Compilation error for now on ARM with that!
|
||||
COPTS.test51.c= -mhard-float
|
||||
COPTS.test52.c= -mhard-float
|
||||
.endif
|
||||
|
||||
CPPFLAGS.test56.c += -D_MINIX_SYSTEM=1
|
||||
|
||||
COPTS.test9.c= -O0
|
||||
|
|
|
@ -577,7 +577,7 @@ uid_t * r_uid;
|
|||
gid_t * r_gid;
|
||||
{
|
||||
char line[N];
|
||||
char *p;
|
||||
unsigned char *p;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
FILE *fp;
|
||||
|
|
|
@ -317,7 +317,7 @@ uid_t *r_uid;
|
|||
gid_t *r_gid;
|
||||
{
|
||||
char line[N];
|
||||
char *p;
|
||||
unsigned char *p;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
FILE *fp;
|
||||
|
|
|
@ -222,7 +222,7 @@ int sig;
|
|||
}
|
||||
|
||||
|
||||
int sigmemcmp(sigset_t *s1, sigset_t *s2, int size)
|
||||
static int sigmemcmp(sigset_t *s1, sigset_t *s2, int size)
|
||||
{
|
||||
int i;
|
||||
int mismatch = 0;
|
||||
|
@ -536,7 +536,6 @@ int signo;
|
|||
{
|
||||
sigset_t oset;
|
||||
sigset_t set;
|
||||
int i;
|
||||
|
||||
if (sigemptyset(&set) == -1) e(5001);
|
||||
if (sigaddset(&set, SIGTERM) == -1) e(5002);
|
||||
|
|
|
@ -461,7 +461,7 @@ int sig;
|
|||
case SIGUSR1: bit = 1; break;
|
||||
case SIGUSR2: bit = 2; break;
|
||||
case SIGTERM: bit = 4; break;
|
||||
default: my_e(100);
|
||||
default: bit = 0; my_e(100);
|
||||
}
|
||||
|
||||
sigfillset(&set);
|
||||
|
|
|
@ -283,7 +283,10 @@ void group_test() {
|
|||
int dotest( void (*func)(void) ) {
|
||||
int test_result;
|
||||
|
||||
if(fork() == 0) (*func)();
|
||||
if(fork() == 0) {
|
||||
(*func)();
|
||||
exit(1); /* not supposed to be reached */
|
||||
}
|
||||
else wait(&test_result);
|
||||
|
||||
return(test_result);
|
||||
|
|
|
@ -197,14 +197,14 @@ void verify_main_reenter(void)
|
|||
}
|
||||
|
||||
int set_context_test_value;
|
||||
void set_context_test_thread1(void){
|
||||
static void set_context_test_thread1(void){
|
||||
set_context_test_value |= 0x1;
|
||||
setcontext(&ctx[2]);
|
||||
err(1, 24);
|
||||
|
||||
}
|
||||
|
||||
void set_context_test_thread2(void){
|
||||
static void set_context_test_thread2(void){
|
||||
set_context_test_value |= 0x1 << 1;
|
||||
setcontext(&ctx[0]);
|
||||
err(1, 23);
|
||||
|
|
|
@ -82,15 +82,15 @@ int max_error = 4;
|
|||
#define ISO8601_FORMAT "%Y-%m-%dT%H:%M:%S"
|
||||
|
||||
/* socket types supported */
|
||||
int types[3] = {SOCK_STREAM, SOCK_SEQPACKET, SOCK_DGRAM};
|
||||
char sock_fullpath[PATH_MAX + 1];
|
||||
static int types[3] = {SOCK_STREAM, SOCK_SEQPACKET, SOCK_DGRAM};
|
||||
static char sock_fullpath[PATH_MAX + 1];
|
||||
|
||||
void test_abort_client_server(int abort_type);
|
||||
void test_abort_client(int abort_type);
|
||||
void test_abort_server(pid_t pid, int abort_type);
|
||||
static void test_abort_client_server(int abort_type);
|
||||
static void test_abort_client(int abort_type);
|
||||
static void test_abort_server(pid_t pid, int abort_type);
|
||||
|
||||
/* timestamps for debug and error logs */
|
||||
char *get_timestamp(void)
|
||||
static char *get_timestamp(void)
|
||||
{
|
||||
struct tm *tm;
|
||||
time_t t;
|
||||
|
@ -120,7 +120,7 @@ char *get_timestamp(void)
|
|||
}
|
||||
|
||||
/* macro to display information about a failed test and increment the errct */
|
||||
void test_fail_fl(char *msg, char *file, int line)
|
||||
static void test_fail_fl(char *msg, char *file, int line)
|
||||
{
|
||||
char *timestamp;
|
||||
timestamp = get_timestamp();
|
||||
|
@ -138,7 +138,7 @@ void test_fail_fl(char *msg, char *file, int line)
|
|||
#define test_fail(msg) test_fail_fl(msg, __FILE__, __LINE__)
|
||||
|
||||
/* Convert name to the full path of the socket. Assumes name is in cwd. */
|
||||
char *fullpath(char *name)
|
||||
static char *fullpath(char *name)
|
||||
{
|
||||
char cwd[PATH_MAX + 1];
|
||||
|
||||
|
@ -152,7 +152,7 @@ char *fullpath(char *name)
|
|||
|
||||
#if DEBUG == 1
|
||||
/* macros to display debugging information */
|
||||
void debug_fl(char *msg, char *file, int line)
|
||||
static void debug_fl(char *msg, char *file, int line)
|
||||
{
|
||||
char *timestamp;
|
||||
timestamp = get_timestamp();
|
||||
|
@ -208,7 +208,7 @@ void debug_fl(char *msg, char *file, int line)
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
void test_socket(void)
|
||||
static void test_socket(void)
|
||||
{
|
||||
struct stat statbuf, statbuf2;
|
||||
int sd, sd2;
|
||||
|
@ -292,7 +292,7 @@ void test_socket(void)
|
|||
debug("leaving test_socket()");
|
||||
}
|
||||
|
||||
void test_header(void)
|
||||
static void test_header(void)
|
||||
{
|
||||
struct sockaddr_un sun;
|
||||
debug("entering test_header()");
|
||||
|
@ -312,7 +312,7 @@ void test_header(void)
|
|||
}
|
||||
}
|
||||
|
||||
void test_socketpair(void)
|
||||
static void test_socketpair(void)
|
||||
{
|
||||
char buf[128];
|
||||
struct sockaddr_un addr;
|
||||
|
@ -384,7 +384,7 @@ void test_socketpair(void)
|
|||
debug("leaving test_socketpair()");
|
||||
}
|
||||
|
||||
void test_ucred(void)
|
||||
static void test_ucred(void)
|
||||
{
|
||||
struct uucred credentials;
|
||||
socklen_t ucred_length;
|
||||
|
@ -426,7 +426,7 @@ void test_ucred(void)
|
|||
CLOSE(sv[1]);
|
||||
}
|
||||
|
||||
void test_getsockname(void)
|
||||
static void test_getsockname(void)
|
||||
{
|
||||
int sd;
|
||||
int rc;
|
||||
|
@ -464,7 +464,7 @@ void test_getsockname(void)
|
|||
CLOSE(sd);
|
||||
}
|
||||
|
||||
void test_bind(void)
|
||||
static void test_bind(void)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
struct sockaddr_un sock_addr;
|
||||
|
@ -582,7 +582,7 @@ void test_bind(void)
|
|||
debug("leaving test_bind()");
|
||||
}
|
||||
|
||||
void test_listen(void)
|
||||
static void test_listen(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
@ -611,7 +611,7 @@ void test_listen(void)
|
|||
debug("leaving test_listen()");
|
||||
}
|
||||
|
||||
void test_shutdown(void)
|
||||
static void test_shutdown(void)
|
||||
{
|
||||
int how[3] = { SHUT_RD, SHUT_WR, SHUT_RDWR };
|
||||
int sd;
|
||||
|
@ -661,7 +661,7 @@ void test_shutdown(void)
|
|||
debug("leaving test_shutdown()");
|
||||
}
|
||||
|
||||
void test_close(void)
|
||||
static void test_close(void)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
int sd, sd2;
|
||||
|
@ -727,7 +727,7 @@ void test_close(void)
|
|||
debug("leaving test_close()");
|
||||
}
|
||||
|
||||
void test_sockopts(void)
|
||||
static void test_sockopts(void)
|
||||
{
|
||||
int i;
|
||||
int rc;
|
||||
|
@ -802,7 +802,7 @@ void test_sockopts(void)
|
|||
debug("leaving test_sockopts()");
|
||||
}
|
||||
|
||||
void test_read(void)
|
||||
static void test_read(void)
|
||||
{
|
||||
int rc;
|
||||
int fd;
|
||||
|
@ -826,7 +826,7 @@ void test_read(void)
|
|||
debug("leaving test_read()");
|
||||
}
|
||||
|
||||
void test_write(void)
|
||||
static void test_write(void)
|
||||
{
|
||||
int rc;
|
||||
char buf[BUFSIZE];
|
||||
|
@ -842,7 +842,7 @@ void test_write(void)
|
|||
debug("leaving test_write()");
|
||||
}
|
||||
|
||||
void test_dup(void)
|
||||
static void test_dup(void)
|
||||
{
|
||||
struct stat info1;
|
||||
struct stat info2;
|
||||
|
@ -932,7 +932,7 @@ void test_dup(void)
|
|||
debug("leaving test_dup()");
|
||||
}
|
||||
|
||||
void test_dup2(void)
|
||||
static void test_dup2(void)
|
||||
{
|
||||
struct stat info1;
|
||||
struct stat info2;
|
||||
|
@ -996,7 +996,7 @@ void test_dup2(void)
|
|||
/*
|
||||
* A toupper() server. This toy server converts a string to upper case.
|
||||
*/
|
||||
void test_xfer_server(pid_t pid)
|
||||
static void test_xfer_server(pid_t pid)
|
||||
{
|
||||
int i;
|
||||
struct timeval tv;
|
||||
|
@ -1004,7 +1004,7 @@ void test_xfer_server(pid_t pid)
|
|||
int status;
|
||||
int rc;
|
||||
int sd;
|
||||
char buf[BUFSIZE];
|
||||
unsigned char buf[BUFSIZE];
|
||||
socklen_t client_addr_size;
|
||||
int client_sd;
|
||||
struct sockaddr_un addr;
|
||||
|
@ -1175,10 +1175,10 @@ void test_xfer_server(pid_t pid)
|
|||
errct += WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
int server_ready = 0;
|
||||
static int server_ready = 0;
|
||||
|
||||
/* signal handler for the client */
|
||||
void test_xfer_sighdlr(int sig)
|
||||
static void test_xfer_sighdlr(int sig)
|
||||
{
|
||||
debug("entering signal handler");
|
||||
switch (sig) {
|
||||
|
@ -1198,7 +1198,7 @@ void test_xfer_sighdlr(int sig)
|
|||
/*
|
||||
* A toupper() client.
|
||||
*/
|
||||
void test_xfer_client(void)
|
||||
static void test_xfer_client(void)
|
||||
{
|
||||
struct uucred credentials;
|
||||
socklen_t ucred_length;
|
||||
|
@ -1394,7 +1394,7 @@ void test_xfer_client(void)
|
|||
exit(errct);
|
||||
}
|
||||
|
||||
void test_xfer(void)
|
||||
static void test_xfer(void)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
|
@ -1433,7 +1433,7 @@ void test_xfer(void)
|
|||
UNLINK(TEST_SUN_PATH);
|
||||
}
|
||||
|
||||
void test_simple_client(int type)
|
||||
static void test_simple_client(int type)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
int sd, rc;
|
||||
|
@ -1499,7 +1499,7 @@ void test_simple_client(int type)
|
|||
exit(errct);
|
||||
}
|
||||
|
||||
void test_simple_server(int type, pid_t pid)
|
||||
static void test_simple_server(int type, pid_t pid)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
int sd, rc, client_sd, status;
|
||||
|
@ -1590,7 +1590,7 @@ void test_simple_server(int type, pid_t pid)
|
|||
errct += WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
void test_abort_client_server(int abort_type)
|
||||
static void test_abort_client_server(int abort_type)
|
||||
{
|
||||
pid_t pid;
|
||||
debug("test_simple_client_server()");
|
||||
|
@ -1628,7 +1628,7 @@ void test_abort_client_server(int abort_type)
|
|||
UNLINK(TEST_SUN_PATH);
|
||||
}
|
||||
|
||||
void test_abort_client(int abort_type)
|
||||
static void test_abort_client(int abort_type)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
int sd, rc;
|
||||
|
@ -1677,7 +1677,7 @@ void test_abort_client(int abort_type)
|
|||
exit(errct);
|
||||
}
|
||||
|
||||
void test_abort_server(pid_t pid, int abort_type)
|
||||
static void test_abort_server(pid_t pid, int abort_type)
|
||||
{
|
||||
char buf[BUFSIZE];
|
||||
int sd, rc, client_sd, status;
|
||||
|
@ -1745,7 +1745,7 @@ void test_abort_server(pid_t pid, int abort_type)
|
|||
errct += WEXITSTATUS(status);
|
||||
}
|
||||
|
||||
void test_simple_client_server(int type)
|
||||
static void test_simple_client_server(int type)
|
||||
{
|
||||
pid_t pid;
|
||||
debug("test_simple_client_server()");
|
||||
|
@ -1783,7 +1783,7 @@ void test_simple_client_server(int type)
|
|||
UNLINK(TEST_SUN_PATH);
|
||||
}
|
||||
|
||||
void test_vectorio(int type)
|
||||
static void test_vectorio(int type)
|
||||
{
|
||||
int sv[2];
|
||||
int rc;
|
||||
|
@ -1874,7 +1874,7 @@ void test_vectorio(int type)
|
|||
debug("done vector io tests");
|
||||
}
|
||||
|
||||
void test_msg(int type)
|
||||
static void test_msg(int type)
|
||||
{
|
||||
int sv[2];
|
||||
int rc;
|
||||
|
@ -1982,7 +1982,7 @@ void test_msg(int type)
|
|||
}
|
||||
}
|
||||
|
||||
void test_msg_dgram(void)
|
||||
static void test_msg_dgram(void)
|
||||
{
|
||||
int rc;
|
||||
int src;
|
||||
|
@ -2106,7 +2106,7 @@ void test_msg_dgram(void)
|
|||
UNLINK(TEST_SUN_PATHB);
|
||||
}
|
||||
|
||||
void test_scm_credentials(void)
|
||||
static void test_scm_credentials(void)
|
||||
{
|
||||
int rc;
|
||||
int src;
|
||||
|
@ -2270,7 +2270,7 @@ void test_scm_credentials(void)
|
|||
UNLINK(TEST_SUN_PATHB);
|
||||
}
|
||||
|
||||
void test_connect(void)
|
||||
static void test_connect(void)
|
||||
{
|
||||
int i, sd, sds[2], rc;
|
||||
|
||||
|
@ -2315,7 +2315,7 @@ void test_connect(void)
|
|||
debug("exiting test_connect()");
|
||||
}
|
||||
|
||||
int test_multiproc_read(void)
|
||||
static int test_multiproc_read(void)
|
||||
{
|
||||
/* test that when we fork() a process with an open socket descriptor,
|
||||
* the descriptor in each process points to the same thing.
|
||||
|
@ -2407,7 +2407,7 @@ int test_multiproc_read(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int test_multiproc_write(void)
|
||||
static int test_multiproc_write(void)
|
||||
{
|
||||
/* test that when we fork() a process with an open socket descriptor,
|
||||
* the descriptor in each process points to the same thing.
|
||||
|
@ -2496,7 +2496,7 @@ int test_multiproc_write(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void test_fd_passing_child(int sd)
|
||||
static void test_fd_passing_child(int sd)
|
||||
{
|
||||
int fd, rc;
|
||||
char x = 'x';
|
||||
|
@ -2580,7 +2580,7 @@ void test_fd_passing_child(int sd)
|
|||
exit(errct);
|
||||
}
|
||||
|
||||
void test_fd_passing_parent(int sd)
|
||||
static void test_fd_passing_parent(int sd)
|
||||
{
|
||||
int rc, fd;
|
||||
char x;
|
||||
|
@ -2638,7 +2638,7 @@ void test_fd_passing_parent(int sd)
|
|||
}
|
||||
}
|
||||
|
||||
void test_permissions(void) {
|
||||
static void test_permissions(void) {
|
||||
/* Test bind and connect for permission verification
|
||||
*
|
||||
* After creating a UDS socket we change user credentials. At that
|
||||
|
@ -2721,7 +2721,7 @@ void test_permissions(void) {
|
|||
UNLINK(TEST_SUN_PATH);
|
||||
}
|
||||
|
||||
void test_fd_passing(void) {
|
||||
static void test_fd_passing(void) {
|
||||
int status;
|
||||
int sv[2];
|
||||
pid_t pid;
|
||||
|
@ -2775,9 +2775,9 @@ void test_fd_passing(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void test_select()
|
||||
static void test_select()
|
||||
{
|
||||
int i, nfds = -1;
|
||||
int nfds = -1;
|
||||
int socks[2];
|
||||
fd_set readfds, writefds;
|
||||
struct timeval tv;
|
||||
|
@ -2854,7 +2854,7 @@ void test_select()
|
|||
close(socks[1]);
|
||||
}
|
||||
|
||||
void test_select_close(void)
|
||||
static void test_select_close(void)
|
||||
{
|
||||
int res, socks[2];
|
||||
fd_set readfds;
|
||||
|
@ -2895,7 +2895,7 @@ void test_select_close(void)
|
|||
close(socks[0]);
|
||||
}
|
||||
|
||||
void test_fchmod()
|
||||
static void test_fchmod()
|
||||
{
|
||||
int socks[2];
|
||||
struct stat st1, st2;
|
||||
|
@ -3341,9 +3341,8 @@ test_connect_close(void)
|
|||
static void
|
||||
test_listen_close(void)
|
||||
{
|
||||
socklen_t len;
|
||||
int server_sd, client_sd;
|
||||
struct sockaddr_un server_addr, client_addr, addr;
|
||||
struct sockaddr_un server_addr, client_addr;
|
||||
int status;
|
||||
char byte;
|
||||
|
||||
|
@ -3415,9 +3414,8 @@ test_listen_close(void)
|
|||
static void
|
||||
test_listen_close_nb(void)
|
||||
{
|
||||
socklen_t len;
|
||||
int server_sd, client_sd;
|
||||
struct sockaddr_un server_addr, client_addr, addr;
|
||||
struct sockaddr_un server_addr, client_addr;
|
||||
int status;
|
||||
char byte;
|
||||
|
||||
|
|
|
@ -139,7 +139,6 @@ static void do_write(void *buf, int fd, int writable)
|
|||
static void do_stat(void *buf, int fd, int writable)
|
||||
{
|
||||
int r;
|
||||
struct stat sb;
|
||||
r = fstat(fd, (struct stat *) buf);
|
||||
|
||||
/* should succeed if buf is writable */
|
||||
|
@ -325,7 +324,7 @@ struct {
|
|||
{ do_select3 },
|
||||
};
|
||||
|
||||
void test_memory_types_vs_operations(void)
|
||||
static void test_memory_types_vs_operations(void)
|
||||
{
|
||||
#define NFDS 4
|
||||
#define BUFSIZE (10 * PAGE_SIZE)
|
||||
|
@ -368,7 +367,7 @@ void test_memory_types_vs_operations(void)
|
|||
}
|
||||
}
|
||||
|
||||
void basic_regression(void)
|
||||
static void basic_regression(void)
|
||||
{
|
||||
int fd, fd1, fd2;
|
||||
ssize_t rb, wr;
|
||||
|
@ -418,7 +417,7 @@ void basic_regression(void)
|
|||
if(fcntl(fd2, F_FLUSH_FS_CACHE) < 0) { e(1); }
|
||||
|
||||
#define LOCATION1 (void *) 0x90000000
|
||||
#define LOCATION2 (LOCATION1 + PAGE_SIZE)
|
||||
#define LOCATION2 ((void *)((char *)LOCATION1 + PAGE_SIZE))
|
||||
block1 = mmap(LOCATION1, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_FILE, fd1, 0);
|
||||
if(block1 == MAP_FAILED) { e(4); }
|
||||
if(block1 != LOCATION1) { e(5); }
|
||||
|
|
Loading…
Reference in a new issue