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
/* 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>
#include <stdio.h>
#include <sys/statvfs.h>
-int common_test_nr = -1, errct = 0, subtest;
+#include "common.h"
-#define e(errn) e_f(__FILE__, __LINE__, (errn))
+int common_test_nr = -1, errct = 0, subtest;
-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;
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);
--- /dev/null
+
+#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;
+
#define MAGIC6 0x17D1FF
long hellodriver(void);
+long modfunction(long, long *, long);
#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;
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
#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;
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);
}
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);
}
/* 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. */
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);
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);
#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];
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 */
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;
* 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);
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);
#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. */
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);
}
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);
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);
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) {
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;
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);
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
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);
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 */
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);
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. */
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.
#include <assert.h>
#include <netdb.h>
+#include "common.h"
+
#define DO_HANDLEDATA 1
#define DO_PAUSE 3
#define DO_TIMEOUT 7
#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);
}
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);
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);
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) {
printf("\n");
}
}
+#endif
-void do_child(int childno) {
+static void do_child(int childno) {
int fd_sock, port;
int retval;
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) {
exit(errct);
}
-void do_parent(void) {
+static void do_parent(void) {
#if !defined(__minix)
int yes = 1;
#endif
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);
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");
}
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 */
#include <string.h>
#include <signal.h>
+#include "common.h"
+
#define DO_HANDLEDATA 1
#define DO_PAUSE 3
#define DO_TIMEOUT 7
#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;
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. */
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;
(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);
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. */
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);
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);
#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);
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);
#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);
#include <stdio.h>
#define NUM_TIMES 1000
-#define MAX_ERROR 2
+int max_error = 2;
+#include "common.h"
+
-#include "common.c"
int main(void);
char buffer[BLOCK_SIZE];
-#define MAX_ERROR 2
-#include "common.c"
+int max_error = 2;
+#include "common.h"
+
int main(void);
void quit(void);
#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);
#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);
#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);
#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
#define DUP "dup"
#define UTIME "utime"
-int errct;
/* "decl.c", created by Rene Montsma and Menno Wilcke */
/* "test.c", created by Rene Montsma and Menno Wilcke */
-#include "common.c"
int main(int argc, char *argv []);
void test(int mask);
#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 */
/* "test.c", created by Rene Montsma and Menno Wilcke */
-#include "common.c"
int main(int argc, char **argv);
void test(void);
#include <unistd.h>
#include <stdio.h>
-#define MAX_ERROR 3
+int max_error = 3;
+#include "common.h"
+
#define NB 30L
#define NBOUNDS 6
long bounds[NBOUNDS] = {7, 9, 50, 519, 520, 40000L};
char buff[30000];
-#include "common.c"
int main(int argc, char *argv[]);
void test19a(void);
#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);
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) {
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();
}
}
wait(&q);
if (q != 256 * 58) {
printf("wrong exit code %d\n", q);
- errct++;
+ e(13);
quit();
}
} else {
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++)
#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;
#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);
#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);
#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)
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)
#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)
#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 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);
#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 */
#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)
#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 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;
#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);
#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)
#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)
#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)
#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 */
#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)
#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)
#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)
#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;
#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;
#include <signal.h>
#include <stdio.h>
-#define MAX_ERROR 4
+int max_error = 4;
+#include "common.h"
+
#define ITERATIONS 3
#define BUF_SIZE 1024
#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;
#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);
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);
#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"};
#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))
#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))
#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__))
#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;
#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
/* 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)
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
setgid((IMAGINARY_GID) + 1 ); \
setuid(IMAGINARY_UID); \
} while(0)
-#include "common.c"
int subtest = -1, errorct = 0;
#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) */
#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)
{
p[i] = c >> (8 * (i % sizeof(c)));
}
-void test_getnameinfo(
+static void test_getnameinfo(
unsigned long ipaddr,
unsigned short port,
const char *exp_node,
#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) \
{ \
#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);
#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);
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];
/* Returning to main thread through uc_link */
}
-void fail(void)
+static void fail(void)
{
/* Shouldn't get here */
err(5, 1);
#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];
#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;
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]))
#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;
#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)
{
/* 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"
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__)
unsigned long newstate[REGS], origstate[REGS];
-void handler(int signal)
+static void handler(int signal)
{
int st;
sigset_t set, oset;
#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"
#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;
#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);
#include <stdio.h>
#include <unistd.h>
-#define MAX_ERROR 5
-#include "common.c"
+int max_error = 5;
+#include "common.h"
+
int subtest = -1;
}
-void test_setugid(void)
+static void test_setugid(void)
{
/* Execve a new process that has setuid and setgid bits set */
subtest = 5;
}
}
-void switch_to_su(void)
+static void switch_to_su(void)
{
subtest = 0;
if (setuid(0) != 0) e(1);
#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]);
#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;
#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[])
{
#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[])
{
#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"
#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
#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;
#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);
#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);
#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
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;
#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;
#include <setjmp.h>
#include <signal.h>
-#define MAX_ERROR 4
+int max_error = 4;
+#include "common.h"
+
-#include "common.c"
char *tmpa;