Applied Coldfire patch from Jody McIntyre:
- Make the fdopen workaround blackfin-specific (not needed on Coldfire.)
- getdents01: gcc 2.95 does not like declarations in the middle
of functions, so move getdents to the top.
- Add LDFLAGS to the following Makefiles:
- Add -D_USC_LIB_ for Coldfire builds to the following Makefiles: creat,
execve, fchdir, kill, mkdir, open, rename, rmdir, sched_setscheduler,
vhangup, ipc/lib. This avoids symbol conflicts reported by gcc 2.95.
- Skip the following syscall tests on Coldfire: madvise, mlock, munlock.
These system calls are not implemented.
- IPC: Modify the headers and Makefiles to avoid duplicate definitions of
msgkey on Coldfire.
- msgctl08, msgctl09: Lower MAXNPROCS to a value that will fit in the
Coldfire's memory.
- mallopt01: Define __MALLOC_STANDARD__ on Coldfire.
- Skip mmap01 on Coldfire since it requires sbrk(), which is not available.
- rename02: Remove private do_file_setup and use the library version to avoid
symbol conflicts.
- kill07: Declare semkey as extern on Coldfire to avoid symbol conflicts.
- kill11: Move *msg declaration since gcc 2.95 does not understand C99.
- sigaction01: Move -lc in the Makefile after -lpthread.
diff --git a/include/usctest.h b/include/usctest.h
index b606f7f..5ed672e 100644
--- a/include/usctest.h
+++ b/include/usctest.h
@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*/
-/* $Id: usctest.h,v 1.8 2005/07/12 17:08:32 robbiew Exp $ */
+/* $Id: usctest.h,v 1.9 2005/12/22 20:18:22 robbiew Exp $ */
/**********************************************************
*
@@ -161,6 +161,8 @@
extern long TEST_RETURN;
extern long TEST_ERRNO;
+extern struct usc_errno_t TEST_VALID_ENO[USC_MAX_ERRNO];
+extern long btime, etime, tmptime;
#else
/***********************************************************************
diff --git a/lib/tst_res.c b/lib/tst_res.c
index ab2bf6d..2777bab 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -31,7 +31,7 @@
*/
-/* $Id: tst_res.c,v 1.2 2005/07/11 22:28:09 robbiew Exp $ */
+/* $Id: tst_res.c,v 1.3 2005/12/22 20:18:22 robbiew Exp $ */
/**********************************************************
*
@@ -567,7 +567,7 @@
int
tst_environ()
{
-#if defined UCLINUX && EMBED
+#if defined UCLINUX && EMBED && CONFIG_BLACKFIN
FILE *fdopen;
#else
FILE *fdopen();
diff --git a/testcases/kernel/syscalls/Makefile b/testcases/kernel/syscalls/Makefile
index 2d648b2..62248b6 100644
--- a/testcases/kernel/syscalls/Makefile
+++ b/testcases/kernel/syscalls/Makefile
@@ -34,7 +34,8 @@
# Commented this out since there are directories here we don't want built by default
#
SUBDIR = `ls */Makefile | sed "s/Makefile//g" | grep -v epoll`
-UCLINUX_SUBDIR = `ls */Makefile | sed "s/Makefile//g" | grep -vE "^fork|epoll|capget|capset|chmod|chown|llseek|nftw|clone|profil|getcontext"`
+COLDFIRE_SKIP = $(if ($CONFIG_COLDFIRE),|madvise|mlock|munlock)
+UCLINUX_SUBDIR = `ls */Makefile | sed "s/Makefile//g" | grep -vE "^fork|epoll|capget|capset|chmod|chown|llseek|nftw|clone|profil|getcontext$(COLDFIRE_SKIP)"`
all:
@set -e; for i in lib $(SUBDIR); do \
diff --git a/testcases/kernel/syscalls/creat/Makefile b/testcases/kernel/syscalls/creat/Makefile
index 0d602a1..19118f1 100644
--- a/testcases/kernel/syscalls/creat/Makefile
+++ b/testcases/kernel/syscalls/creat/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall -g
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/execve/Makefile b/testcases/kernel/syscalls/execve/Makefile
index 5b561a0..1759b59 100644
--- a/testcases/kernel/syscalls/execve/Makefile
+++ b/testcases/kernel/syscalls/execve/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/fchdir/Makefile b/testcases/kernel/syscalls/fchdir/Makefile
index 5b561a0..1759b59 100644
--- a/testcases/kernel/syscalls/fchdir/Makefile
+++ b/testcases/kernel/syscalls/fchdir/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/getdents/getdents01.c b/testcases/kernel/syscalls/getdents/getdents01.c
index 85ea73c..0f83e40 100644
--- a/testcases/kernel/syscalls/getdents/getdents01.c
+++ b/testcases/kernel/syscalls/getdents/getdents01.c
@@ -82,6 +82,20 @@
char *dir_name = NULL;
struct dirent *dirp;
+ /*
+ * Here's a case where invoking the system call directly
+ * doesn't seem to work. getdents.h has an assembly
+ * macro to do the job.
+ *
+ * equivalent to - getdents(fd, dirp, count);
+ * if we could call getdents that way.
+ */
+
+#if defined(__ia64__)
+#define getdents(arg1, arg2, arg3) syscall(__NR_getdents, arg1, arg2, arg3)
+#else
+ _syscall3(int, getdents, uint, fd, struct dirent *, dirp, uint, count);
+#endif
/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -121,21 +135,7 @@
if ((fd = open(dir_name, O_RDONLY)) == -1) {
tst_brkm(TBROK, cleanup, "open of directory failed");
}
-
- /*
- * Here's a case where invoking the system call directly
- * doesn't seem to work. getdents.h has an assembly
- * macro to do the job.
- *
- * equivalent to - getdents(fd, dirp, count);
- * if we could call getdents that way.
- */
-
-#if defined(__ia64__)
-#define getdents(arg1, arg2, arg3) syscall(__NR_getdents, arg1, arg2, arg3)
-#else
- _syscall3(int, getdents, uint, fd, struct dirent *, dirp, uint, count);
-#endif
+
rval = getdents(fd, dirp, count);
if (rval < 0) { /* call returned an error */
diff --git a/testcases/kernel/syscalls/ipc/lib/Makefile b/testcases/kernel/syscalls/ipc/lib/Makefile
index 895843a..d31ffc1 100644
--- a/testcases/kernel/syscalls/ipc/lib/Makefile
+++ b/testcases/kernel/syscalls/ipc/lib/Makefile
@@ -26,6 +26,7 @@
MAINS=../libipc.a
CFLAGS+=-I../../../../../include -g -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
all: ../libipc.a
diff --git a/testcases/kernel/syscalls/ipc/lib/ipcmsg.h b/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
index bb928db..4265afd 100644
--- a/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcmsg.h
@@ -46,7 +46,11 @@
char mtext[MSGSIZE + 1]; /* add 1 here so the message can be 1024 */
} MSGBUF; /* characters long with a '\0' termination */
+#if (!defined CONFIG_COLDFIRE || defined LIBIPC)
key_t msgkey; /* the ftok() generated message key */
+#else
+extern key_t msgkey; /* the ftok() generated message key */
+#endif
void check_root();
void init_buf(MSGBUF *, int, int);
diff --git a/testcases/kernel/syscalls/ipc/lib/ipcsem.h b/testcases/kernel/syscalls/ipc/lib/ipcsem.h
index 63baf5f..f4fbbf6 100644
--- a/testcases/kernel/syscalls/ipc/lib/ipcsem.h
+++ b/testcases/kernel/syscalls/ipc/lib/ipcsem.h
@@ -42,7 +42,11 @@
#define PSEMS 10 /* a reasonable value for the number of */
/* "primitive semaphores" per ID */
+#if (!defined CONFIG_COLDFIRE || defined LIBIPC)
key_t semkey; /* an IPC key generated by ftok() */
+#else
+extern key_t semkey; /* an IPC key generated by ftok() */
+#endif
union semun {
int val; /* value for SETVAL */
diff --git a/testcases/kernel/syscalls/ipc/lib/libipc.c b/testcases/kernel/syscalls/ipc/lib/libipc.c
index 2a462a4..f642d00 100644
--- a/testcases/kernel/syscalls/ipc/lib/libipc.c
+++ b/testcases/kernel/syscalls/ipc/lib/libipc.c
@@ -35,6 +35,7 @@
* rm_shm()
*/
+#define LIBIPC
#include "ipcmsg.h"
#include "ipcsem.h"
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
index 12324db..26f1d60 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl08.c
@@ -64,7 +64,11 @@
int exp_enos[]={0}; /* List must end with 0 */
+#ifndef CONFIG_COLDFIRE
#define MAXNPROCS 1000000 /* This value is set to an arbitrary high limit. */
+#else
+#define MAXNPROCS 100000 /* Coldfire can't deal with 1000000 */
+#endif
#define MAXNREPS 100000
#define FAIL 1
#define PASS 0
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c
index 0b59321..cc83055 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl09.c
@@ -51,7 +51,11 @@
#include "usctest.h"
#define MAXNREPS 1000
-#define MAXNPROCS 1000000 /* This value is set to an arbitrary high limit. */
+#ifndef CONFIG_COLDFIRE
+#define MAXNPROCS 1000000 /* This value is set to an arbitrary high limit. */
+#else
+#define MAXNPROCS 100000 /* Coldfire can't deal with 1000000 */
+#endif
#define MAXNKIDS 10
#define FAIL 1
#define PASS 0
diff --git a/testcases/kernel/syscalls/kill/Makefile b/testcases/kernel/syscalls/kill/Makefile
index 28e9dc9..1665236 100644
--- a/testcases/kernel/syscalls/kill/Makefile
+++ b/testcases/kernel/syscalls/kill/Makefile
@@ -21,6 +21,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall -D_GNU_SOURCE
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite -L../ipc -lipc
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/kill/kill07.c b/testcases/kernel/syscalls/kill/kill07.c
index f99e35b..f73194e 100644
--- a/testcases/kernel/syscalls/kill/kill07.c
+++ b/testcases/kernel/syscalls/kill/kill07.c
@@ -76,7 +76,11 @@
char *TCID= "kill07";
int TST_TOTAL = 1;
int shmid1;
+#ifndef CONFIG_COLDFIRE
key_t semkey;
+#else
+extern key_t semkey;
+#endif
int *flag;
extern int Tst_count;
diff --git a/testcases/kernel/syscalls/kill/kill11.c b/testcases/kernel/syscalls/kill/kill11.c
index c6b03fc..425f2c4 100644
--- a/testcases/kernel/syscalls/kill/kill11.c
+++ b/testcases/kernel/syscalls/kill/kill11.c
@@ -86,6 +86,9 @@
int signum[14];
int j;
int ret_val = 0;
+#ifdef UCLINUX
+ char *msg;
+#endif
signum[1]=SIGHUP; signum[2]=SIGINT; signum[3]=SIGQUIT;
signum[4]=SIGILL; signum[5]=SIGTRAP; signum[6]=SIGABRT;
signum[7]=SIGIOT; signum[8]=SIGFPE; signum[9]=SIGKILL;
@@ -93,8 +96,6 @@
signum[13]=SIGPIPE; signum[14]=SIGALRM;
#ifdef UCLINUX
- char *msg;
-
/* parse standard options */
if ((msg = parse_opts(argc, argv, (option_t *)NULL, NULL)) != (char *)NULL){
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
diff --git a/testcases/kernel/syscalls/mallopt/mallopt01.c b/testcases/kernel/syscalls/mallopt/mallopt01.c
index 10e108b..3432053 100644
--- a/testcases/kernel/syscalls/mallopt/mallopt01.c
+++ b/testcases/kernel/syscalls/mallopt/mallopt01.c
@@ -34,6 +34,9 @@
*/
#include <stdio.h> /* needed by testhead.h */
+#ifdef CONFIG_COLDFIRE
+#define __MALLOC_STANDARD__
+#endif
#include <malloc.h>
#include <errno.h>
diff --git a/testcases/kernel/syscalls/mkdir/Makefile b/testcases/kernel/syscalls/mkdir/Makefile
index 5b561a0..1759b59 100644
--- a/testcases/kernel/syscalls/mkdir/Makefile
+++ b/testcases/kernel/syscalls/mkdir/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/mmap/Makefile b/testcases/kernel/syscalls/mmap/Makefile
index ead9fb1..15434cc 100644
--- a/testcases/kernel/syscalls/mmap/Makefile
+++ b/testcases/kernel/syscalls/mmap/Makefile
@@ -25,7 +25,8 @@
LOADLIBES+= -L../../../../lib -lltp
LOADLIBES+= $(if $(UCLINUX),-lc)
-SRCS=$(wildcard *.c)
+COLDFIRE_SKIP = $(if ($CONFIG_COLDFIRE),|grep -v mmap01)
+SRCS=$(shell ls *.c $(COLDFIRE_SKIP))
TARGETS=$(patsubst %.c,%,$(SRCS))
all: $(TARGETS)
diff --git a/testcases/kernel/syscalls/open/Makefile b/testcases/kernel/syscalls/open/Makefile
index 5b561a0..1759b59 100644
--- a/testcases/kernel/syscalls/open/Makefile
+++ b/testcases/kernel/syscalls/open/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/rename/Makefile b/testcases/kernel/syscalls/rename/Makefile
index 5b561a0..1759b59 100644
--- a/testcases/kernel/syscalls/rename/Makefile
+++ b/testcases/kernel/syscalls/rename/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/rename/rename02.c b/testcases/kernel/syscalls/rename/rename02.c
index 13e5b55..401cb1b 100644
--- a/testcases/kernel/syscalls/rename/rename02.c
+++ b/testcases/kernel/syscalls/rename/rename02.c
@@ -30,7 +30,7 @@
* http://oss.sgi.com/projects/GenInfo/NoticeExplan/
*
*/
-/* $Id: rename02.c,v 1.1 2001/08/27 22:15:14 plars Exp $ */
+/* $Id: rename02.c,v 1.2 2005/12/22 20:18:24 robbiew Exp $ */
/**********************************************************
*
* OS Test - Silicon Graphics, Inc.
@@ -119,8 +119,6 @@
extern void setup();
extern void cleanup();
-void do_file_setup();
-
char *TCID="rename02"; /* Test program identifier. */
@@ -180,7 +178,7 @@
if (unlink(mname) == -1) {
tst_resm(TWARN, "unlink(%s) Failed, errno=%d : %s", mname, errno, strerror(errno));
}
- do_file_setup();
+ do_file_setup(fname);
}
} /* End for TEST_LOOPING */
@@ -209,7 +207,7 @@
sprintf(fname,"./tfile_%d",getpid());
sprintf(mname,"./rnfile_%d",getpid());
- do_file_setup();
+ do_file_setup(fname);
} /* End setup() */
@@ -234,18 +232,3 @@
tst_exit();
} /* End cleanup() */
-
-void
-do_file_setup()
-{
- if ((fd=open(fname,O_RDWR|O_CREAT,0700)) == -1) {
- tst_brkm(TBROK, cleanup,
- "open(%s, O_RDWR|O_CREAT,0700) Failed, errno=%d : %s",
- fname, errno, strerror(errno));
- }
-
- if (close(fd) == -1 )
- tst_resm(TWARN, "close(%s) Failed on file create, errno=%d : %s",
- fname, errno, strerror(errno));
-
-}
diff --git a/testcases/kernel/syscalls/rmdir/Makefile b/testcases/kernel/syscalls/rmdir/Makefile
index 5b561a0..1759b59 100644
--- a/testcases/kernel/syscalls/rmdir/Makefile
+++ b/testcases/kernel/syscalls/rmdir/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/sched_setscheduler/Makefile b/testcases/kernel/syscalls/sched_setscheduler/Makefile
index 5b561a0..1759b59 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/Makefile
+++ b/testcases/kernel/syscalls/sched_setscheduler/Makefile
@@ -22,6 +22,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)
diff --git a/testcases/kernel/syscalls/sigaction/Makefile b/testcases/kernel/syscalls/sigaction/Makefile
index 372102c..f104de4 100644
--- a/testcases/kernel/syscalls/sigaction/Makefile
+++ b/testcases/kernel/syscalls/sigaction/Makefile
@@ -22,7 +22,7 @@
CFLAGS+= -I../../../../include -DGLIBC_SIGACTION_BUG=1 -Wall -D_GNU_SOURCE
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
LOADLIBES+= -L../../../../lib -lltp
-LOADLIBES+= $(if $(UCLINUX),-lc)
+LOADLIBES2= $(if $(UCLINUX),-lc)
SRCS=$(wildcard *.c)
TARGETS=$(patsubst %.c,%,$(SRCS))
@@ -30,7 +30,7 @@
all: $(TARGETS)
sigaction01:
- $(CC) -o sigaction01 sigaction01.c $(CFLAGS) $(LOADLIBES) -lpthread
+ $(CC) -o sigaction01 sigaction01.c $(CFLAGS) $(LOADLIBES) -lpthread $(LOADLIBES2)
install:
@set -e; for i in $(TARGETS); do ln -f $$i ../../../bin/$$i ; done
diff --git a/testcases/kernel/syscalls/vhangup/Makefile b/testcases/kernel/syscalls/vhangup/Makefile
index 7c31ab1..1fa8a18 100644
--- a/testcases/kernel/syscalls/vhangup/Makefile
+++ b/testcases/kernel/syscalls/vhangup/Makefile
@@ -21,6 +21,7 @@
###########################################################################
CFLAGS+= -I../../../../include -Wall
CFLAGS+= $(if $(UCLINUX),-DUCLINUX)
+CFLAGS+= $(if $(CONFIG_COLDFIRE),-D_USC_LIB_)
LOADLIBES+= -L../../../../lib -lltp -L.. -ltestsuite
LOADLIBES+= $(if $(UCLINUX),-lc)