From: Johannes S. <js...@co...> - 2002-05-24 14:15:55
|
Hi, ltp-20020507 / current CVS does not compile on MIPS, because some i386 specifics were used in signal handlers in the kernel/mem/mtest06/mmap1.c and kernel/mem/mtest06/shmat1.c test cases. While I was at it I cleaned up some warnings regarding printf("%x") used for printing pointers, vs. printf("%p"). Also, SIGSTKFLT and SIGUNUSED are not defined on MIPS (kernel/syscalls/signal/* test cases). And some test cases #include <curses.h>, which is not present on my (semi-embedded) MIPS system, and is unnecessary for the tests. Since my MIPS platform is rather slow, I also improved some of the Makefiles which caused unnecessary recompiles/relinks. Regards, Johannes Index: testcases/kernel/fs/fs_perms/Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/fs/fs_perms/Makefile,v retrieving revision 1.3 diff -u -r1.3 Makefile --- testcases/kernel/fs/fs_perms/Makefile 31 Jan 2002 16:19:07 -0000 1.3 +++ testcases/kernel/fs/fs_perms/Makefile 23 May 2002 15:55:50 -0000 @@ -1,6 +1,8 @@ TARGETS=fs_perms -all: fs_perms.o testx.o +all: fs_perms testx.file +fs_perms: $(CC) fs_perms.o -o fs_perms +testx.file: $(CC) testx.o -o testx.file install: @for i in $(TARGETS) ; do ln -f $$i ../../../bin/$$i ; done Index: testcases/kernel/fs/lftest/Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/fs/lftest/Makefile,v retrieving revision 1.3 diff -u -r1.3 Makefile --- testcases/kernel/fs/lftest/Makefile 29 Jan 2002 21:22:57 -0000 1.3 +++ testcases/kernel/fs/lftest/Makefile 23 May 2002 15:55:50 -0000 @@ -1,10 +1,11 @@ TARGETS=lftest CFLAGS+= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -all: lftest.o +all: lftest +lftest: $(CC) lftest.o -o lftest install: @for i in $(TARGETS) ; do ln -f $$i ../../../bin/$$i ; done -bigftool.o: lftest.c +lftest.o: lftest.c $(CC) -c lftest.c clean: rm -f *.o lftest Index: testcases/kernel/io/disktest/Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/io/disktest/Makefile,v retrieving revision 1.1 diff -u -r1.1 Makefile --- testcases/kernel/io/disktest/Makefile 15 Mar 2002 21:33:56 -0000 1.1 +++ testcases/kernel/io/disktest/Makefile 23 May 2002 15:55:50 -0000 @@ -59,7 +59,8 @@ CFLAGS= -Wall -O -g -D"_LARGEFILE64_SOURCE" -D"_FILE_OFFSET_BITS=64" #CC=gcc -all: threading.o childmain.o globals.o main.o usage.o sfunc.o parse.o defs.h +all: disktest +disktest: threading.o childmain.o globals.o main.o usage.o sfunc.o parse.o defs.h $(CC) $(CFLAGS) -lpthread -o disktest threading.o main.o usage.o sfunc.o parse.o childmain.o globals.o main.o: main.c main.h sfunc.h usage.h defs.h $(CC) $(CFLAGS) -c -o main.o main.c Index: testcases/kernel/io/stress_floppy/Makefile =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/io/stress_floppy/Makefile,v retrieving revision 1.4 diff -u -r1.4 Makefile --- testcases/kernel/io/stress_floppy/Makefile 15 Mar 2002 21:38:24 -0000 1.4 +++ testcases/kernel/io/stress_floppy/Makefile 23 May 2002 15:55:50 -0000 @@ -1,4 +1,4 @@ -all: clean +all: install: generate ln -f stress_floppy ../../../bin Index: testcases/kernel/mem/mtest06/mmap1.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/mem/mtest06/mmap1.c,v retrieving revision 1.6 diff -u -r1.6 mmap1.c --- testcases/kernel/mem/mtest06/mmap1.c 28 Mar 2002 16:12:52 -0000 1.6 +++ testcases/kernel/mem/mtest06/mmap1.c 23 May 2002 15:55:50 -0000 @@ -136,16 +136,19 @@ int code, struct ucontext *ut)/* contains pointer to sigcontext structure */ { +#ifdef __i386__ unsigned long except; /* exception type. */ int ret = 0; /* exit code from signal handler. */ struct sigcontext *scp = /* pointer to sigcontext structure */ (struct sigcontext *)&ut->uc_mcontext; +#endif if (signal == SIGALRM) { fprintf(stdout, "Test ended, success\n"); exit(0); } +#ifdef __i386__ else { except = scp->trapno; @@ -204,6 +207,10 @@ } else exit (-1); +#else + fprintf(stderr, "caught signal %d -- exiting.\n", signal); + exit (-1); +#endif } @@ -343,7 +350,7 @@ } if(verbose_print) - fprintf(stderr, "map address = %#lx\n", map_address); + fprintf(stderr, "map address = %p\n", map_address); prtln(); @@ -392,25 +399,25 @@ fprintf(stdout, "read_mem()arguments are:\n" "number of reads to be performed - arg[2]: %d\n" - "read from address %#lx\n", + "read from address %p\n", (int)rmargs[2], (long *)map_address); mem_content = malloc(sizeof(char) * rd_index); while (rd_index++ < (int)rmargs[2]) { - fprintf(stdout, "pid[%d] - read contents of memory %#x %d times\n", + fprintf(stdout, "pid[%d] - read contents of memory %p %ld times\n", getpid(), map_address, rmargs[2]); if (verbose_print) fprintf(stdout, - "read_mem() in while loop %d times to go %d times\n", - (int)rd_index, (int)rmargs[2]); + "read_mem() in while loop %d times to go %ld times\n", + rd_index, rmargs[2]); usleep(1); if (setjmp(jmpbuf) == 1) { if (verbose_print) fprintf(stdout, - "page fault ocurred due a read after an unmap from %#x\n", + "page fault ocurred due a read after an unmap from %p\n", map_address); } else @@ -502,18 +509,20 @@ static struct signal_info { - int signum; /* signal number that hasto be handled */ char *signame; /* name of the signal to be handled. */ } sig_info[] = + int signum; /* signal number that hasto be handled */ + char *signame; /* name of the signal to be handled. */ + } sig_info[] = { - SIGHUP,"SIGHUP", - SIGINT,"SIGINT", - SIGQUIT,"SIGQUIT", - SIGABRT,"SIGABRT", - SIGBUS,"SIGBUS", - SIGSEGV,"SIGSEGV", - SIGALRM, "SIGALRM", - SIGUSR1,"SIGUSR1", - SIGUSR2,"SIGUSR2", - -1, "ENDSIG" + { SIGHUP,"SIGHUP" }, + { SIGINT,"SIGINT" }, + { SIGQUIT,"SIGQUIT" }, + { SIGABRT,"SIGABRT" }, + { SIGBUS,"SIGBUS" }, + { SIGSEGV,"SIGSEGV" }, + { SIGALRM, "SIGALRM" }, + { SIGUSR1,"SIGUSR1" }, + { SIGUSR2,"SIGUSR2" }, + { -1, "ENDSIG" } }; /* set up the default values */ @@ -636,7 +645,7 @@ if (!status[thrd_ndx]) { fprintf(stderr, - "thread [%d] - process exited with errors %d\n", + "thread [%ld] - process exited with errors %d\n", thid[thrd_ndx], status[thrd_ndx]); exit (-1); } Index: testcases/kernel/mem/mtest06/shmat1.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/mem/mtest06/shmat1.c,v retrieving revision 1.4 diff -u -r1.4 shmat1.c --- testcases/kernel/mem/mtest06/shmat1.c 20 Nov 2001 00:42:22 -0000 1.4 +++ testcases/kernel/mem/mtest06/shmat1.c 23 May 2002 15:55:50 -0000 @@ -114,16 +114,19 @@ int code, struct ucontext *ut)/* contains pointer to sigcontext structure */ { +#ifdef __i386__ unsigned long except; /* exception type. */ int ret = 0; /* exit code from signal handler. */ struct sigcontext *scp = /* pointer to sigcontext structure */ (struct sigcontext *)&ut->uc_mcontext; +#endif if (signal == SIGALRM) { fprintf(stdout, "Test ended, success\n"); exit(0); } +#ifdef __i386__ else { except = scp->trapno; @@ -183,6 +186,10 @@ } else exit (-1); +#else + fprintf(stderr, "caught signal %d -- exiting.\n", signal); + exit (-1); +#endif } @@ -285,7 +292,7 @@ if ((map_address = shmat(shmkey, (void *)0, SHMLBA)) == (void *)-1) { - fprintf(stderr, "shmat_shmat(): map address = %d\n", + fprintf(stderr, "shmat_shmat(): map address = %p\n", map_address); perror("shmat_shmdt(): shmat()"); exit_val = -1; @@ -299,7 +306,7 @@ } fprintf(stdout, - "Map address = %#x\nNum iter: [%d] Total Num Iter: [%d]\n", + "Map address = %p\nNum iter: [%d] Total Num Iter: [%d]\n", map_address, shm_ndx, (int)locargs[0]); usleep(0); sched_yield(); @@ -354,11 +361,11 @@ if (sigsetjmp(jmpbuf,0) == 1) { fprintf(stdout, - "page fault ocurred due a write after an shmdt from [%#x]\n", + "page fault ocurred due a write after an shmdt from [%p]\n", map_address); } - fprintf(stdout, "write_to_mem(): memory address: [%#x]\n", + fprintf(stdout, "write_to_mem(): memory address: [%p]\n", map_address); (char *)map_address = "Y"; //memset(map_address, 'Y', fsize); @@ -396,13 +403,13 @@ while (read_ndx++ < (int)locargs[0]) { - fprintf(stdout, "read_from_mem(): memory address: [%#x]\n", + fprintf(stdout, "read_from_mem(): memory address: [%p]\n", map_address); if (sigsetjmp(jmpbuf,0) == 1) { fprintf(stdout, - "page fault ocurred due a read after an shmdt from %#x\n", + "page fault ocurred due a read after an shmdt from %p\n", map_address); } @@ -437,6 +444,7 @@ /* exits with a 0 on success. */ /* */ /******************************************************************************/ +int main(int argc, /* number of input parameters. */ char **argv) /* pointer to the command line arguments. */ { @@ -575,4 +583,5 @@ fprintf(stdout, "TEST PASSED\n"); exit (0); } + return 0; } Index: testcases/kernel/syscalls/signal/signal03.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/signal/signal03.c,v retrieving revision 1.1 diff -u -r1.1 signal03.c --- testcases/kernel/syscalls/signal/signal03.c 27 Aug 2001 22:15:15 -0000 1.1 +++ testcases/kernel/syscalls/signal/signal03.c 23 May 2002 15:55:52 -0000 @@ -73,9 +73,17 @@ int siglist[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGIOT, SIGBUS, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, SIGALRM, - SIGTERM, SIGSTKFLT, SIGCHLD, SIGCONT, SIGTSTP, SIGTTIN, + SIGTERM, +#ifdef SIGSTKFLT + SIGSTKFLT, +#endif + SIGCHLD, SIGCONT, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, - SIGWINCH, SIGIO, SIGPWR, SIGSYS, SIGUNUSED}; + SIGWINCH, SIGIO, SIGPWR, SIGSYS, +#ifdef SIGUNUSED + SIGUNUSED +#endif +}; main(int ac, char **av) { Index: testcases/kernel/syscalls/signal/signal05.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/signal/signal05.c,v retrieving revision 1.2 diff -u -r1.2 signal05.c --- testcases/kernel/syscalls/signal/signal05.c 14 May 2002 16:50:07 -0000 1.2 +++ testcases/kernel/syscalls/signal/signal05.c 23 May 2002 15:55:52 -0000 @@ -71,9 +71,17 @@ int siglist[] = { SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT, SIGIOT, SIGBUS, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE, SIGALRM, - SIGTERM, SIGSTKFLT, SIGCHLD, SIGCONT, SIGTSTP, SIGTTIN, + SIGTERM, +#ifdef SIGSTKFLT + SIGSTKFLT, +#endif + SIGCHLD, SIGCONT, SIGTSTP, SIGTTIN, SIGTTOU, SIGURG, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, - SIGWINCH, SIGIO, SIGPWR, SIGSYS, SIGUNUSED}; + SIGWINCH, SIGIO, SIGPWR, SIGSYS, +#ifdef SIGUNUSED + SIGUNUSED +#endif +}; int pass = 0; main(int ac, char **av) Index: testcases/network/ipv6/echo6/echoes6.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/network/ipv6/echo6/echoes6.c,v retrieving revision 1.2 diff -u -r1.2 echoes6.c --- testcases/network/ipv6/echo6/echoes6.c 11 Jan 2002 18:40:43 -0000 1.2 +++ testcases/network/ipv6/echo6/echoes6.c 23 May 2002 15:55:52 -0000 @@ -19,9 +19,11 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> -#include <curses.h> #include <fcntl.h> #include <sys/stat.h> + +#define TRUE 1 +#define FALSE 0 main (int argc,char *argv[],char *env[]) { Index: testcases/network/tcp_cmds/echo/echoes.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/network/tcp_cmds/echo/echoes.c,v retrieving revision 1.4 diff -u -r1.4 echoes.c --- testcases/network/tcp_cmds/echo/echoes.c 11 Jan 2002 18:43:12 -0000 1.4 +++ testcases/network/tcp_cmds/echo/echoes.c 23 May 2002 15:55:52 -0000 @@ -19,9 +19,11 @@ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> -#include <curses.h> #include <fcntl.h> #include <sys/stat.h> + +#define TRUE 1 +#define FALSE 0 main (int argc,char *argv[],char *env[]) { |