tests cleanup
. make common.o link with the tests instead of being #included as common.c . fix warnings about missing prototypes by declaring functions static . reduces some duplicated code Change-Id: Ic2a765d7f5886add5863190efec3fdd2d2ea2137
This commit is contained in:
parent
cef94e096e
commit
5977114c42
80 changed files with 364 additions and 327 deletions
|
@ -70,6 +70,10 @@ LDSTATIC= -dynamic
|
|||
PROGS+= test63 mod
|
||||
.endif
|
||||
|
||||
.for o in $(PROGS)
|
||||
OBJS.${o} += common.o
|
||||
.endfor
|
||||
|
||||
# LSC Make sure there is not leftover after a failed testrun
|
||||
clean: .PHONY .MAKE
|
||||
$(MAKE) -C select clean
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Utility routines for Minix tests.
|
||||
* This is designed to be #includ'ed near the top of test programs. It is
|
||||
* self-contained except for MAX_ERRORS.
|
||||
* self-contained except for max_error.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
|
@ -10,18 +10,17 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
int common_test_nr = -1, errct = 0, subtest;
|
||||
|
||||
#define e(errn) e_f(__FILE__, __LINE__, (errn))
|
||||
|
||||
void cleanup(void);
|
||||
int does_fs_truncate(void);
|
||||
void e_f(char *file, int lineno, int n);
|
||||
int name_max(char *path);
|
||||
void quit(void);
|
||||
void rm_rf_dir(int test_nr);
|
||||
void rm_rf_ppdir(int test_nr);
|
||||
void start(int test_nr);
|
||||
/* provide a default max_error symbol as Max_error with a value
|
||||
* of 5. The test program can override it wit its own max_error
|
||||
* symbol if it wants that this code will then use instead.
|
||||
*/
|
||||
__weak_alias(max_error,Max_error);
|
||||
int Max_error = 5;
|
||||
extern int max_error;
|
||||
|
||||
void start(test_nr)
|
||||
int test_nr;
|
||||
|
@ -107,7 +106,7 @@ void e_f(char *file, int line, int n)
|
|||
if (errct == 0) printf("\n"); /* finish header */
|
||||
printf("%s:%d: Subtest %d, error %d, errno %d: %s\n",
|
||||
file, line, subtest, n, errno, strerror(errno));
|
||||
if (++errct > MAX_ERROR) {
|
||||
if (++errct > max_error) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
cleanup();
|
||||
exit(1);
|
||||
|
|
24
test/common.h
Normal file
24
test/common.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#define e(errn) e_f(__FILE__, __LINE__, (errn))
|
||||
#define em(errn,msg) do { fprintf(stderr, "%s\n", msg); e(errn); } while(0)
|
||||
|
||||
void printprogress(char *msg, int i, int max);
|
||||
void cleanup(void);
|
||||
int does_fs_truncate(void);
|
||||
void e_f(char *file, int lineno, int n);
|
||||
int name_max(char *path);
|
||||
void quit(void);
|
||||
void rm_rf_dir(int test_nr);
|
||||
void rm_rf_ppdir(int test_nr);
|
||||
void start(int test_nr);
|
||||
|
||||
extern int common_test_nr, errct, subtest;
|
||||
|
|
@ -7,3 +7,4 @@
|
|||
#define MAGIC6 0x17D1FF
|
||||
|
||||
long hellodriver(void);
|
||||
long modfunction(long, long *, long);
|
||||
|
|
31
test/t40a.c
31
test/t40a.c
|
@ -22,16 +22,7 @@
|
|||
|
||||
#define MAX_ERROR 5
|
||||
|
||||
int errct = 0, subtest = -1;
|
||||
|
||||
void e(int n, char *s) {
|
||||
printf("Subtest %d, error %d, %s\n", subtest, n, s);
|
||||
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
exit(errct);
|
||||
}
|
||||
}
|
||||
#include "common.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
fd_set fds;
|
||||
|
@ -50,7 +41,7 @@ int main(int argc, char **argv) {
|
|||
FD_ZERO(&fds);
|
||||
for(i = 0; i < OPEN_MAX; i++) {
|
||||
if(FD_ISSET(i, &fds)) {
|
||||
e(1, "fd set should be completely empty");
|
||||
em(1, "fd set should be completely empty");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +50,7 @@ int main(int argc, char **argv) {
|
|||
for(i = 0; i < OPEN_MAX; i++) FD_SET(i, &fds);
|
||||
for(i = 0; i < OPEN_MAX; i++) {
|
||||
if(!FD_ISSET(i, &fds)) {
|
||||
e(2, "fd set should be completely filled");
|
||||
em(2, "fd set should be completely filled");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +59,7 @@ int main(int argc, char **argv) {
|
|||
FD_ZERO(&fds);
|
||||
for(i = 0; i < OPEN_MAX; i++) {
|
||||
if(FD_ISSET(i, &fds)) {
|
||||
e(3, "fd set should be completely empty");
|
||||
em(3, "fd set should be completely empty");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +68,7 @@ int main(int argc, char **argv) {
|
|||
for(i = 0; i < OPEN_MAX; i += 2) FD_SET(i, &fds);
|
||||
for(i = 0; i < OPEN_MAX - 1; i+= 2 ) {
|
||||
if(!(FD_ISSET(i, &fds) && !FD_ISSET(i+1, &fds))) {
|
||||
e(4, "bit pattern does not match");
|
||||
em(4, "bit pattern does not match");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +77,7 @@ int main(int argc, char **argv) {
|
|||
FD_ZERO(&fds);
|
||||
for(i = 0; i < OPEN_MAX; i++) {
|
||||
if(FD_ISSET(i, &fds)) {
|
||||
e(5,"fd set should be completely empty");
|
||||
em(5,"fd set should be completely empty");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +86,7 @@ int main(int argc, char **argv) {
|
|||
for(i = 0; i < OPEN_MAX - 1; i += 2) FD_SET(i+1, &fds);
|
||||
for(i = 0; i < OPEN_MAX - 1; i+= 2 ) {
|
||||
if(!(FD_ISSET(i+1, &fds) && !FD_ISSET(i, &fds))) {
|
||||
e(6, "bit pattern does not match");
|
||||
em(6, "bit pattern does not match");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +95,7 @@ int main(int argc, char **argv) {
|
|||
FD_ZERO(&fds);
|
||||
for(i = 0; i < OPEN_MAX; i++) {
|
||||
if(FD_ISSET(i, &fds)) {
|
||||
e(7, "fd set should be completely empty");
|
||||
em(7, "fd set should be completely empty");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +105,7 @@ int main(int argc, char **argv) {
|
|||
for(i = 0; i < OPEN_MAX; i++) FD_CLR(i, &fds); /* Clear all bits */
|
||||
for(i = 0; i < OPEN_MAX; i++) {
|
||||
if(FD_ISSET(i, &fds)) {
|
||||
e(8, "all bits in fd set should be cleared");
|
||||
em(8, "all bits in fd set should be cleared");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +114,7 @@ int main(int argc, char **argv) {
|
|||
FD_ZERO(&fds);
|
||||
for(i = 0; i < OPEN_MAX; i++) {
|
||||
if(FD_ISSET(i, &fds)) {
|
||||
e(9, "fd set should be completely empty");
|
||||
em(9, "fd set should be completely empty");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +123,7 @@ int main(int argc, char **argv) {
|
|||
for(i = 0; i < OPEN_MAX; i += 2) FD_CLR(i, &fds); /* Clear all bits */
|
||||
for(i = 0; i < OPEN_MAX; i += 2) {
|
||||
if(FD_ISSET(i, &fds)) {
|
||||
e(10, "all even bits in fd set should be cleared");
|
||||
em(10, "all even bits in fd set should be cleared");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
44
test/t40b.c
44
test/t40b.c
|
@ -23,24 +23,16 @@
|
|||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define FILE1 "selecttestb-1"
|
||||
#define FILES 2
|
||||
#define TIME 3
|
||||
|
||||
#define MAX_ERROR 10
|
||||
|
||||
int errct = 0, subtest = -1;
|
||||
char errorbuf[1000];
|
||||
|
||||
void e(int n, char *s) {
|
||||
printf("Subtest %d, error %d, %s\n", subtest, n, s);
|
||||
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
exit(errct);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int fd1, fd2, retval;
|
||||
fd_set fds_read, fds_write, fds_error;
|
||||
|
@ -64,7 +56,7 @@ int main(int argc, char **argv) {
|
|||
if((fd1 = open(FILE1, O_WRONLY|O_CREAT, 0644)) == -1) {
|
||||
snprintf(errorbuf, sizeof(errorbuf), "failed to open file %s for writing",
|
||||
FILE1);
|
||||
e(1, errorbuf);
|
||||
em(1, errorbuf);
|
||||
perror(NULL);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -73,7 +65,7 @@ int main(int argc, char **argv) {
|
|||
if((fd2 = open(FILE1, O_RDONLY)) == -1) {
|
||||
snprintf(errorbuf, sizeof(errorbuf), "failed to open file %s for reading",
|
||||
FILE1);
|
||||
e(2, errorbuf);
|
||||
em(2, errorbuf);
|
||||
perror(NULL);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -94,20 +86,20 @@ int main(int argc, char **argv) {
|
|||
|
||||
/* Correct amount of ready file descriptors? 1 read + 1 write + 2 errors */
|
||||
if(retval != 4) {
|
||||
e(3, "four fds should be set");
|
||||
em(3, "four fds should be set");
|
||||
}
|
||||
|
||||
/* Test resulting bit masks */
|
||||
if(!FD_ISSET(fd1, &fds_write)) e(4, "write should be set");
|
||||
if(!FD_ISSET(fd2, &fds_read)) e(5, "read should be set");
|
||||
if(!FD_ISSET(fd1, &fds_error)) e(6, "error should be set");
|
||||
if(!FD_ISSET(fd2, &fds_error)) e(7, "error should be set");
|
||||
if(!FD_ISSET(fd1, &fds_write)) em(4, "write should be set");
|
||||
if(!FD_ISSET(fd2, &fds_read)) em(5, "read should be set");
|
||||
if(!FD_ISSET(fd1, &fds_error)) em(6, "error should be set");
|
||||
if(!FD_ISSET(fd2, &fds_error)) em(7, "error should be set");
|
||||
|
||||
/* Was it instantaneous? */
|
||||
if(end-start != TIME - TIME) {
|
||||
snprintf(errorbuf,sizeof(errorbuf),"time spent blocking is not %d, but %ld",
|
||||
TIME - TIME, (long int) (end-start));
|
||||
e(8, errorbuf);
|
||||
em(8, errorbuf);
|
||||
}
|
||||
|
||||
/* Wait for read to become ready on O_WRONLY. This should fail immediately. */
|
||||
|
@ -120,10 +112,10 @@ int main(int argc, char **argv) {
|
|||
retval = select(fd2+1, &fds_read, NULL, &fds_error, &tv);
|
||||
|
||||
/* Correct amount of ready file descriptors? 1 read + 2 error */
|
||||
if(retval != 3) e(9, "incorrect amount of ready file descriptors");
|
||||
if(!FD_ISSET(fd1, &fds_read)) e(10, "read should be set");
|
||||
if(!FD_ISSET(fd1, &fds_error)) e(11, "error should be set");
|
||||
if(!FD_ISSET(fd2, &fds_error)) e(12, "error should be set");
|
||||
if(retval != 3) em(9, "incorrect amount of ready file descriptors");
|
||||
if(!FD_ISSET(fd1, &fds_read)) em(10, "read should be set");
|
||||
if(!FD_ISSET(fd1, &fds_error)) em(11, "error should be set");
|
||||
if(!FD_ISSET(fd2, &fds_error)) em(12, "error should be set");
|
||||
|
||||
/* Try again as above, bit this time with O_RDONLY in the write set */
|
||||
FD_ZERO(&fds_error);
|
||||
|
@ -135,10 +127,10 @@ int main(int argc, char **argv) {
|
|||
retval = select(fd2+1, NULL, &fds_write, &fds_error, &tv);
|
||||
|
||||
/* Correct amount of ready file descriptors? 1 write + 2 errors */
|
||||
if(retval != 3) e(13, "incorrect amount of ready file descriptors");
|
||||
if(!FD_ISSET(fd2, &fds_write)) e(14, "write should be set");
|
||||
if(!FD_ISSET(fd1, &fds_error)) e(15, "error should be set");
|
||||
if(!FD_ISSET(fd2, &fds_error)) e(16, "error should be set");
|
||||
if(retval != 3) em(13, "incorrect amount of ready file descriptors");
|
||||
if(!FD_ISSET(fd2, &fds_write)) em(14, "write should be set");
|
||||
if(!FD_ISSET(fd1, &fds_error)) em(15, "error should be set");
|
||||
if(!FD_ISSET(fd2, &fds_error)) em(16, "error should be set");
|
||||
|
||||
close(fd1);
|
||||
close(fd2);
|
||||
|
|
35
test/t40c.c
35
test/t40c.c
|
@ -21,23 +21,14 @@
|
|||
#include <sys/wait.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define TERMINALW "/dev/ttypf"
|
||||
#define TERMINALR "/dev/ptypf"
|
||||
#define SENDSTRING "minixrocks"
|
||||
#define MAX_ERROR 5
|
||||
|
||||
int errct = 0, subtest = -1;
|
||||
|
||||
void e(int n, char *s) {
|
||||
printf("Subtest %d, error %d, %s\n", subtest, n, s);
|
||||
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
exit(errct);
|
||||
}
|
||||
}
|
||||
|
||||
void open_terminal(int *child_fd, int *parent_fd) {
|
||||
static void open_terminal(int *child_fd, int *parent_fd) {
|
||||
int fd1, fd2, i;
|
||||
char opentermw[5+OPEN_MAX+1];
|
||||
char opentermr[5+OPEN_MAX+1];
|
||||
|
@ -68,7 +59,7 @@ void open_terminal(int *child_fd, int *parent_fd) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int do_child(int terminal) {
|
||||
static int do_child(int terminal) {
|
||||
struct timeval tv;
|
||||
|
||||
/* Going to sleep for two seconds to allow the parent proc to get ready */
|
||||
|
@ -86,7 +77,7 @@ int do_child(int terminal) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
int do_parent(int child, int terminal) {
|
||||
static int do_parent(int child, int terminal) {
|
||||
fd_set fds_read, fds_write, fds_error;
|
||||
int retval;
|
||||
|
||||
|
@ -103,21 +94,21 @@ int do_parent(int child, int terminal) {
|
|||
* sub-test as reading from fd is blocking at this point. */
|
||||
retval = select(terminal+1, &fds_read, &fds_write, &fds_error, NULL);
|
||||
|
||||
if(retval != 1) e(1, "incorrect amount of ready file descriptors");
|
||||
if(retval != 1) em(1, "incorrect amount of ready file descriptors");
|
||||
|
||||
|
||||
if(FD_ISSET(terminal, &fds_read)) e(2, "read should NOT be set");
|
||||
if(!FD_ISSET(terminal, &fds_write)) e(3, "write should be set");
|
||||
if(FD_ISSET(terminal, &fds_error)) e(4, "error should NOT be set");
|
||||
if(FD_ISSET(terminal, &fds_read)) em(2, "read should NOT be set");
|
||||
if(!FD_ISSET(terminal, &fds_write)) em(3, "write should be set");
|
||||
if(FD_ISSET(terminal, &fds_error)) em(4, "error should NOT be set");
|
||||
|
||||
/* Block until ready; until child wrote stuff */
|
||||
FD_ZERO(&fds_read); FD_ZERO(&fds_write); FD_ZERO(&fds_error);
|
||||
FD_SET(terminal, &fds_read);
|
||||
retval = select(terminal+1, &fds_read, NULL, &fds_error, NULL);
|
||||
|
||||
if(retval != 1) e(5, "incorrect amount of ready file descriptors");
|
||||
if(!FD_ISSET(terminal, &fds_read)) e(6, "read should be set");
|
||||
if(FD_ISSET(terminal, &fds_error)) e(7, "error should not be set");
|
||||
if(retval != 1) em(5, "incorrect amount of ready file descriptors");
|
||||
if(!FD_ISSET(terminal, &fds_read)) em(6, "read should be set");
|
||||
if(FD_ISSET(terminal, &fds_error)) em(7, "error should not be set");
|
||||
|
||||
|
||||
FD_ZERO(&fds_read); FD_ZERO(&fds_error);
|
||||
|
@ -125,7 +116,7 @@ int do_parent(int child, int terminal) {
|
|||
retval = select(terminal+1, NULL, &fds_write, NULL, NULL);
|
||||
/* As it is impossible to write to a read only fd, this select should return
|
||||
* immediately with fd set in fds_write. */
|
||||
if(retval != 1) e(8, "incorrect amount or ready file descriptors");
|
||||
if(retval != 1) em(8, "incorrect amount or ready file descriptors");
|
||||
|
||||
close(terminal);
|
||||
waitpid(child, &retval, 0);
|
||||
|
|
64
test/t40d.c
64
test/t40d.c
|
@ -44,22 +44,14 @@
|
|||
#define DO_TIMEOUT 7
|
||||
#define MAX_ERROR 5
|
||||
|
||||
int errct = 0, subtest = -1;
|
||||
#include "common.h"
|
||||
|
||||
char errbuf[1000];
|
||||
int fd_ap[2]; /* Anonymous pipe; read from fd_ap[0], write to fd_ap[1] */
|
||||
int fd_np1; /* Named pipe */
|
||||
int fd_np2; /* Named pipe */
|
||||
|
||||
void e(int n, char *s) {
|
||||
printf("Subtest %d, error %d, %s\n", subtest, n, s);
|
||||
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
exit(errct);
|
||||
}
|
||||
}
|
||||
|
||||
void do_child(void) {
|
||||
static void do_child(void) {
|
||||
struct timeval tv;
|
||||
|
||||
/* Open named pipe for writing. This will block until a reader arrives. */
|
||||
|
@ -125,7 +117,8 @@ void do_child(void) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
int count_fds(int nfds, fd_set *fds) {
|
||||
#if 0
|
||||
static int count_fds(int nfds, fd_set *fds) {
|
||||
/* Return number of bits set in fds */
|
||||
int i, result = 0;
|
||||
assert(fds != NULL && nfds > 0);
|
||||
|
@ -134,8 +127,9 @@ int count_fds(int nfds, fd_set *fds) {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
int empty_fds(int nfds, fd_set *fds) {
|
||||
static int empty_fds(int nfds, fd_set *fds) {
|
||||
/* Returns nonzero if the first bits up to nfds in fds are not set */
|
||||
int i;
|
||||
assert(fds != NULL && nfds > 0);
|
||||
|
@ -143,7 +137,7 @@ int empty_fds(int nfds, fd_set *fds) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int compare_fds(int nfds, fd_set *lh, fd_set *rh) {
|
||||
static int compare_fds(int nfds, fd_set *lh, fd_set *rh) {
|
||||
/* Returns nonzero if lh equals rh up to nfds bits */
|
||||
int i;
|
||||
assert(lh != NULL && rh != NULL && nfds > 0);
|
||||
|
@ -156,7 +150,8 @@ int compare_fds(int nfds, fd_set *lh, fd_set *rh) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void dump_fds(int nfds, fd_set *fds) {
|
||||
#if 0
|
||||
static void dump_fds(int nfds, fd_set *fds) {
|
||||
/* Print a graphical representation of bits in fds */
|
||||
int i;
|
||||
if(fds != NULL && nfds > 0) {
|
||||
|
@ -164,8 +159,9 @@ void dump_fds(int nfds, fd_set *fds) {
|
|||
printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void do_parent(int child) {
|
||||
static void do_parent(int child) {
|
||||
fd_set fds_read, fds_write, fds_error;
|
||||
fd_set fds_compare_read, fds_compare_write;
|
||||
struct timeval tv;
|
||||
|
@ -205,16 +201,16 @@ void do_parent(int child) {
|
|||
if(retval <= 0) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"one fd should be set%s", (retval == 0 ? " (TIMEOUT)" : ""));
|
||||
e(1, errbuf);
|
||||
em(1, errbuf);
|
||||
}
|
||||
|
||||
if(!empty_fds(fd_np1+1,&fds_read)) e(2, "no read bits should be set");
|
||||
if(!empty_fds(fd_np1+1,&fds_read)) em(2, "no read bits should be set");
|
||||
|
||||
|
||||
/* Make sure the write bit is set (and just 1 bit) */
|
||||
FD_ZERO(&fds_compare_write); FD_SET(fd_np1, &fds_compare_write);
|
||||
if(!compare_fds(fd_np1+1, &fds_compare_write, &fds_write))
|
||||
e(3, "write should be set");
|
||||
em(3, "write should be set");
|
||||
|
||||
/* Clear sets and set up new bit masks */
|
||||
FD_ZERO(&fds_read); FD_ZERO(&fds_write);
|
||||
|
@ -231,14 +227,14 @@ void do_parent(int child) {
|
|||
if(retval != 1) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"one fd should be set%s", (retval == 0 ? " (TIMEOUT)" : ""));
|
||||
e(4, errbuf);
|
||||
em(4, errbuf);
|
||||
}
|
||||
|
||||
if(!FD_ISSET(fd_np1, &fds_read)) e(5, "read should be set");
|
||||
if(!FD_ISSET(fd_np1, &fds_read)) em(5, "read should be set");
|
||||
|
||||
/* Note that we left the write set empty. This should be equivalent to
|
||||
* setting this parameter to NULL. */
|
||||
if(!empty_fds(fd_np1+1, &fds_write)) e(6, "write should NOT be set");
|
||||
if(!empty_fds(fd_np1+1, &fds_write)) em(6, "write should NOT be set");
|
||||
|
||||
/* In case something went wrong above, we might end up with a child process
|
||||
* blocking on a write call we close the file descriptor now. Synchronize on
|
||||
|
@ -284,21 +280,21 @@ void do_parent(int child) {
|
|||
if(retval <= 0) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"two fds should be set%s", (retval == 0 ? " (TIMEOUT)" : ""));
|
||||
e(7, errbuf);
|
||||
em(7, errbuf);
|
||||
}
|
||||
|
||||
/* Make sure read bit is set (and just 1 bit) */
|
||||
FD_ZERO(&fds_compare_read); FD_SET(fd_np2, &fds_compare_read);
|
||||
if(!compare_fds(fd_np2+1, &fds_compare_read, &fds_read))
|
||||
e(8, "read should be set");
|
||||
em(8, "read should be set");
|
||||
|
||||
/* Write bit should be set (and just 1 bit) */
|
||||
FD_ZERO(&fds_compare_write); FD_SET(fd_np2, &fds_compare_write);
|
||||
if(!compare_fds(fd_np2+1, &fds_compare_write, &fds_write))
|
||||
e(9, "write should be set");
|
||||
em(9, "write should be set");
|
||||
|
||||
if(!empty_fds(fd_np2+1, &fds_error))
|
||||
e(10, "Error should NOT be set");
|
||||
em(10, "Error should NOT be set");
|
||||
|
||||
FD_ZERO(&fds_read); FD_ZERO(&fds_write);
|
||||
FD_SET(fd_np2, &fds_write);
|
||||
|
@ -310,10 +306,10 @@ void do_parent(int child) {
|
|||
if(retval != 1) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"one fd should be set%s", (retval == 0 ? " (TIMEOUT)" : ""));
|
||||
e(11, errbuf);
|
||||
em(11, errbuf);
|
||||
}
|
||||
|
||||
if(!empty_fds(fd_np2+1, &fds_read)) e(12, "read should NOT be set");
|
||||
if(!empty_fds(fd_np2+1, &fds_read)) em(12, "read should NOT be set");
|
||||
|
||||
/* Anonymous pipe */
|
||||
|
||||
|
@ -328,13 +324,13 @@ void do_parent(int child) {
|
|||
if(retval != 1) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"one fd should be set%s", (retval == 0 ? " (TIMEOUT)" : ""));
|
||||
e(13, errbuf);
|
||||
em(13, errbuf);
|
||||
}
|
||||
|
||||
/* Make sure write bit is set (and just 1 bit) */
|
||||
FD_ZERO(&fds_compare_write); FD_SET(fd_ap[1], &fds_compare_write);
|
||||
if(!compare_fds(fd_ap[1]+1, &fds_compare_write, &fds_write))
|
||||
e(14, "write should be set");
|
||||
em(14, "write should be set");
|
||||
|
||||
/* Intentionally test reading from pipe and letting it time out. */
|
||||
FD_SET(fd_ap[0], &fds_read);
|
||||
|
@ -345,14 +341,14 @@ void do_parent(int child) {
|
|||
end = time(NULL);
|
||||
|
||||
/* Did we time out? */
|
||||
if(retval != 0) e(15, "we should have timed out");
|
||||
if(retval != 0) em(15, "we should have timed out");
|
||||
|
||||
/* Did it take us approximately 1 second? */
|
||||
if((int) (end - start) != 1) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"time out is not 1 second (instead, it is %ld)",
|
||||
(long int) (end - start));
|
||||
e(16, errbuf);
|
||||
em(16, errbuf);
|
||||
}
|
||||
|
||||
/* Do another read, but this time we expect incoming data from child. */
|
||||
|
@ -363,12 +359,12 @@ void do_parent(int child) {
|
|||
retval = select(fd_ap[0]+1, &fds_read, NULL, NULL, &tv);
|
||||
|
||||
/* Correct amount of ready file descriptors? Just 1 read. */
|
||||
if(retval != 1) e(17, "one fd should be set");
|
||||
if(retval != 1) em(17, "one fd should be set");
|
||||
|
||||
/* Is the read bit set? And just 1 bit. */
|
||||
FD_ZERO(&fds_compare_read); FD_SET(fd_ap[0], &fds_compare_read);
|
||||
if(!compare_fds(fd_ap[0]+1, &fds_compare_read, &fds_read))
|
||||
e(18, "read should be set.");
|
||||
em(18, "read should be set.");
|
||||
|
||||
/* By convention fd_ap[0] is meant to be used for reading from the pipe and
|
||||
* fd_ap[1] is meant for writing, where fd_ap is a an anonymous pipe.
|
||||
|
|
42
test/t40e.c
42
test/t40e.c
|
@ -62,6 +62,8 @@
|
|||
#include <assert.h>
|
||||
#include <netdb.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define DO_HANDLEDATA 1
|
||||
#define DO_PAUSE 3
|
||||
#define DO_TIMEOUT 7
|
||||
|
@ -69,22 +71,13 @@
|
|||
#define NUMCHILDREN 5
|
||||
#define MAX_ERROR 10
|
||||
|
||||
int errct = 0, subtest = -1;
|
||||
char errbuf[1000];
|
||||
|
||||
void e(int n, char *s) {
|
||||
printf("Subtest %d, error %d, %s\n", subtest, n, s);
|
||||
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
exit(errct);
|
||||
}
|
||||
}
|
||||
|
||||
/* All *_fds routines are helping routines. They intentionally use FD_* macros
|
||||
in order to prevent making assumptions on how the macros are implemented.*/
|
||||
|
||||
int count_fds(int nfds, fd_set *fds) {
|
||||
#if 0
|
||||
static int count_fds(int nfds, fd_set *fds) {
|
||||
/* Return number of bits set in fds */
|
||||
int i, result = 0;
|
||||
assert(fds != NULL && nfds > 0);
|
||||
|
@ -93,8 +86,9 @@ int count_fds(int nfds, fd_set *fds) {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
int empty_fds(int nfds, fd_set *fds) {
|
||||
static int empty_fds(int nfds, fd_set *fds) {
|
||||
/* Returns nonzero if the first bits up to nfds in fds are not set */
|
||||
int i;
|
||||
assert(fds != NULL && nfds > 0);
|
||||
|
@ -102,7 +96,7 @@ int empty_fds(int nfds, fd_set *fds) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int compare_fds(int nfds, fd_set *lh, fd_set *rh) {
|
||||
static int compare_fds(int nfds, fd_set *lh, fd_set *rh) {
|
||||
/* Returns nonzero if lh equals rh up to nfds bits */
|
||||
int i;
|
||||
assert(lh != NULL && rh != NULL && nfds > 0);
|
||||
|
@ -115,7 +109,8 @@ int compare_fds(int nfds, fd_set *lh, fd_set *rh) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void dump_fds(int nfds, fd_set *fds) {
|
||||
#if 0
|
||||
static void dump_fds(int nfds, fd_set *fds) {
|
||||
/* Print a graphical representation of bits in fds */
|
||||
int i;
|
||||
if(fds != NULL && nfds > 0) {
|
||||
|
@ -123,8 +118,9 @@ void dump_fds(int nfds, fd_set *fds) {
|
|||
printf("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void do_child(int childno) {
|
||||
static void do_child(int childno) {
|
||||
int fd_sock, port;
|
||||
int retval;
|
||||
|
||||
|
@ -203,11 +199,11 @@ void do_child(int childno) {
|
|||
retval = select(fd_sock+1, NULL, &fds_write, NULL, &tv);
|
||||
|
||||
|
||||
if(retval <= 0) e(6, "expected one fd to be ready");
|
||||
if(retval <= 0) em(6, "expected one fd to be ready");
|
||||
|
||||
FD_ZERO(&fds_compare_write); FD_SET(fd_sock, &fds_compare_write);
|
||||
if(!compare_fds(fd_sock+1, &fds_compare_write, &fds_compare_write))
|
||||
e(7, "write should be set");
|
||||
em(7, "write should be set");
|
||||
}
|
||||
|
||||
if(close(fd_sock) < 0) {
|
||||
|
@ -218,7 +214,7 @@ void do_child(int childno) {
|
|||
exit(errct);
|
||||
}
|
||||
|
||||
void do_parent(void) {
|
||||
static void do_parent(void) {
|
||||
#if !defined(__minix)
|
||||
int yes = 1;
|
||||
#endif
|
||||
|
@ -317,7 +313,7 @@ void do_parent(void) {
|
|||
if(retval <= 0) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"two fds should be set%s", (retval == 0 ? " (TIMEOUT)" : ""));
|
||||
e(1, errbuf);
|
||||
em(1, errbuf);
|
||||
}
|
||||
|
||||
FD_ZERO(&fds_compare_read); FD_ZERO(&fds_compare_write);
|
||||
|
@ -327,10 +323,10 @@ void do_parent(void) {
|
|||
is not specified and the other side might have data ready for us to read
|
||||
*/
|
||||
if(!compare_fds(sockets[childresults]+1, &fds_compare_write, &fds_write))
|
||||
e(2, "write should be set");
|
||||
em(2, "write should be set");
|
||||
|
||||
if(!empty_fds(sockets[childresults]+1, &fds_error))
|
||||
e(3, "no error should be set");
|
||||
em(3, "no error should be set");
|
||||
}
|
||||
|
||||
|
||||
|
@ -356,13 +352,13 @@ void do_parent(void) {
|
|||
if(retval <= 0) {
|
||||
snprintf(errbuf, sizeof(errbuf),
|
||||
"one fd should be set%s", (retval == 0 ? " (TIMEOUT)" : ""));
|
||||
e(4, errbuf);
|
||||
em(4, errbuf);
|
||||
}
|
||||
|
||||
/* Check read bit is set */
|
||||
FD_ZERO(&fds_compare_read); FD_SET(fd_sock, &fds_compare_read);
|
||||
if(!compare_fds(fd_sock+1, &fds_compare_read, &fds_read))
|
||||
e(5, "read should be set");
|
||||
em(5, "read should be set");
|
||||
|
||||
|
||||
/* Accept incoming connection to unblock child 5 */
|
||||
|
|
39
test/t40f.c
39
test/t40f.c
|
@ -19,6 +19,8 @@
|
|||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define DO_HANDLEDATA 1
|
||||
#define DO_PAUSE 3
|
||||
#define DO_TIMEOUT 7
|
||||
|
@ -27,23 +29,14 @@
|
|||
#define DELTA(x,y) (x.tv_sec - y.tv_sec) * CLOCKS_PER_SEC \
|
||||
+ (x.tv_usec - y.tv_usec) * CLOCKS_PER_SEC / 1000000
|
||||
|
||||
int errct = 0, subtest = -1, got_signal = 0;
|
||||
int got_signal = 0;
|
||||
int fd_ap[2];
|
||||
|
||||
void catch_signal(int sig_no) {
|
||||
static void catch_signal(int sig_no) {
|
||||
got_signal = 1;
|
||||
}
|
||||
|
||||
void e(int n, char *s) {
|
||||
printf("Subtest %d, error %d, %s\n", subtest, n, s);
|
||||
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
exit(errct);
|
||||
}
|
||||
}
|
||||
|
||||
float compute_diff(struct timeval start, struct timeval end, float compare) {
|
||||
static float compute_diff(struct timeval start, struct timeval end, float compare) {
|
||||
/* Compute time difference. It is assumed that the value of start <= end. */
|
||||
clock_t delta;
|
||||
int seconds, hundreths;
|
||||
|
@ -60,7 +53,7 @@ float compute_diff(struct timeval start, struct timeval end, float compare) {
|
|||
return diff;
|
||||
}
|
||||
|
||||
void do_child(void) {
|
||||
static void do_child(void) {
|
||||
struct timeval tv;
|
||||
|
||||
/* Let the parent do initial read and write tests from and to the pipe. */
|
||||
|
@ -75,7 +68,7 @@ void do_child(void) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
void do_parent(int child) {
|
||||
static void do_parent(int child) {
|
||||
fd_set fds_read;
|
||||
struct timeval tv, start_time, end_time;
|
||||
int retval;
|
||||
|
@ -96,13 +89,13 @@ void do_parent(int child) {
|
|||
(void) gettimeofday(&end_time, NULL); /* Record ending time */
|
||||
|
||||
/* Did we time out? */
|
||||
if(retval != 0) e(1, "Should have timed out");
|
||||
if(retval != 0) em(1, "Should have timed out");
|
||||
|
||||
/* Approximately right? The standard does not specify how precise the timeout
|
||||
should be. Instead, the granularity is implementation-defined. In this
|
||||
test we assume that the difference should be no more than half a second.*/
|
||||
if(compute_diff(start_time, end_time, DO_PAUSE) > DO_DELTA)
|
||||
e(2, "Time difference too large");
|
||||
em(2, "Time difference too large");
|
||||
|
||||
/* Let's wait for another DO_PAUSE seconds, expressed as microseconds */
|
||||
FD_ZERO(&fds_read);
|
||||
|
@ -114,9 +107,9 @@ void do_parent(int child) {
|
|||
retval = select(fd_ap[0]+1, &fds_read, NULL, NULL, &tv);
|
||||
(void) gettimeofday(&end_time, NULL); /* Record ending time */
|
||||
|
||||
if(retval != 0) e(3, "Should have timed out");
|
||||
if(retval != 0) em(3, "Should have timed out");
|
||||
if(compute_diff(start_time, end_time, DO_PAUSE) > DO_DELTA)
|
||||
e(4, "Time difference too large");
|
||||
em(4, "Time difference too large");
|
||||
|
||||
/* Let's wait for another DO_PAUSE seconds, expressed in seconds and micro
|
||||
seconds. */
|
||||
|
@ -129,9 +122,9 @@ void do_parent(int child) {
|
|||
retval = select(fd_ap[0]+1, &fds_read, NULL, NULL, &tv);
|
||||
(void) gettimeofday(&end_time, NULL); /* Record ending time */
|
||||
|
||||
if(retval != 0) e(5, "Should have timed out");
|
||||
if(retval != 0) em(5, "Should have timed out");
|
||||
if(compute_diff(start_time, end_time, DO_PAUSE) > DO_DELTA)
|
||||
e(6, "Time difference too large");
|
||||
em(6, "Time difference too large");
|
||||
|
||||
/* Finally, we test if our timeout is interrupted by a signal */
|
||||
FD_ZERO(&fds_read);
|
||||
|
@ -143,11 +136,11 @@ void do_parent(int child) {
|
|||
retval = select(fd_ap[0]+1, &fds_read, NULL, NULL, &tv);
|
||||
(void) gettimeofday(&end_time, NULL); /* Record ending time */
|
||||
|
||||
if(retval != -1) e(7, "Should have been interrupted");
|
||||
if(retval != -1) em(7, "Should have been interrupted");
|
||||
if(compute_diff(start_time, end_time, DO_TIMEOUT) < DO_DELTA)
|
||||
e(8, "Failed to get interrupted by a signal");
|
||||
em(8, "Failed to get interrupted by a signal");
|
||||
|
||||
if(!got_signal) e(9, "Failed to get interrupted by a signal");
|
||||
if(!got_signal) em(9, "Failed to get interrupted by a signal");
|
||||
|
||||
waitpid(child, &retval, 0);
|
||||
exit(errct);
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define SIGNUM 10
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
|
||||
volatile int glov, gct;
|
||||
int errct;
|
||||
int subtest;
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv []);
|
||||
void test1a(void);
|
||||
|
|
|
@ -15,8 +15,9 @@ char *name[] = {"t10a", "t10b", "t10c", "t10d", "t10e", "t10f", "t10g",
|
|||
long prog[PROGBUF_LONGS];
|
||||
int psize;
|
||||
|
||||
#define MAX_ERROR 2
|
||||
#include "common.c"
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int main(void);
|
||||
void spawn(int n);
|
||||
|
|
|
@ -11,13 +11,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define ITERATIONS 10
|
||||
#define MAX_ERROR 1
|
||||
int max_error = 1;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int errct, subtest;
|
||||
char *envp[3] = {"spring", "summer", 0};
|
||||
char *passwd_file = "/etc/passwd";
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
void test11a(void);
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define NUM_TIMES 1000
|
||||
#define MAX_ERROR 2
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(void);
|
||||
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
char buffer[BLOCK_SIZE];
|
||||
|
||||
#define MAX_ERROR 2
|
||||
#include "common.c"
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int main(void);
|
||||
void quit(void);
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define TRIALS 100
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
char name[20] = {"TMP14."};
|
||||
int subtest = 1;
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(void);
|
||||
void quit(void);
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
#define STREQ(a, b) (strcmp((a), (b)) == 0)
|
||||
|
||||
char *it = "<UNSET>"; /* Routine name for message routines. */
|
||||
int errct; /* count errors */
|
||||
int waserror = 0; /* For exit status. */
|
||||
|
||||
char uctest[] = "\004\203"; /* For testing signedness of chars. */
|
||||
int charsigned; /* Result. */
|
||||
|
||||
#define MAX_ERROR 2
|
||||
#include "common.c"
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
void check(int thing, int number);
|
||||
void equal(char *a, char *b, int number);
|
||||
|
|
|
@ -9,12 +9,13 @@
|
|||
#include <utime.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest, passes;
|
||||
int V1filesystem = 0;
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv []);
|
||||
void test16init(void);
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
|
||||
#define NOCRASH 1 /* test11(), 2nd pipe */
|
||||
#define PDPNOHANG 1 /* test03(), write_standards() */
|
||||
#define MAX_ERROR 2
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define USER_ID 12
|
||||
#define GROUP_ID 1
|
||||
|
@ -61,7 +63,6 @@
|
|||
#define DUP "dup"
|
||||
#define UTIME "utime"
|
||||
|
||||
int errct;
|
||||
|
||||
/* "decl.c", created by Rene Montsma and Menno Wilcke */
|
||||
|
||||
|
@ -76,7 +77,6 @@ char *mode_fnames[MODES] = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rw
|
|||
|
||||
/* "test.c", created by Rene Montsma and Menno Wilcke */
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv []);
|
||||
void test(int mask);
|
||||
|
|
|
@ -64,8 +64,9 @@
|
|||
#define DUP "dup"
|
||||
#define UTIME "utime"
|
||||
|
||||
int errct;
|
||||
#define MAX_ERROR 2
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/* "decl.c", created by Rene Montsma and Menno Wilcke */
|
||||
|
||||
|
@ -78,7 +79,6 @@ char *fnames[8] = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"},
|
|||
|
||||
/* "test.c", created by Rene Montsma and Menno Wilcke */
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char **argv);
|
||||
void test(void);
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
#define NB 30L
|
||||
#define NBOUNDS 6
|
||||
|
||||
|
@ -20,7 +22,6 @@ char b[4] = {0, 1, 2, 3}, c[4] = {10, 20, 30, 40}, d[4] = {6, 7, 8, 9};
|
|||
long bounds[NBOUNDS] = {7, 9, 50, 519, 520, 40000L};
|
||||
char buff[30000];
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
void test19a(void);
|
||||
|
|
15
test/test2.c
15
test/test2.c
|
@ -11,13 +11,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define ITERATIONS 5
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int is, array[4], parsigs, parcum, sigct, cumsig, subtest;
|
||||
int iteration, kk = 0;
|
||||
char buf[2048];
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv []);
|
||||
void test2a(void);
|
||||
|
@ -63,13 +64,13 @@ void test2a()
|
|||
subtest = 1;
|
||||
if (pipe(fd) < 0) {
|
||||
printf("pipe error. errno= %d\n", errno);
|
||||
errct++;
|
||||
e(10);
|
||||
quit();
|
||||
}
|
||||
i = fork();
|
||||
if (i < 0) {
|
||||
printf("fork failed\n");
|
||||
errct++;
|
||||
e(11);
|
||||
quit();
|
||||
}
|
||||
if (i != 0) {
|
||||
|
@ -79,7 +80,7 @@ void test2a()
|
|||
for (q = 0; q < 8; q++) {
|
||||
if (write(fd[1], buf, 2048) < 0) {
|
||||
printf("write pipe err. errno=%d\n", errno);
|
||||
errct++;
|
||||
e(12);
|
||||
quit();
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +88,7 @@ void test2a()
|
|||
wait(&q);
|
||||
if (q != 256 * 58) {
|
||||
printf("wrong exit code %d\n", q);
|
||||
errct++;
|
||||
e(13);
|
||||
quit();
|
||||
}
|
||||
} else {
|
||||
|
@ -97,7 +98,7 @@ void test2a()
|
|||
n = read(fd[0], buf, 512);
|
||||
if (n != 512) {
|
||||
printf("read yielded %d bytes, not 512\n", n);
|
||||
errct++;
|
||||
e(14);
|
||||
quit();
|
||||
}
|
||||
for (j = 0; j < n; j++)
|
||||
|
|
|
@ -20,14 +20,15 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int superuser;
|
||||
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define ITERATIONS 1
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv []);
|
||||
void test21a(void);
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4 /* Stop after ``MAX_ERROR'' errors. */
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 2
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
void test22a(void);
|
||||
int mode(char *filename);
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 3
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
|
|
|
@ -20,10 +20,11 @@ void test24c(void);
|
|||
void makelongnames(void);
|
||||
|
||||
#define OVERFLOW_DIR_NR (OPEN_MAX + 1)
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 5
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define DIRENT0 ((struct dirent *) NULL)
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 2
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
|
@ -20,7 +22,6 @@
|
|||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||
#define Mkfifo(f) if (mkfifo(f,0777)!=0) printf("Can't make fifo %s\n", f)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
void test26a(void);
|
||||
void test26b(void);
|
||||
|
|
|
@ -13,13 +13,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define MODE_MASK (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID)
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 2
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int superuser;
|
||||
char *MaxName; /* Name of maximum length */
|
||||
|
|
|
@ -20,10 +20,11 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 2
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define DIRENT0 ((struct dirent *) NULL)
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
|
@ -34,7 +36,6 @@
|
|||
#define IS_CLOEXEC(fd) ((fcntl(fd, F_GETFD) & FD_CLOEXEC) == FD_CLOEXEC)
|
||||
#define SET_CLOEXEC(fd) fcntl(fd, F_SETFD, FD_CLOEXEC)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int superuser;
|
||||
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define ITERATIONS 10
|
||||
#define MAX_ERROR 0
|
||||
int max_error = 0;
|
||||
#include "common.h"
|
||||
|
||||
#define SIZE 64
|
||||
|
||||
int subtest;
|
||||
char el_weirdo[] = "\n\t\\\e@@!!##\e\e\n\n";
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv []);
|
||||
void test3a(void);
|
||||
|
|
|
@ -19,10 +19,11 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 2
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
|
@ -20,7 +22,6 @@
|
|||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||
#define Creat(f) if (close(creat(f,0777))!=0) printf("Can't creat %s\n",f)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int superuser;
|
||||
char *MaxName; /* Name of maximum length */
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 1
|
||||
int max_error = 1;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 2
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
|
|
|
@ -19,11 +19,12 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 4
|
||||
#define N 100
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define ALL_RWXB (S_IRWXU | S_IRWXG | S_IRWXO)
|
||||
#define ALL_SETB (S_ISUID | S_ISGID)
|
||||
|
|
|
@ -14,11 +14,12 @@
|
|||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 1
|
||||
int max_error = 1;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
#define N 100
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
|
|
|
@ -12,14 +12,15 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 10
|
||||
|
||||
#define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
|
||||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int superuser;
|
||||
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
|
||||
#define ITERATIONS 2
|
||||
#define SIGS 14
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int iteration, cumsig, sig1, sig2;
|
||||
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 3
|
||||
#define BUF_SIZE 1024
|
||||
|
||||
|
@ -26,7 +28,6 @@
|
|||
#define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
|
||||
#define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int superuser;
|
||||
int signumber = 0;
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
#include <stdio.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/sys_config.h>
|
||||
#define MAX_ERROR 1
|
||||
#include "common.c"
|
||||
int max_error = 1;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
void test39a(void);
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@ int s, i, fd, nextb;
|
|||
char *tempfile = "test4.temp";
|
||||
char buf[1024];
|
||||
|
||||
#define MAX_ERROR 2
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(void);
|
||||
void subr(void);
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define MAX_ERROR 5
|
||||
#include "common.c"
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *tests[] = {"t40a", "t40b", "t40c", "t40d", "t40e", "t40f"};
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
#include <errno.h>
|
||||
|
||||
#define ITERATIONS 3
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
/* we have to keep in mind the millisecond values are rounded up */
|
||||
#define UPPERUSEC(us) ((us)+(1000000/system_hz))
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
#include <sys/ptrace.h>
|
||||
|
||||
#define ITERATIONS 3
|
||||
#define MAX_ERROR 4
|
||||
#include "common.c"
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define _WIFSTOPPED(s) (WIFSTOPPED(s) && !WIFSIGNALED(s) && !WIFEXITED(s))
|
||||
#define _WIFSIGNALED(s) (!WIFSTOPPED(s) && WIFSIGNALED(s) && !WIFEXITED(s))
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest;
|
||||
static const char *executable;
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define ERR (e(__LINE__))
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define MAX_ERROR 2
|
||||
#include "common.c"
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest = 0;
|
||||
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
|
||||
#define MAX_ERROR 4
|
||||
#include "common.c"
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/* test strtol */
|
||||
#define TYPE long
|
||||
|
|
|
@ -32,11 +32,7 @@ static void GLUE(e, TYPE_FUNC)(int n, const char *s, TYPE result, int base)
|
|||
/* watch out: don't overwrite the static buffer in make_string */
|
||||
printf("Subtest %s, error %d, errno=%d, s=\"%s\", base=%d, ", TOSTRING(TYPE_FUNC), n, errno, s, base);
|
||||
printf("result=%s\n", GLUE(make_string, TYPE_FUNC)(result, base));
|
||||
if (errct++ > MAX_ERROR)
|
||||
{
|
||||
printf("Too many errors; test aborted\n");
|
||||
exit(1);
|
||||
}
|
||||
e(7);
|
||||
}
|
||||
|
||||
static void GLUE(test_string, TYPE_FUNC)(const char *s, TYPE value, int base)
|
||||
|
|
|
@ -28,7 +28,9 @@ void group_test_4(void);
|
|||
void group_test_5(void);
|
||||
int dotest(void (*testfunc)(void));
|
||||
|
||||
#define MAX_ERROR 5
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
#define IMAGINARY_GID 100
|
||||
#define IMAGINARY_GID_STR "100"
|
||||
#define IMAGINARY_UID 101
|
||||
|
@ -37,7 +39,6 @@ int dotest(void (*testfunc)(void));
|
|||
setgid((IMAGINARY_GID) + 1 ); \
|
||||
setuid(IMAGINARY_UID); \
|
||||
} while(0)
|
||||
#include "common.c"
|
||||
|
||||
int subtest = -1, errorct = 0;
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
#include "common.c"
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/* maximum allowed FP difference for our tests */
|
||||
#define EPSILON 0.00000000023283064365386962890625 /* 2^(-32) */
|
||||
|
|
|
@ -6,9 +6,10 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
#define err() e(__LINE__)
|
||||
#include "common.c"
|
||||
|
||||
static void printstr(const char *s)
|
||||
{
|
||||
|
@ -253,7 +254,7 @@ static void memsetl(void *s, unsigned long c, size_t n)
|
|||
p[i] = c >> (8 * (i % sizeof(c)));
|
||||
}
|
||||
|
||||
void test_getnameinfo(
|
||||
static void test_getnameinfo(
|
||||
unsigned long ipaddr,
|
||||
unsigned short port,
|
||||
const char *exp_node,
|
||||
|
|
|
@ -10,8 +10,9 @@
|
|||
|
||||
#define ERR e(__LINE__)
|
||||
|
||||
#define MAX_ERROR 4
|
||||
#include "common.c"
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define TEST_PRINTF(type, macro, value, result) \
|
||||
{ \
|
||||
|
|
|
@ -11,13 +11,14 @@
|
|||
#include <string.h>
|
||||
|
||||
#define ITERATIONS 2
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest;
|
||||
int zero[1024];
|
||||
int sigmap[5] = {9, 10, 11};
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
void test5a(void);
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#include <assert.h>
|
||||
|
||||
#define ITERATIONS 1
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define TESTFILE "testfile"
|
||||
#define TESTSIZE 4096
|
||||
#define THRESHOLD 1048576
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
void prepare(void);
|
||||
|
|
|
@ -29,12 +29,13 @@ void just_exit(void);
|
|||
void test_brk(void);
|
||||
void verify_main_reenter(void);
|
||||
|
||||
#define MAX_ERROR 5
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
#define SSIZE 32768
|
||||
#define ROUNDS 10
|
||||
#define SWAPS 10
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int subtest;
|
||||
ucontext_t ctx[3];
|
||||
|
@ -130,7 +131,7 @@ void do_parent(void)
|
|||
/* Returning to main thread through uc_link */
|
||||
}
|
||||
|
||||
void fail(void)
|
||||
static void fail(void)
|
||||
{
|
||||
/* Shouldn't get here */
|
||||
err(5, 1);
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
|
||||
#define ROUNDS 20
|
||||
#define SWAPS 40
|
||||
#define MAX_ERROR 5
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int pipefdc[2];
|
||||
int pipefdp[2];
|
||||
|
|
|
@ -8,10 +8,11 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#define ERR err(__LINE__)
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define TIMED 0
|
||||
|
||||
#include "common.c"
|
||||
|
||||
static volatile int expect_SIGFPE;
|
||||
static u64_t i, j, k;
|
||||
|
@ -27,10 +28,7 @@ static void err(int line)
|
|||
ex64hi(k), ex64lo(k));
|
||||
|
||||
/* quit after too many errors */
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
quit();
|
||||
}
|
||||
e(7);
|
||||
}
|
||||
|
||||
#define LENGTHOF(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_ERROR 3
|
||||
#include "common.c"
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest = -1;
|
||||
|
||||
void do_test(void)
|
||||
static void do_test(void)
|
||||
{
|
||||
int fd;
|
||||
char *wbuf, *rbuf;
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
#define TRIALS 10
|
||||
#define SIZE 65536
|
||||
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest;
|
||||
char *filename = "statvfs_test_XXXXXX";
|
||||
#include "common.c"
|
||||
|
||||
void create_file(void)
|
||||
{
|
||||
|
|
|
@ -57,10 +57,11 @@
|
|||
/* Maximum number of errors that we'll allow to occur before this test
|
||||
* program gives us and quits.
|
||||
*/
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
/* Use the common testing code instead of reinventing the wheel. */
|
||||
#include "common.c"
|
||||
|
||||
/* path of the unix domain socket */
|
||||
#define TEST_SUN_PATH "test.sock"
|
||||
|
@ -131,12 +132,7 @@ void test_fail_fl(char *msg, char *file, int line)
|
|||
free(timestamp);
|
||||
timestamp = NULL;
|
||||
}
|
||||
errct++;
|
||||
if (errct++ > MAX_ERROR) {
|
||||
printf("Too many errors; test aborted\n");
|
||||
quit();
|
||||
exit(1);
|
||||
}
|
||||
e(7);
|
||||
}
|
||||
#define test_fail(msg) test_fail_fl(msg, __FILE__, __LINE__)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ void check_context_loop(void);
|
|||
|
||||
unsigned long newstate[REGS], origstate[REGS];
|
||||
|
||||
void handler(int signal)
|
||||
static void handler(int signal)
|
||||
{
|
||||
int st;
|
||||
sigset_t set, oset;
|
||||
|
|
|
@ -22,11 +22,12 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
int subtest = -1;
|
||||
#define MAX_ERROR 999 /* Effectively no limit. This is necessary as this
|
||||
int max_error = 999; /* Effectively no limit. This is necessary as this
|
||||
* test tries to undo errors and should therefore not
|
||||
* preemptively exit, as that would leave the FS
|
||||
* in a corrupted state. */
|
||||
#include "common.c"
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define TEST_PATH "a/b/c"
|
||||
#define INTEGR_MSG "You might want to check fs integrity\n"
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
#define event_t mthread_event_t
|
||||
#define rwlock_t mthread_rwlock_t
|
||||
|
||||
#define MAX_ERROR 5
|
||||
#include "common.c"
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int errct;
|
||||
static int count, condition_met;
|
||||
static int th_a, th_b, th_c, th_d, th_e, th_f, th_g, th_h;
|
||||
static int mutex_a_step, mutex_b_step, mutex_c_step;
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest = 1;
|
||||
int zilch[5000];
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(int argc, char *argv []);
|
||||
void test6a(void);
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_ERROR 5
|
||||
#include "common.c"
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
int subtest = -1;
|
||||
|
||||
|
@ -97,7 +98,7 @@ void test_setuid(void)
|
|||
|
||||
}
|
||||
|
||||
void test_setugid(void)
|
||||
static void test_setugid(void)
|
||||
{
|
||||
/* Execve a new process that has setuid and setgid bits set */
|
||||
subtest = 5;
|
||||
|
@ -233,7 +234,7 @@ void test_self(void)
|
|||
}
|
||||
}
|
||||
|
||||
void switch_to_su(void)
|
||||
static void switch_to_su(void)
|
||||
{
|
||||
subtest = 0;
|
||||
if (setuid(0) != 0) e(1);
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_ERROR 5
|
||||
#include "common.c"
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
void dangling_slink(int sub_test, char const slink_to[PATH_MAX]);
|
||||
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include <sys/wait.h>
|
||||
#include <machine/fpu.h>
|
||||
|
||||
#define MAX_ERROR 1
|
||||
#include "common.c"
|
||||
int max_error = 1;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
double state = 2.0;
|
||||
static int count;
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#define MAX_ERROR 2
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "magic.h"
|
||||
#include "common.c"
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#define MAX_ERROR 2
|
||||
int max_error = 2;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "magic.h"
|
||||
#include "common.c"
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_ERROR 0
|
||||
#include "common.c"
|
||||
int max_error = 0;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#define TESTMNT "testmnt"
|
||||
#define TESTFILE "test.txt"
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define MAX_ERROR 10
|
||||
int max_error = 10;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
#define RESULTSNAME desired
|
||||
#define SUBRESULTS 131
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_ERROR 5
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
#define CLOEXEC_PORT 3490
|
||||
#define FORK_PORT 3491
|
||||
#include "common.c"
|
||||
|
||||
static int fd = 0;
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_ERROR 5
|
||||
#include "common.c"
|
||||
int max_error = 5;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
void copy_subtests(void);
|
||||
void test_pipe_cloexec(void);
|
||||
|
|
|
@ -13,14 +13,15 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define TRIALS 100
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#ifndef DEBUG
|
||||
#define DEBUG 0
|
||||
#endif
|
||||
|
||||
int subtest = 1;
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int main(void);
|
||||
void quit(void);
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#include <setjmp.h>
|
||||
|
||||
#define ITERATIONS 4
|
||||
#define MAX_ERROR 3
|
||||
int max_error = 3;
|
||||
#include "common.h"
|
||||
|
||||
#define ITEMS 32
|
||||
#define READ 10
|
||||
#define WRITE 20
|
||||
|
@ -28,7 +30,6 @@
|
|||
|
||||
char buf[ITEMS] = {0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8,9};
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int subtes, xfd;
|
||||
int whence = SEEK_SET, func_code = F_SETLK;
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
#define ITERATIONS 60
|
||||
|
||||
#define Fstat(a,b) if (fstat(a,b) != 0) printf("Can't fstat %d\n", a)
|
||||
#define Time(t) if (time(t) == (time_t)-1) printf("Time error\n")
|
||||
|
||||
#include "common.c"
|
||||
|
||||
int subtest;
|
||||
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
|
||||
#define MAX_ERROR 4
|
||||
int max_error = 4;
|
||||
#include "common.h"
|
||||
|
||||
|
||||
#include "common.c"
|
||||
|
||||
char *tmpa;
|
||||
|
||||
|
|
Loading…
Reference in a new issue