test:update tests to fix compiler warnings.

Change-Id: Id2c757f61fe5e8b52dffadfeb129024625c76f48
This commit is contained in:
Kees Jongenburger 2013-01-07 17:19:30 +01:00
parent 9ee8c2c75f
commit 5e3b51ba96
9 changed files with 28 additions and 32 deletions

View file

@ -68,7 +68,6 @@ void open_terminal(int *child_fd, int *parent_fd) {
}
int do_child(int terminal) {
int retval;
struct timeval tv;
/* Going to sleep for two seconds to allow the parent proc to get ready */
@ -77,12 +76,12 @@ int do_child(int terminal) {
select(0, NULL, NULL, NULL, &tv);
/* Try to write. Doesn't matter how many bytes we actually send. */
retval = write(terminal, SENDSTRING, strlen(SENDSTRING));
(void) write(terminal, SENDSTRING, strlen(SENDSTRING));
close(terminal);
/* Wait for another second to allow the parent to process incoming data */
tv.tv_usec = 1000000;
retval = select(0,NULL, NULL, NULL, &tv);
(void) select(0,NULL, NULL, NULL, &tv);
exit(0);
}

View file

@ -61,7 +61,6 @@ void e(int n, char *s) {
void do_child(void) {
struct timeval tv;
int retval;
/* Open named pipe for writing. This will block until a reader arrives. */
if((fd_np1 = open(NAMEDPIPE1, O_WRONLY)) == -1) {
@ -79,19 +78,19 @@ void do_child(void) {
select(0, NULL, NULL, NULL, &tv);
/* Try to write. Doesn't matter how many bytes we actually send. */
retval = write(fd_np1, SENDSTRING, strlen(SENDSTRING));
(void) write(fd_np1, SENDSTRING, strlen(SENDSTRING));
/* Wait for another second to allow the parent to process incoming data */
tv.tv_sec = DO_HANDLEDATA;
tv.tv_usec = 0;
retval = select(0,NULL, NULL, NULL, &tv);
(void) select(0,NULL, NULL, NULL, &tv);
close(fd_np1);
/* Wait for another second to allow the parent to process incoming data */
tv.tv_sec = DO_HANDLEDATA;
tv.tv_usec = 0;
retval = select(0,NULL, NULL, NULL, &tv);
(void) select(0,NULL, NULL, NULL, &tv);
/* Open named pipe for reading. This will block until a writer arrives. */
if((fd_np2 = open(NAMEDPIPE2, O_RDONLY)) == -1) {
@ -106,7 +105,7 @@ void do_child(void) {
/* Wait for another second to allow the parent to run some tests. */
tv.tv_sec = DO_HANDLEDATA;
tv.tv_usec = 0;
retval = select(0, NULL, NULL, NULL, &tv);
(void) select(0, NULL, NULL, NULL, &tv);
close(fd_np2);
@ -115,7 +114,7 @@ void do_child(void) {
/* Let the parent do initial read and write tests from and to the pipe. */
tv.tv_sec = DO_PAUSE;
tv.tv_usec = 0;
retval = select(0, NULL, NULL, NULL, &tv);
(void) select(0, NULL, NULL, NULL, &tv);
/* Unblock blocking read select by writing data */
if(write(fd_ap[1], SENDSTRING, strlen(SENDSTRING)) < 0) {

View file

@ -62,12 +62,11 @@ float compute_diff(struct timeval start, struct timeval end, float compare) {
void do_child(void) {
struct timeval tv;
int retval;
/* Let the parent do initial read and write tests from and to the pipe. */
tv.tv_sec = DO_PAUSE + DO_PAUSE + DO_PAUSE + 1;
tv.tv_usec = 0;
retval = select(0, NULL, NULL, NULL, &tv);
(void) select(0, NULL, NULL, NULL, &tv);
/* At this point the parent has a pending select with a DO_TIMEOUT timeout.
We're going to interrupt by sending a signal */

View file

@ -75,9 +75,7 @@ void parent()
void child(i)
int i;
{
int n;
n = getpid();
(void) getpid();
exit(100+i);
}

View file

@ -72,12 +72,12 @@ int main()
void spawn(n)
int n;
{
int pid, k;
int pid;
if ((pid = fork()) != 0) {
wait(&n); /* wait for some child (any one) */
} else {
k = execl(name[n], name[n], (char *) 0);
execl(name[n], name[n], (char *) 0);
errct++;
printf("Child execl didn't take. file=%s errno=%d\n", name[n], errno);
rmfiles();

View file

@ -41,11 +41,9 @@ char executable[1024];
int main(int argc, char *argv[])
{
int i, m = 0xFFFF;
int i;
sync();
if (argc == 2) m = atoi(argv[1]);
/* If we have to check things, call do_check(). */
if (strcmp(argv[0], "DO CHECK") == 0) exit(do_check());

View file

@ -210,7 +210,7 @@ void test5e()
/* When a signal knocks a processes out of WAIT or PAUSE, it is supposed to
* get EINTR as error status. Check that.
*/
int n, j;
int n;
subtest = 5;
if (signal(8, func8) == SIG_ERR) e(25);
@ -222,7 +222,7 @@ void test5e()
if (wait(&n) < 0) e(27);
if (signal(8, SIG_DFL) == SIG_ERR) e(28);
} else {
j = pause();
(void) pause();
if (errno != EINTR && -errno != EINTR) e(29);
exit(0);
}
@ -282,7 +282,7 @@ void test5h()
/* When a signal knocks a processes out of PIPE, it is supposed to
* get EINTR as error status. Check that.
*/
int n, j, fd[2];
int n, fd[2];
subtest = 8;
unlink("XXX.test5");
@ -301,7 +301,7 @@ void test5h()
if (close(fd[1]) != 0) e(6);
} else {
if (creat("XXX.test5", 0777) < 0) e(7);
j = read(fd[0], (char *) &n, 1);
(void) read(fd[0], (char *) &n, 1);
if (errno != EINTR) e(8);
exit(0);
}

View file

@ -471,10 +471,8 @@ void test_bind(void)
int sd;
int sd2;
int rc;
int on;
debug("entering test_bind()");
on = 1;
UNLINK(TEST_SUN_PATH);
memset(&addr, '\0', sizeof(struct sockaddr_un));
addr.sun_family = AF_UNIX;
@ -980,9 +978,7 @@ void test_dup2(void)
*/
void test_xfer_server(pid_t pid)
{
socklen_t ucred_length;
int i;
int on;
struct timeval tv;
fd_set readfds;
int status;
@ -994,11 +990,9 @@ void test_xfer_server(pid_t pid)
struct sockaddr_un addr;
struct sockaddr_un client_addr;
on = 1;
status = 0;
rc = 0;
sd = 0;
ucred_length = sizeof(struct ucred);
client_sd = 0;
client_addr_size = sizeof(struct sockaddr_un);
@ -2481,9 +2475,6 @@ void test_permissions(void) {
pid_t pid;
int sd, rc, status;
struct sockaddr_un addr;
socklen_t client_addr_size;
client_addr_size = sizeof(struct sockaddr_un);
memset(&addr, '\0', sizeof(struct sockaddr_un));
addr.sun_family = AF_UNIX;

View file

@ -233,6 +233,18 @@ void level1()
p = &buf[10];
i = 200;
p = &buf[20];
#ifdef __GNUC__
/*
* to defeat the smartness of the GNU C optimizer we pretend we
* use 'a'. Otherwise the optimizer will not detect the looping
* effectuated by setjmp/longjmp, so that it thinks it can get
* rid of the assignment to 'a'.
*/
srand(i);
srand((int)*p);
#endif
longjmp(env, 2);
}