tests: fix IPC test set

- use one single library instead of loose library files
- we don't have ftime() anymore
- shmat(non-NULL) is currently broken, fix shmt test set to bypass this
- some other small issues
This commit is contained in:
David van Moolenbroek 2012-09-08 17:25:00 +02:00
parent c9f644bd68
commit df3975243b
21 changed files with 56 additions and 185 deletions

View file

@ -17,6 +17,7 @@
#
all test clean:
$(MAKE) -C ./lib $@
# $(MAKE) -C ./msgctl $@
# $(MAKE) -C ./msgget $@
# $(MAKE) -C ./msgrcv $@

View file

@ -16,11 +16,11 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
SRCS = libipc.c
SRCS = libipc.c rmobj.c parse_opts.c tst_res.c tst_sig.c tst_tmpdir.c
OBJS = $(SRCS:.c=.o)
LIBIPC = ../libipc.a
CFLAGS += -I../../../../../include -Wall
CFLAGS += -I../../../../../include -Wall -D_NETBSD_SOURCE=1
all: $(LIBIPC)

View file

@ -42,7 +42,7 @@
#include "ipcsem.h"
#include <pwd.h>
#include <sys/timeb.h>
#include <sys/time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
@ -61,7 +61,7 @@ getipckey()
char curdira[PATH_MAX];
size_t size = sizeof(curdira);
key_t ipc_key;
struct timeb time_info;
struct timeval tv;
if (NULL == (curdir = getcwd(curdira, size))) {
tst_brkm(TBROK, cleanup, "Can't get current directory "
@ -77,11 +77,11 @@ getipckey()
* project identifier is a "random character" produced by
* generating a random number between 0 and 25 and then adding
* that to the ascii value of 'a'. The "seed" for the random
* number is the millisecond value that is set in the timeb
* structure after calling ftime().
* number is the microsecond value that is set in the timeval
* structure after calling gettimeofday().
*/
(void)ftime(&time_info);
srandom((unsigned int)time_info.millitm);
(void) gettimeofday(&tv, NULL);
srandom((unsigned int)tv.tv_usec);
if ((ipc_key = ftok(curdir, ascii_a + random()%26)) == -1) {
tst_brkm(TBROK, cleanup, "Can't get msgkey from ftok()");

View file

@ -577,7 +577,7 @@ STD_opts_help(void)
for(i = 0; std_options[i].optstr; ++i) {
if (std_options[i].help)
printf(std_options[i].help);
fputs(std_options[i].help, stdout);
}
}

View file

@ -1,32 +1,14 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07
all: $(PROG)
$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
rmobj.o: ../lib/rmobj.c
$(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
tst_sig.o: ../lib/tst_sig.c
$(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
tst_tmpdir.o: ../lib/tst_tmpdir.c
$(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
parse_opts.o: ../lib/parse_opts.c
$(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
libipc.o: ../lib/libipc.c
$(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)

View file

@ -94,7 +94,6 @@ int main(int ac, char **av)
TEST(semctl(sem_id_1, 0, IPC_STAT, un_arg));
if (TEST_RETURN != -1) {
printf("result: %d\n", TEST_RETURN);
tst_resm(TFAIL, "call succeeded when error expected");
continue;
}

View file

@ -1,32 +1,14 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = semget01 semget02 semget03 semget05 semget06
all: $(PROG)
$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
rmobj.o: ../lib/rmobj.c
$(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
tst_sig.o: ../lib/tst_sig.c
$(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
tst_tmpdir.o: ../lib/tst_tmpdir.c
$(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
parse_opts.o: ../lib/parse_opts.c
$(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
libipc.o: ../lib/libipc.c
$(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)

View file

@ -72,7 +72,7 @@ int num_sems = 0; /* count the semaphores created */
int main(int ac, char **av)
{
int lc,getmaxid; /* loop counter */
int lc,getmaxid=0; /* loop counter */
char *msg; /* message returned from parse_opts */
FILE *fp;

View file

@ -1,32 +1,14 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = semop01 semop02 semop03 semop04 semop05
all: $(PROG)
$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
rmobj.o: ../lib/rmobj.c
$(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
tst_sig.o: ../lib/tst_sig.c
$(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
tst_tmpdir.o: ../lib/tst_tmpdir.c
$(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
parse_opts.o: ../lib/parse_opts.c
$(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
libipc.o: ../lib/libipc.c
$(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)

View file

@ -1,32 +1,14 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmat01 shmat02 shmat03
all: $(PROG)
$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
rmobj.o: ../lib/rmobj.c
$(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
tst_sig.o: ../lib/tst_sig.c
$(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
tst_tmpdir.o: ../lib/tst_tmpdir.c
$(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
parse_opts.o: ../lib/parse_opts.c
$(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
libipc.o: ../lib/libipc.c
$(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)

View file

@ -124,7 +124,7 @@ int main(int ac, char **av)
addr = shmat(*(TC[i].shmid), (void *)(TC[i].addr),
TC[i].flags);
TEST_ERRNO = errno;
if (addr == (void *)-1) {
tst_brkm(TFAIL, cleanup, "%s call failed - "
"errno = %d : %s", TCID, TEST_ERRNO,

View file

@ -1,32 +1,14 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmctl01 shmctl02 shmctl03 shmctl04
all: $(PROG)
$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
rmobj.o: ../lib/rmobj.c
$(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
tst_sig.o: ../lib/tst_sig.c
$(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
tst_tmpdir.o: ../lib/tst_tmpdir.c
$(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
parse_opts.o: ../lib/parse_opts.c
$(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
libipc.o: ../lib/libipc.c
$(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)

View file

@ -1,32 +1,14 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmdt01 shmdt02
all: $(PROG)
$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
rmobj.o: ../lib/rmobj.c
$(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
tst_sig.o: ../lib/tst_sig.c
$(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
tst_tmpdir.o: ../lib/tst_tmpdir.c
$(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
parse_opts.o: ../lib/parse_opts.c
$(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
libipc.o: ../lib/libipc.c
$(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)

View file

@ -1,32 +1,14 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmget01 shmget02 shmget04 shmget05
all: $(PROG)
$(PROG): tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o libipc.o tst_sig.o parse_opts.o tst_tmpdir.o rmobj.o
rmobj.o: ../lib/rmobj.c
$(CC) $(CFLAGS) -c -o rmobj.o ../lib/rmobj.c
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
tst_sig.o: ../lib/tst_sig.c
$(CC) $(CFLAGS) -c -o tst_sig.o ../lib/tst_sig.c
tst_tmpdir.o: ../lib/tst_tmpdir.c
$(CC) $(CFLAGS) -c -o tst_tmpdir.o ../lib/tst_tmpdir.c
parse_opts.o: ../lib/parse_opts.c
$(CC) $(CFLAGS) -c -o parse_opts.o ../lib/parse_opts.c
libipc.o: ../lib/libipc.c
$(CC) $(CFLAGS) -c -o libipc.o ../lib/libipc.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
clean:
rm -f *.o $(PROG)

View file

@ -1,18 +1,15 @@
# Makefile for the tests
CC = exec cc
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -I../lib/
CFLAGS = -Wall -D_MINIX -D_POSIX_SOURCE -D_NETBSD_SOURCE=1 -I../lib/
PROG = shmt02 shmt03 shmt04 shmt05 shmt06 \
shmt07 shmt08 shmt10 shmt01
all: $(PROG)
$(PROG): tst_res.o
$(CC) $(CFLAGS) -o $@ $@.c tst_res.o
tst_res.o: ../lib/tst_res.c
$(CC) $(CFLAGS) -c -o tst_res.o ../lib/tst_res.c
$(PROG): ../libipc.a
$(CC) $(CFLAGS) -o $@ $@.c ../libipc.a
test:
sh testshm.sh

View file

@ -59,7 +59,7 @@ int main(void)
/* are we doing with ia64 or arm_arch_4t arch */
#if defined (__ia64__) || defined (__ARM_ARCH_4T__)
#if defined (__ia64__) || defined (__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *)NULL, 0);
#else
cp = (char *) shmat(shmid, (void *)0x80000, 0);

View file

@ -81,7 +81,7 @@ int main(void)
/* are we doing with ia64 or arm_arch_4t arch */
#if defined (__ia64__) || defined (__ARM_ARCH_4T__)
#if defined (__ia64__) || defined (__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *)NULL, 0);
#else
cp = (char *) shmat(shmid, (void *)0x80000, 0);

View file

@ -61,7 +61,7 @@ extern int Tst_count; /* Test Case counter for tst_* routines */
key_t key;
sigset_t sigset;
sigset_t mysigset;
#define ADDR1 (void *)0x40000000
#define ADDR (void *)0x80000
@ -81,9 +81,9 @@ int main(void)
signal(SIGUSR1, SIG_DFL);
sigemptyset(&sigset);
sigaddset(&sigset,SIGUSR1);
sigprocmask(SIG_BLOCK,&sigset,NULL);
sigemptyset(&mysigset);
sigaddset(&mysigset,SIGUSR1);
sigprocmask(SIG_BLOCK,&mysigset,NULL);
pid = fork();
switch (pid) {
@ -109,7 +109,7 @@ if ((shmid = shmget(key, SIZE, IPC_CREAT|0666)) < 0 ) {
else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR1, 0);
#elif defined(__ARM_ARCH_4T__)
#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);
@ -171,8 +171,8 @@ int shmid,
chld_pid ;
char *cp;
sigemptyset(&sigset);
sigsuspend(&sigset);
sigemptyset(&mysigset);
sigsuspend(&mysigset);
chld_pid = getpid() ;
/*--------------------------------------------------------*/
@ -187,7 +187,7 @@ else
{
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR1, 0);
#elif defined(__ARM_ARCH_4T__)
#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);

View file

@ -88,7 +88,7 @@ int main(void)
} else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR_IA, 0);
#elif defined(__ARM_ARCH_4T__)
#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *)NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);

View file

@ -66,7 +66,7 @@ extern int Tst_count; /* Test Case counter for tst_* routines */
/**************/
key_t key;
sigset_t sigset;
sigset_t mysigset;
int child(void);
int rm_shm(int);
@ -81,9 +81,9 @@ int main(void)
signal(SIGUSR1, SIG_DFL);
sigemptyset(&sigset);
sigaddset(&sigset,SIGUSR1);
sigprocmask(SIG_BLOCK,&sigset,NULL);
sigemptyset(&mysigset);
sigaddset(&mysigset,SIGUSR1);
sigprocmask(SIG_BLOCK,&mysigset,NULL);
pid = fork();
switch (pid) {
@ -109,7 +109,7 @@ int main(void)
else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR_IA, 0);
#elif defined(__ARM_ARCH_4T__)
#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void*) NULL, 0);
#elif defined(__mips__)
cp = (char *) shmat(shmid, ADDR_MIPS, 0);
@ -172,8 +172,8 @@ int child(void)
chld_pid ;
char *cp;
sigemptyset(&sigset);
sigsuspend(&sigset);
sigemptyset(&mysigset);
sigsuspend(&mysigset);
chld_pid = getpid() ;
if ((shmid = shmget(key, SIZE, 0)) < 0) {
@ -185,7 +185,7 @@ int child(void)
else {
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR1_IA, 0);
#elif defined(__ARM_ARCH_4T__)
#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *) NULL, 0);
#elif defined(__mips__)
cp = (char *) shmat(shmid, ADDR1_MIPS, 0);

View file

@ -84,7 +84,7 @@ int main(void)
#ifdef __ia64__
cp = (char *) shmat(shmid, ADDR_IA, 0);
#elif defined(__ARM_ARCH_4T__)
#elif defined(__ARM_ARCH_4T__) || defined(__minix)
cp = (char *) shmat(shmid, (void *) NULL, 0);
#else
cp = (char *) shmat(shmid, ADDR, 0);