diff options
35 files changed, 423 insertions, 886 deletions
diff --git a/test/Config b/test/Config deleted file mode 100644 index 80fc6b3d3..000000000 --- a/test/Config +++ /dev/null @@ -1,9 +0,0 @@ -# Configuration for uClibc test apps. - -# Set the following to `true' to make a debuggable build. -DODEBUG = true - -# If you want to compile using uClibc as a shared library, turn this on. -DODYNAMIC = true - - diff --git a/test/Makefile b/test/Makefile index 203484290..cc54cd25f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -22,27 +22,25 @@ TOPDIR=../ .EXPORT_ALL_VARIABLES: -ALL_SUBDIRS = args assert ctype pwd_grp signal silly stdlib string unistd crypt #misc -DIRS = $(ALL_SUBDIRS) -#ifeq ($(TARGET_ARCH), $(HOST_ARCH)) -# DIRS = $(ALL_SUBDIRS) -#else -# DIRS = -#endif -ifeq ($(HAVE_SHARED),y) - ifeq ($(BUILD_UCLIBC_LDSO),y) +ALL_SUBDIRS = \ + args assert crypt ctype pwd_grp signal silly stdlib string unistd \ + #misc +DIRS := $(ALL_SUBDIRS) + +ifeq ($(HAVE_SHARED)$(BUILD_UCLIBC_LDSO),yy) DIRS += dlopen - endif -endif +endif ifeq ($(UCLIBC_HAS_THREADS),y) - DIRS += pthread -endif + DIRS += pthread +endif +ALL_SUBDIRS += pthread dlopen + all: subdirs tags: ctags -R - + clean: subdirs_clean $(RM) *.[oa] *~ core @@ -50,6 +48,7 @@ subdirs: $(patsubst %, _dir_%, $(DIRS)) subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) $(patsubst %, _dir_%, $(DIRS)) : dummy + @echo "Making test in $(patsubst _dir_%,%,$@)" $(MAKE) -C $(patsubst _dir_%, %, $@) $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy diff --git a/test/Rules.mak b/test/Rules.mak index 141cf10f6..20000cc35 100644 --- a/test/Rules.mak +++ b/test/Rules.mak @@ -1,13 +1,14 @@ -# Rules.make for uClibc test apps. +# Rules.mak for uClibc test subdirs # # Copyright (C) 2001 by Lineo, inc. # +# Note: This does not read the top level Rules.mak file # -#Note: This does not read the top level Rules.mak file -# --include $(TESTDIR)../.config -include $(TESTDIR)Config +TOPDIR = ../../ +TESTDIR=$(TOPDIR)test/ + +-include $(TOPDIR).config #-------------------------------------------------------- # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. @@ -16,17 +17,17 @@ export LC_ALL ifeq ($(strip $(TARGET_ARCH)),) TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ - -e 's/i.86/i386/' \ - -e 's/sparc.*/sparc/' \ - -e 's/arm.*/arm/g' \ - -e 's/m68k.*/m68k/' \ - -e 's/ppc/powerpc/g' \ - -e 's/v850.*/v850/g' \ - -e 's/sh[234]/sh/' \ - -e 's/mips-.*/mips/' \ - -e 's/mipsel-.*/mipsel/' \ - -e 's/cris.*/cris/' \ - ) + -e 's/i.86/i386/' \ + -e 's/sparc.*/sparc/' \ + -e 's/arm.*/arm/g' \ + -e 's/m68k.*/m68k/' \ + -e 's/ppc/powerpc/g' \ + -e 's/v850.*/v850/g' \ + -e 's/sh[234]/sh/' \ + -e 's/mips-.*/mips/' \ + -e 's/mipsel-.*/mipsel/' \ + -e 's/cris.*/cris/' \ + ) endif export TARGET_ARCH @@ -41,16 +42,19 @@ export TARGET_ARCH # make CROSS=mipsel-linux- # will build uClibc for 'mipsel'. -CROSS= -CC= $(CROSS)gcc -STRIPTOOL=strip -LDD=../$(TOPDIR)/utils/ldd - -RM= rm -f +CROSS = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) +CC = $(CROSS)gcc +STRIPTOOL = strip +RM = rm -f +ifeq ($(LDSO_LDD_SUPPORT),y) +LDD = $(TOPDIR)utils/ldd +else +LDD = @true +endif # Select the compiler needed to build binaries for your development system -HOSTCC=gcc -HOSTCFLAGS=-O2 -Wall +HOSTCC = gcc +HOSTCFLAGS = -O2 -Wall #-------------------------------------------------------- @@ -62,31 +66,34 @@ check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) # use '-Os' optimization if available, else use -O2, allow Config to override -OPTIMIZATION+=$(call check_gcc,-Os,-O2) # Override optimization settings when debugging -ifeq ($(DODEBUG),true) -OPTIMIZATION=-O0 +ifeq ($(DODEBUG),y) +OPTIMIZATION = -O0 +else +OPTIMIZATION += $(call check_gcc,-Os,-O2) endif -XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS))) -CFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) -GLIBC_CFLAGS+=$(XWARNINGS) $(OPTIMIZATION) -LDFLAGS= +XWARNINGS = $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes +XARCH_CFLAGS = $(subst ",, $(strip $(ARCH_CFLAGS))) +CFLAGS = $(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) +GLIBC_CFLAGS += $(XWARNINGS) $(OPTIMIZATION) +LDFLAGS = -ifeq ($(DODEBUG),true) - CFLAGS+=-g - GLIBC_CFLAGS+=-g - LDFLAGS += -g -Wl,-warn-common - GLIBC_LDFLAGS =-g -Wl,-warn-common - STRIPTOOL =true -Since_we_are_debugging +ifeq ($(DODEBUG),y) + CFLAGS += -g + GLIBC_CFLAGS += -g + LDFLAGS += -g -Wl,-warn-common + GLIBC_LDFLAGS = -g -Wl,-warn-common + STRIPTOOL = true -Since_we_are_debugging else - LDFLAGS +=-s -Wl,-warn-common - GLIBC_LDFLAGS =-s -Wl,-warn-common - STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG) + LDFLAGS += -s -Wl,-warn-common + GLIBC_LDFLAGS = -s -Wl,-warn-common + STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG) endif -ifneq ($(DODYNAMIC),true) - LDFLAGS +=-static - GLIBC_LDFLAGS +=-static +ifneq ($(strip $(HAVE_SHARED)),y) + LDFLAGS += -static + GLIBC_LDFLAGS += -static +else + LDFLAGS += -Wl,-dynamic-linker,$(TOPDIR)lib/ld-uClibc.so.0 endif diff --git a/test/args/Makefile b/test/args/Makefile index dd5339a03..29a5af967 100644 --- a/test/args/Makefile +++ b/test/args/Makefile @@ -1,40 +1,12 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# uClibc args tests +# Licensed under the GNU Library General Public License, see COPYING.LIB -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - -TARGETS=arg_test -all: $(TARGETS) - -arg_test: arg_test.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ a b c d e f g h - -@ echo " " - -clean: - $(RM) *.[oa] *~ core $(TARGETS) +TESTS = arg_test +include ../Test.mak +export WRAPPER_arg_test = \ + env -i \ + ENVVAR=123 \ + SOMETHING=sldajfasdf +export OPTS_arg_test = a b c d e f g h diff --git a/test/args/arg_test.c b/test/args/arg_test.c index 830bb047c..acc4465d9 100644 --- a/test/args/arg_test.c +++ b/test/args/arg_test.c @@ -23,9 +23,10 @@ */ #include <stdio.h> +#include <stdlib.h> #include <unistd.h> -int main( int argc, char **argv) +int main(int argc, char **argv) { int i=0; char** index=__environ; @@ -35,20 +36,20 @@ int main( int argc, char **argv) unsigned long sp; sp = (unsigned long) __builtin_frame_address(0); if(sp&0xf){ - fprintf(stderr, "stack pointer is unaligned! (%08lx)\n", sp); + printf("stack pointer is unaligned! (%08lx)\n", sp); } } #endif - fprintf(stderr, "argc=%d\n", argc); + printf("argc=%d\n", argc); - for(i=0;i<argc;i++){ - fprintf(stderr, "argv[%d]='%s'\n", i, argv[i]); + for(i=0;i<argc;i++) { + printf("argv[%d]='%s'\n", i, argv[i]); } i=0; while(*index) { - fprintf(stderr, "environ[%d]='%s'\n", i++, *index++); + printf("environ[%d]='%s'\n", i++, *index++); } exit(0); diff --git a/test/assert/Makefile b/test/assert/Makefile index 3771224dc..fc908cf87 100644 --- a/test/assert/Makefile +++ b/test/assert/Makefile @@ -1,40 +1,8 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# uClibc assert tests +# Licensed under the GNU Library General Public License, see COPYING.LIB -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - -TARGETS=assert -all: $(TARGETS) - -assert: assert.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ - -@ echo " " - -clean: - $(RM) *.[oa] *~ core $(TARGETS) +TESTS = assert +include ../Test.mak +export RET_assert = 134 diff --git a/test/crypt/Makefile b/test/crypt/Makefile index 4d5e1257f..b2a72ced3 100644 --- a/test/crypt/Makefile +++ b/test/crypt/Makefile @@ -16,36 +16,33 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +include ../Rules.mak - -TESTDIR=../ -include $(TESTDIR)/Rules.mak - -TARGETS=crypt md5c-test +TARGETS=crypt crypt_glibc diff md5c-test EXTRA_LIBS=-lcrypt all: $(TARGETS) -crypt: crypt.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +crypt: crypt.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ < crypt.input #> $@.out 2>&1 + ./$@ < crypt.input > $@.out 2>&1 -@ echo " " -crypt_glibc: crypt.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +crypt_glibc: crypt.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs glibc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ < crypt.input > $@.out 2>&1 + ./$@ < crypt.input > $@.out 2>&1 -@ echo " " diff: crypt_glibc crypt @@ -53,21 +50,19 @@ diff: crypt_glibc crypt -@ echo " " -@ echo "Diffing output: " -@ echo " " - -diff -u crypt_glibc.out crypt.out + diff -u crypt_glibc.out crypt.out -@ echo " " -md5c-test: md5c-test.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +md5c-test: md5c-test.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " clean: $(RM) *.[oa] *~ core crypt_glibc crypt crypt_glibc.out crypt.out md5c-test - - diff --git a/test/ctype/Makefile b/test/ctype/Makefile index 37d055144..ce212cd09 100644 --- a/test/ctype/Makefile +++ b/test/ctype/Makefile @@ -1,40 +1,6 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -TESTDIR=../ -include $(TESTDIR)/Rules.mak - -TARGETS=ctype ctype_run -all: $(TARGETS) - -ctype: ctype.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -ctype_run: - ./ctype - -@ echo " " -clean: - $(RM) *.[oa] *~ core $(TARGETS) +# uClibc ctype tests +# Licensed under the GNU Library General Public License, see COPYING.LIB +TESTS = ctype +include ../Test.mak diff --git a/test/dlopen/Makefile b/test/dlopen/Makefile index 98a48d4f0..48d5e29cc 100644 --- a/test/dlopen/Makefile +++ b/test/dlopen/Makefile @@ -15,10 +15,9 @@ # You should have received a copy of the GNU Library General Public License # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# Makefile for uClibc -TESTDIR=../ -include $(TESTDIR)/Rules.mak +include ../Rules.mak + DEBUG_LIBS=X #DEBUG_LIBS=LD_DEBUG @@ -60,17 +59,16 @@ libtest3.so: libtest.c run: libtest2.so libtest1.so test1 test2 test3 dltest libtest.so dltest2 libtest3.so @echo "----------running test 1--------------" - -LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test1 + LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test1 @echo "----------running test 2--------------" - -LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test2 + LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test2 @echo "----------running test 3--------------" - -LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test3 + LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test3 @echo "----------running test 3--------------" - -$(DEBUG_LIBS)=all ./dltest2 + $(DEBUG_LIBS)=all ./dltest2 @echo "----------running test 4--------------" - -$(DEBUG_LIBS)=all ./dltest + $(DEBUG_LIBS)=all ./dltest clean: $(RM) *.o libtest1.so* libtest2.so* test1 test2 test3 \ dltest dltest2 libtest.so libtest3.so - diff --git a/test/malloc/Makefile b/test/malloc/Makefile index 714eade71..a05b3aae1 100644 --- a/test/malloc/Makefile +++ b/test/malloc/Makefile @@ -1,129 +1,7 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - -TARGETS=malloc -TARGETS+=testmalloc testmalloc_glibc -TARGETS+=mallocbug mallocbug_glibc -TARGETS+=realloc0 realloc0_glibc -all: $(TARGETS) - -malloc: malloc.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ - -@ echo " " - -testmalloc_source: - -@ echo "-------" - -@ echo "testmalloc.c source: " - -@ echo " " - -@ cat testmalloc.c - -@ echo " " - -testmalloc: testmalloc.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - -testmalloc_glibc: testmalloc.c Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs GNU libc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - -mallocbug: mallocbug.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - -mallocbug_glibc: mallocbug.c Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs GNU libc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - -realloc0: realloc0.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - -realloc0_glibc: realloc0.c Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs GNU libc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - - -clean: - $(RM) *.[oa] *~ core $(TARGETS) +# uClibc malloc tests +# Licensed under the GNU Library General Public License, see COPYING.LIB +TESTS = malloc mallocbug realloc0 testmalloc +#time_malloc +include ../Test.mak diff --git a/test/malloc/malloc.c b/test/malloc/malloc.c index 8e93cf205..d63856845 100644 --- a/test/malloc/malloc.c +++ b/test/malloc/malloc.c @@ -1,6 +1,7 @@ #include <unistd.h> #include <stdlib.h> +#include <string.h> #include <stdio.h> #define N_PTRS 1000 @@ -10,61 +11,71 @@ #define random_size() (random()%MAX_SIZE) #define random_ptr() (random()%N_PTRS) -void test1(void); -void test2(void); +int test1(void); +int test2(void); -int main(int argc,char *argv[]) +int main(int argc, char *argv[]) { - test1(); - test2(); - return 0; + return test1() + test2(); } -void test1(void) +int test1(void) { void **ptrs; int i,j; int size; + int ret = 0; srandom(0x19730929); ptrs = malloc(N_PTRS*sizeof(void *)); - for(i=0;i<N_PTRS;i++){ - ptrs[i]=malloc(random_size()); + for(i=0; i<N_PTRS; i++){ + if ((ptrs[i] = malloc(random_size())) == NULL) { + printf("malloc random failed! %i\n", i); + ++ret; + } } - for(i=0;i<N_ALLOCS;i++){ - j=random_ptr(); + for(i=0; i<N_ALLOCS; i++){ + j = random_ptr(); free(ptrs[j]); - size=random_size(); - ptrs[j]=malloc(size); - if(!ptrs[j]){ - printf("malloc failed! %d\n",i); + size = random_size(); + ptrs[j] = malloc(size); + if (!ptrs[j]) { + printf("malloc failed! %d\n", i); + ++ret; } memset(ptrs[j],0,size); } - for(i=0;i<N_PTRS;i++){ + for(i=0; i<N_PTRS; i++){ free(ptrs[i]); } + + return ret; } -void test2(void) +int test2(void) { void *ptr = NULL; + int ret = 0; ptr = realloc(ptr,100); - if(!ptr){ + if (!ptr) { printf("couldn't realloc() a NULL pointer\n"); - }else{ + ++ret; + } else { free(ptr); } ptr = malloc(100); ptr = realloc(ptr, 0); - if(ptr){ + if (ptr) { printf("realloc(,0) failed\n"); + ++ret; free(ptr); } + + return ret; } diff --git a/test/malloc/realloc0.c b/test/malloc/realloc0.c index afe9bb9bd..62ae39d25 100644 --- a/test/malloc/realloc0.c +++ b/test/malloc/realloc0.c @@ -1,13 +1,13 @@ #include <stdlib.h> +#include <stdio.h> int main(int argc, char **argv) { - void *ptr = NULL; - ptr = realloc(ptr, 0); - printf("realloc(NULL, 0) -- pointer = %p\n", ptr); - - ptr = malloc(0); - printf("malloc(0) -- pointer = %p\n", ptr); - return 0; -} + void *ptr = NULL; + ptr = realloc(ptr, 0); + printf("realloc(NULL, 0) -- pointer = %p\n", ptr); + ptr = malloc(0); + printf("malloc(0) -- pointer = %p\n", ptr); + return 0; +} diff --git a/test/math/Makefile b/test/math/Makefile index 6eb554ccb..568e1ae6d 100644 --- a/test/math/Makefile +++ b/test/math/Makefile @@ -16,10 +16,8 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +include ../Rules.mak - -TESTDIR=../ -include $(TESTDIR)/Rules.mak CFLAGS+=-D_GNU_SOURCE -DNO_LONG_DOUBLE EXTRA_LIBS=-lm PERL=/usr/bin/perl @@ -40,43 +38,43 @@ all: $(TARGETS) test-double: test-double.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - -./$@ + ./$@ test-idouble: test-idouble.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - -./$@ + ./$@ test-float: test-float.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - -./$@ + ./$@ test-ifloat: test-ifloat.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - -./$@ + ./$@ test-ldouble: test-ldouble.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - -./$@ + ./$@ test-ildouble: test-ildoubl.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - -./$@ + ./$@ -rint: rint.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +rint: rint.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ > $@.out 2>&1 + ./$@ > $@.out 2>&1 -@ echo " " -rint_glibc: rint.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +rint_glibc: rint.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs glibc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ > $@.out 2>&1 + ./$@ > $@.out 2>&1 -@ echo " " diff: rint_glibc rint @@ -101,5 +99,3 @@ libm-test.c: $(ulps-file) libm-test.inc gen-libm-test.pl clean: $(RM) *.[oa] *~ core $(TARGETS) $(generated) rint_glibc.out rint.out - - diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc index a0d08cefb..bcd941c1a 100644 --- a/test/math/libm-test.inc +++ b/test/math/libm-test.inc @@ -4293,7 +4293,7 @@ int main (int argc, char **argv) { - int key, remaining; + int key; verbose = 1; output_ulps = 0; diff --git a/test/misc/Makefile b/test/misc/Makefile index 65e275008..a8921913a 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -16,18 +16,17 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TESTDIR=../ -include $(TESTDIR)/Rules.mak +include ../Rules.mak CFLAGS64=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 TARGETS=sem fdopen dirent_diff dirent64_diff #outb all: $(TARGETS) -outb: outb.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +outb: outb.c ../testsuite.h Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) @@ -35,26 +34,26 @@ outb: outb.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak ./$@ -@ echo " " -sem: sem.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +sem: sem.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -fdopen: fdopen.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +fdopen: fdopen.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " dirent_source: @@ -65,26 +64,26 @@ dirent_source: -@ cat dirent.c -@ echo " " -dirent: dirent.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +dirent: dirent.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ dirent.c > $@.out + ./$@ dirent.c > $@.out -@ echo " " dirent_glibc: dirent.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ dirent.c > $@.out + ./$@ dirent.c > $@.out -@ echo " " dirent_diff: dirent dirent_glibc @@ -95,26 +94,26 @@ dirent_diff: dirent dirent_glibc -diff -u dirent_glibc.out dirent.out -@ echo " " -dirent64: dirent.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +dirent64: dirent.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) $(CFLAGS64) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ dirent.c > $@.out + ./$@ dirent.c > $@.out -@ echo " " dirent64_glibc: dirent.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) $(CFLAGS64) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ dirent.c > $@.out + ./$@ dirent.c > $@.out -@ echo " " dirent64_diff: dirent64 dirent64_glibc @@ -129,6 +128,3 @@ clean: $(RM) *.[oa] *~ core dirent dirent_glibc dirent_glibc.out dirent.out \ dirent64 dirent64_glibc dirent64_glibc.out dirent64.out \ outb sem fdopen - - - diff --git a/test/mmap/Makefile b/test/mmap/Makefile index 5e7133237..4addff95a 100644 --- a/test/mmap/Makefile +++ b/test/mmap/Makefile @@ -1,40 +1,6 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - -TARGETS=mmap -all: $(TARGETS) - -mmap: mmap.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ - -@ echo " " - -clean: - $(RM) *.[oa] *~ core $(TARGETS) +# uClibc mmap tests +# Licensed under the GNU Library General Public License, see COPYING.LIB +TESTS = mmap mmap64 +include ../Test.mak diff --git a/test/pthread/Makefile b/test/pthread/Makefile index 247c07869..43e8c535e 100644 --- a/test/pthread/Makefile +++ b/test/pthread/Makefile @@ -1,5 +1,22 @@ -TESTDIR=../ -include $(TESTDIR)/Rules.mak +# Makefile for uClibc +# +# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more +# details. +# +# You should have received a copy of the GNU Library General Public License +# along with this program; if not, write to the Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +include ../Rules.mak LDFLAGS += #EXTRA_LIBS += -lc -lgcc -lpthread @@ -8,83 +25,82 @@ EXTRA_LIBS += -lpthread TARGETS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 all: $(TARGETS) -ex1: ex1.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ex1: ex1.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -ex2: ex2.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ex2: ex2.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -ex3: ex3.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ex3: ex3.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -ex4: ex4.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ex4: ex4.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -ex5: ex5.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ex5: ex5.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -ex6: ex6.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ex6: ex6.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -ex7: ex7.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ex7: ex7.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " clean: $(RM) *.[oa] *~ core $(TARGETS) - diff --git a/test/pthread/ex1.c b/test/pthread/ex1.c index 09e6e3fbd..a1b24c31a 100644 --- a/test/pthread/ex1.c +++ b/test/pthread/ex1.c @@ -7,33 +7,29 @@ #include <unistd.h> #include "pthread.h" -void * process(void * arg) +void *process(void * arg) { - int i; - fprintf(stderr, "Starting process %s\n", (char *) arg); - for (i = 0; i < 10000; i++) { - write(1, (char *) arg, 1); - } - return NULL; + int i; + printf("Starting process %s\n", (char *)arg); + for (i = 0; i < 10000; i++) + write(1, (char *) arg, 1); + return NULL; } +#define sucfail(r) (r != 0 ? "failed" : "succeeded") int main(void) { - int retcode; - pthread_t th_a, th_b; - void * retval; + int pret, ret = 0; + pthread_t th_a, th_b; + void *retval; - retcode = pthread_create(&th_a, NULL, process, (void *) "a"); - if (retcode != 0) fprintf(stderr, "create a failed %d\n", retcode); - else fprintf(stderr, "create a succeeded %d\n", retcode); - retcode = pthread_create(&th_b, NULL, process, (void *) "b"); - if (retcode != 0) fprintf(stderr, "create b failed %d\n", retcode); - else fprintf(stderr, "create b succeeded %d\n", retcode); - retcode = pthread_join(th_a, &retval); - if (retcode != 0) fprintf(stderr, "join a failed %d\n", retcode); - else fprintf(stderr, "join a succeeded %d\n", retcode); - retcode = pthread_join(th_b, &retval); - if (retcode != 0) fprintf(stderr, "join b failed %d\n", retcode); - else fprintf(stderr, "join b succeeded %d\n", retcode); - return 0; + ret += (pret = pthread_create(&th_a, NULL, process, (void *)"a")); + printf("create a %s %d\n", sucfail(pret), pret); + ret += (pret = pthread_create(&th_b, NULL, process, (void *)"b")); + printf("create b %s %d\n", sucfail(pret), pret); + ret += (pret = pthread_join(th_a, &retval)); + printf("join a %s %d\n", sucfail(pret), pret); + ret += (pret = pthread_join(th_b, &retval)); + printf("join b %s %d\n", sucfail(pret), pret); + return ret; } diff --git a/test/pwd_grp/Makefile b/test/pwd_grp/Makefile index fdfb1d8c4..4ddb60bd7 100644 --- a/test/pwd_grp/Makefile +++ b/test/pwd_grp/Makefile @@ -16,9 +16,7 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TESTDIR=../ -include $(TESTDIR)/Rules.mak - +include ../Rules.mak TARGETS=test_pwd test_pwd_glibc TARGETS+=test_grp test_grp_glibc @@ -29,114 +27,114 @@ TARGETS+=test_pwd_diff test_grp_diff pwcat_diff grcat_diff getgroups_diff all: $(TARGETS) -test_pwd: test_pwd.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +test_pwd: test_pwd.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >test_pwd.out + ./$@ 2>&1 >test_pwd.out -@ echo " " test_pwd_glibc: test_pwd.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >test_pwd_glibc.out + ./$@ 2>&1 >test_pwd_glibc.out -@ echo " " -test_grp: test_grp.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +test_grp: test_grp.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >test_grp.out + ./$@ 2>&1 >test_grp.out -@ echo " " test_grp_glibc: test_grp.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >test_grp_glibc.out + ./$@ 2>&1 >test_grp_glibc.out -@ echo " " -pwcat: pwcat.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +pwcat: pwcat.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >pwcat.out + ./$@ 2>&1 >pwcat.out -@ echo " " pwcat_glibc: pwcat.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >pwcat_glibc.out + ./$@ 2>&1 >pwcat_glibc.out -@ echo " " -grcat: grcat.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +grcat: grcat.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >grcat.out + ./$@ 2>&1 >grcat.out -@ echo " " grcat_glibc: grcat.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >grcat_glibc.out + ./$@ 2>&1 >grcat_glibc.out -@ echo " " -getgroups: getgroups.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +getgroups: getgroups.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >getgroups.out + ./$@ 2>&1 >getgroups.out -@ echo " " getgroups_glibc: getgroups.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ 2>&1 >getgroups_glibc.out + ./$@ 2>&1 >getgroups_glibc.out -@ echo " " test_pwd_diff: test_pwd_glibc test_pwd @@ -181,5 +179,3 @@ getgroups_diff: getgroups_glibc getgroups clean: $(RM) *.[oa] *~ core $(TARGETS) *.out - - diff --git a/test/setjmp/Makefile b/test/setjmp/Makefile index 83e9a885d..40f5fd853 100644 --- a/test/setjmp/Makefile +++ b/test/setjmp/Makefile @@ -1,40 +1,6 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - -TARGETS=setjmp_test -all: $(TARGETS) - -setjmp_test: setjmp_test.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ - -@ echo " " - -clean: - $(RM) *.[oa] *~ core $(TARGETS) +# uClibc setjmp tests +# Licensed under the GNU Library General Public License, see COPYING.LIB +TESTS = setjmp_test +include ../Test.mak diff --git a/test/signal/Makefile b/test/signal/Makefile index f193b16d1..55fb6554d 100644 --- a/test/signal/Makefile +++ b/test/signal/Makefile @@ -16,59 +16,57 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TESTDIR=../ -include $(TESTDIR)/Rules.mak +include ../Rules.mak CFLAGS += -D_GNU_SOURCE +GLIBC_CFLAGS += -D_GNU_SOURCE TARGETS=signal signal_glibc sigchld sigchld_glibc all: $(TARGETS) -signal: signal.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +signal: signal.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " signal_glibc: signal.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -sigchld: sigchld.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +sigchld: sigchld.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " sigchld_glibc: sigchld.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " clean: $(RM) *.[oa] *~ core $(TARGETS) - - diff --git a/test/signal/signal.c b/test/signal/signal.c index 8272de3dc..97963ebda 100644 --- a/test/signal/signal.c +++ b/test/signal/signal.c @@ -70,14 +70,20 @@ void signal_test_1(void) global_int = 0; it = "global variable set from signal handler"; - signal(SIGUSR1, set_global_int_to_one); + if (signal(SIGUSR1, set_global_int_to_one) == SIG_ERR) { + perror("signal(SIGUSR1) failed"); + exit(-1); + } raise(SIGUSR1); /* This should already have jumped to the signal handler */ check((global_int == 1), 1); global_int = 0; - signal(SIGUSR1, SIG_IGN); + if (signal(SIGUSR1, SIG_IGN) == SIG_ERR) { + perror("signal(SIGUSR1) failed"); + exit(-1); + } raise(SIGUSR1); /* This should not go to the signal handler this time since we */ check((global_int == 0), 1); @@ -95,7 +101,7 @@ int main(void) printf("No errors.\n"); } else { status = EXIT_FAILURE; - printf("%d errors.\n", errors); + printf("%lu errors.\n", (unsigned long)errors); } exit(status); } diff --git a/test/silly/Makefile b/test/silly/Makefile index f9d4a1d10..57739a447 100644 --- a/test/silly/Makefile +++ b/test/silly/Makefile @@ -1,80 +1,9 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# uClibc silly tests +# Licensed under the GNU Library General Public License, see COPYING.LIB -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - - -TARGETS=hello_source hello hello_glibc tiny - -all: $(TARGETS) - -hello_source: - -@ $(RM) $(TARGETS) - -@ echo "-------" - -@ echo "hello.c source: " - -@ echo " " - -@ cat hello.c - -@ echo " " - -hello: hello.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - -hello_glibc: hello.c Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs GNU libc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - - -tiny: tiny.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - -$(LDD) $@ - ls -l $@ - -./$@ - -@ echo " " - - -clean: - $(RM) *.[oa] *~ core $(TARGETS) +TESTS = hello tiny +include ../Test.mak +export RET_hello = 42 +export RET_tiny = 42 diff --git a/test/stat/Makefile b/test/stat/Makefile index 0b6b3c665..558b67510 100644 --- a/test/stat/Makefile +++ b/test/stat/Makefile @@ -16,8 +16,7 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TESTDIR=../ -include $(TESTDIR)/Rules.mak +include ../Rules.mak CFLAGS64=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 @@ -34,26 +33,26 @@ stat_source: -@ cat stat.c -@ echo " " -stat: stat.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +stat: stat.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ stat.c > $@.out + ./$@ stat.c > $@.out -@ echo " " stat_glibc: stat.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ stat.c > $@.out + ./$@ stat.c > $@.out -@ echo " " stat_diff: stat stat_glibc @@ -64,26 +63,26 @@ stat_diff: stat stat_glibc -diff -u stat_glibc.out stat.out -@ echo " " -stat64: stat.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +stat64: stat.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) $(CFLAGS64) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ stat.c > $@.out + ./$@ stat.c > $@.out -@ echo " " stat64_glibc: stat.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) $(CFLAGS64) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ stat.c > $@.out + ./$@ stat.c > $@.out -@ echo " " stat64_diff: stat64 stat64_glibc @@ -97,5 +96,3 @@ stat64_diff: stat64 stat64_glibc clean: $(RM) *.[oa] *~ core stat stat_glibc stat_glibc.out stat.out \ stat64 stat64_glibc stat64_glibc.out stat64.out - - diff --git a/test/stat/stat.c b/test/stat/stat.c index c1ce4b8b3..c9e063f27 100644 --- a/test/stat/stat.c +++ b/test/stat/stat.c @@ -1,6 +1,9 @@ #include <stdio.h> +#include <string.h> #include <fcntl.h> #include <sys/stat.h> +#include <unistd.h> +#include <stdlib.h> void print_struct_stat(char *msg, struct stat *s) { diff --git a/test/stdlib/Makefile b/test/stdlib/Makefile index 49a321a99..6c485efe6 100644 --- a/test/stdlib/Makefile +++ b/test/stdlib/Makefile @@ -16,10 +16,7 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - +include ../Rules.mak TARGETS+=teststrtol teststrtol_glibc teststrtol_diff TARGETS+=qsort qsort_glibc qsort_diff @@ -36,30 +33,30 @@ teststrtol_source: -@ cat teststrtol.c -@ echo " " -teststrtol: teststrtol.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +teststrtol: teststrtol.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " teststrtol_glibc: teststrtol.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " teststrtol_diff: teststrtol_glibc teststrtol @@ -70,30 +67,30 @@ teststrtol_diff: teststrtol_glibc teststrtol -diff -u teststrtol_glibc.out teststrtol.out -@ echo " " -qsort: qsort.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +qsort: qsort.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " qsort_glibc: qsort.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " qsort_diff: qsort_glibc qsort @@ -104,30 +101,30 @@ qsort_diff: qsort_glibc qsort -diff -u qsort_glibc.out qsort.out -@ echo " " -teston_exit: teston_exit.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +teston_exit: teston_exit.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " teston_exit_glibc: teston_exit.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " teston_exit_diff: teston_exit_glibc teston_exit @@ -138,30 +135,30 @@ teston_exit_diff: teston_exit_glibc teston_exit -diff -u teston_exit_glibc.out teston_exit.out -@ echo " " -testatexit: testatexit.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +testatexit: testatexit.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " testatexit_glibc: testatexit.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ > $@.out + ./$@ > $@.out -@ echo " " testatexit_diff: testatexit_glibc testatexit @@ -172,21 +169,19 @@ testatexit_diff: testatexit_glibc testatexit -diff -u testatexit_glibc.out testatexit.out -@ echo " " -ptytest: ptytest.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +ptytest: ptytest.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ + ./$@ -@ echo " " clean: $(RM) *.[oa] *~ core $(TARGETS) *.out - - diff --git a/test/stdlib/ptytest.c b/test/stdlib/ptytest.c index dd531b416..a79563880 100644 --- a/test/stdlib/ptytest.c +++ b/test/stdlib/ptytest.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> -int main() +int main(int argc, char **argv) { int fd; char *cp; diff --git a/test/stdlib/teston_exit.c b/test/stdlib/teston_exit.c index ddfe506a4..c5789b083 100644 --- a/test/stdlib/teston_exit.c +++ b/test/stdlib/teston_exit.c @@ -14,31 +14,31 @@ typedef void (*efuncp) (int, void *); * exit() without screwing everything up. The value passed in through arg gets * used as the next exit status. */ -static void exitfunc0(int status, void *arg) { printf("Executing exitfunc0 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc1(int status, void *arg) { printf("Executing exitfunc1 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc2(int status, void *arg) { printf("Executing exitfunc2 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc3(int status, void *arg) { printf("Executing exitfunc3 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc4(int status, void *arg) { printf("Executing exitfunc4 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc5(int status, void *arg) { printf("Executing exitfunc5 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc6(int status, void *arg) { printf("Executing exitfunc6 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc7(int status, void *arg) { printf("Executing exitfunc7 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc8(int status, void *arg) { printf("Executing exitfunc8 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc9(int status, void *arg) { printf("Executing exitfunc9 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc10(int status, void *arg) { printf("Executing exitfunc10 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc11(int status, void *arg) { printf("Executing exitfunc11 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc12(int status, void *arg) { printf("Executing exitfunc12 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc13(int status, void *arg) { printf("Executing exitfunc13 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc14(int status, void *arg) { printf("Executing exitfunc14 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc15(int status, void *arg) { printf("Executing exitfunc15 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc16(int status, void *arg) { printf("Executing exitfunc16 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc17(int status, void *arg) { printf("Executing exitfunc17 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc18(int status, void *arg) { printf("Executing exitfunc18 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc19(int status, void *arg) { printf("Executing exitfunc19 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc20(int status, void *arg) { printf("Executing exitfunc20 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc21(int status, void *arg) { printf("Executing exitfunc21 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc22(int status, void *arg) { printf("Executing exitfunc22 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc23(int status, void *arg) { printf("Executing exitfunc23 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} -static void exitfunc24(int status, void *arg) { printf("Executing exitfunc24 (status=%d, arg=%d)\n", status, (int)arg); exit((int)arg);} +static void exitfunc0(int status, void *arg) { printf("Executing exitfunc0 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc1(int status, void *arg) { printf("Executing exitfunc1 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc2(int status, void *arg) { printf("Executing exitfunc2 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc3(int status, void *arg) { printf("Executing exitfunc3 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc4(int status, void *arg) { printf("Executing exitfunc4 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc5(int status, void *arg) { printf("Executing exitfunc5 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc6(int status, void *arg) { printf("Executing exitfunc6 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc7(int status, void *arg) { printf("Executing exitfunc7 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc8(int status, void *arg) { printf("Executing exitfunc8 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc9(int status, void *arg) { printf("Executing exitfunc9 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc10(int status, void *arg) { printf("Executing exitfunc10 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc11(int status, void *arg) { printf("Executing exitfunc11 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc12(int status, void *arg) { printf("Executing exitfunc12 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc13(int status, void *arg) { printf("Executing exitfunc13 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc14(int status, void *arg) { printf("Executing exitfunc14 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc15(int status, void *arg) { printf("Executing exitfunc15 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc16(int status, void *arg) { printf("Executing exitfunc16 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc17(int status, void *arg) { printf("Executing exitfunc17 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc18(int status, void *arg) { printf("Executing exitfunc18 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc19(int status, void *arg) { printf("Executing exitfunc19 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc20(int status, void *arg) { printf("Executing exitfunc20 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc21(int status, void *arg) { printf("Executing exitfunc21 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc22(int status, void *arg) { printf("Executing exitfunc22 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc23(int status, void *arg) { printf("Executing exitfunc23 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} +static void exitfunc24(int status, void *arg) { printf("Executing exitfunc24 (status=%d, arg=%lu)\n", status, (unsigned long)arg); exit((unsigned long)arg);} static efuncp func_table[] = { @@ -60,7 +60,7 @@ int main ( void ) { int i = 0; - int count = 0; + unsigned long count = 0; int numfuncs = sizeof(func_table)/sizeof(efuncp); /* loop until no more can be added */ @@ -69,7 +69,7 @@ main ( void ) printf("Registered exitfunc%d with on_exit()\n", i); i = (i+1) % numfuncs; } - printf("%d functions registered with on_exit.\n", count); + printf("%lu functions registered with on_exit.\n", count); exit(count); } diff --git a/test/stdlib/teststrtol.c b/test/stdlib/teststrtol.c index d015b81b2..e959b4990 100644 --- a/test/stdlib/teststrtol.c +++ b/test/stdlib/teststrtol.c @@ -89,8 +89,8 @@ void do_test(int base) for(i=0;i<n_tests;i++){ n=strtol(strings[i],&endptr,base); - printf("strtol(\"%s\",%d) len=%d res=%ld\n", - strings[i],base,endptr-strings[i],n); + printf("strtol(\"%s\",%d) len=%lu res=%ld\n", + strings[i],base,(unsigned long)(endptr-strings[i]),n); } } @@ -102,8 +102,8 @@ void do_utest(int base) for(i=0;i<n_tests;i++){ n=strtoul(strings[i],&endptr,base); - printf("strtoul(\"%s\",%d) len=%d res=%lu\n", - strings[i],base,endptr-strings[i],n); + printf("strtoul(\"%s\",%d) len=%lu res=%lu\n", + strings[i],base,(unsigned long)(endptr-strings[i]),n); } } diff --git a/test/string/Makefile b/test/string/Makefile index b55788fd3..9bd7d90cf 100644 --- a/test/string/Makefile +++ b/test/string/Makefile @@ -16,9 +16,7 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TESTDIR=../ -include $(TESTDIR)/Rules.mak - +include ../Rules.mak TARGETS=string string_glibc TARGETS+=testcopy testcopy_glibc @@ -26,48 +24,48 @@ TARGETS+=#strerror #strsignal all: $(TARGETS) -string: string.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +string: string.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " string_glibc: string.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " -testcopy: testcopy.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +testcopy: testcopy.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ > testcopy.out + ./$@ > testcopy.out -@ echo " " testcopy_glibc: testcopy.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ > testcopy.gnu.out + ./$@ > testcopy.gnu.out -@ echo " " testcopy_diff: testcopy testcopy_glibc @@ -79,30 +77,27 @@ testcopy_diff: testcopy testcopy_glibc -@ echo " " -strerror: ../../libc/string/strerror.c $(TESTDIR)/Config $(TESTDIR)/Rules.mak +strerror: ../../libc/string/strerror.c $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -DCHECK_BUF -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " strsignal: ../../libc/string/strsignal.c -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -DCHECK_BUF -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ + ./$@ -@ echo " " - clean: $(RM) *.[oa] *~ core $(TARGETS) testcopy.gnu.out testcopy.out - - diff --git a/test/string/string.c b/test/string/string.c index ab041e63d..e23ee6279 100644 --- a/test/string/string.c +++ b/test/string/string.c @@ -1416,7 +1416,7 @@ main (void) else { status = EXIT_FAILURE; - printf("%d errors.\n", errors); + printf("%lu errors.\n", (unsigned long)errors); } return status; diff --git a/test/termios/Makefile b/test/termios/Makefile index 22868f4f2..a65022826 100644 --- a/test/termios/Makefile +++ b/test/termios/Makefile @@ -16,42 +16,37 @@ # along with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - +include ../Rules.mak TARGETS=termios termios_glibc all: $(TARGETS) -termios: termios.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak +termios: termios.c Makefile $(TESTDIR)/Rules.mak -@ echo "-------" -@ echo " " - -@ echo "Compiling vs uClibc: " + -@ echo "Compiling $@ vs uClibc: " -@ echo " " $(CC) $(CFLAGS) -c $< -o $@.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ + ./$@ -@ echo " " termios_glibc: termios.c Makefile -@ echo "-------" -@ echo " " - -@ echo "Compiling vs GNU libc: " + -@ echo "Compiling $@ vs glibc: " -@ echo " " $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(STRIPTOOL) -x -R .note -R .comment $@ -$(LDD) $@ ls -l $@ - -./$@ + ./$@ -@ echo " " clean: $(RM) *.[oa] *~ core $(TARGETS) - - diff --git a/test/termios/termios.c b/test/termios/termios.c index 250d9eb14..8b3aabc55 100644 --- a/test/termios/termios.c +++ b/test/termios/termios.c @@ -3,6 +3,7 @@ #include <termios.h> #include <unistd.h> #include <asm/ioctls.h> +#include <sys/ioctl.h> int main(int argc,char *argv[]) { diff --git a/test/testsuite.h b/test/testsuite.h index 806a5c229..3465d328e 100644 --- a/test/testsuite.h +++ b/test/testsuite.h @@ -29,7 +29,6 @@ extern size_t test_number; - extern void init_testsuite(const char* testname); extern void done_testing(void) __attribute__((noreturn)); extern void success_msg(int result, const char* command); @@ -37,7 +36,6 @@ extern void error_msg(int result, int line, const char* file, const char* comman #else - size_t test_number = 0; static int failures = 0; @@ -45,7 +43,7 @@ void error_msg(int result, int line, const char* file, const char* command) { failures++; - printf("\nFAILED TEST %d: \n\t%s\n", test_number, command); + printf("\nFAILED TEST %lu: \n\t%s\n", (unsigned long)test_number, command); printf("AT LINE: %d, FILE: %s\n\n", line, file); } @@ -63,7 +61,7 @@ void done_testing(void) exit(EXIT_FAILURE); } else { printf("All functions tested sucessfully\n"); - exit( EXIT_SUCCESS ); + exit(EXIT_SUCCESS); } } @@ -75,43 +73,42 @@ void init_testsuite(const char* testname) atexit(done_testing); } -#endif +#endif /* __NO_TESTCODE__ */ - -#define TEST_STRING_OUTPUT( command, expected_result ) \ +#define TEST_STRING_OUTPUT(command, expected_result) \ do { \ - int result=strcmp( command, expected_result); \ + int result = strcmp(command, expected_result); \ test_number++; \ - if ( result == expected_result ) { \ - success_msg( result, "command"); \ + if (result == expected_result) { \ + success_msg(result, "command"); \ } else { \ error_msg(result, __LINE__, __FILE__, command); \ }; \ } while (0) - -#define TEST_NUMERIC( command, expected_result ) \ + +#define TEST_NUMERIC(command, expected_result) \ do { \ - int result=(command); \ + int result = (command); \ test_number++; \ - if ( result == expected_result ) { \ - success_msg( result, # command); \ + if (result == expected_result) { \ + success_msg(result, # command); \ } else { \ error_msg(result, __LINE__, __FILE__, # command); \ }; \ } while (0) - + #define TEST(command) \ do { \ - int result=(command); \ + int result = (command); \ test_number++; \ - if ( result == 1) { \ - success_msg( result, # command); \ + if (result == 1) { \ + success_msg(result, # command); \ } else { \ - error_msg(result, __LINE__, __FILE__, # command ); \ + error_msg(result, __LINE__, __FILE__, # command); \ }; \ } while (0) -#define STR_CMD(cmd) cmd +#define STR_CMD(cmd) cmd #endif /* TESTSUITE_H */ diff --git a/test/unistd/Makefile b/test/unistd/Makefile index b4185c485..d684f0690 100644 --- a/test/unistd/Makefile +++ b/test/unistd/Makefile @@ -1,106 +1,9 @@ -# Makefile for uClibc -# -# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org> -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU Library General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) any -# later version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more -# details. -# -# You should have received a copy of the GNU Library General Public License -# along with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# uClibc unistd tests +# Licensed under the GNU Library General Public License, see COPYING.LIB -TESTDIR=../ -include $(TESTDIR)/Rules.mak - - - -TARGETS=fork fork_glibc vfork vfork_glibc getcwd getopt getopt_long preadwrite -all: $(TARGETS) - -getcwd: getcwd.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ - -@ echo " " - -fork: fork.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ - -@ echo " " - -fork_glibc: fork.c ../testsuite.h Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs GNU libc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ - -@ echo " " - -vfork: vfork.c ../testsuite.h Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs uClibc: " - -@ echo " " - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ - -@ echo " " - -vfork_glibc: vfork.c ../testsuite.h Makefile - -@ echo "-------" - -@ echo " " - -@ echo "Compiling vs GNU libc: " - -@ echo " " - $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o - $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ - $(STRIPTOOL) -x -R .note -R .comment $@ - -./$@ - -@ echo " " - -getopt: getopt.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ -abcXXX -9 - -@ echo " " - -getopt_long: getopt_long.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ --add XXX --delete YYY --verbose - -@ echo " " - -preadwrite: preadwrite.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak - $(CC) $(CFLAGS) -c $< -o $@.o - $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) - $(STRIPTOOL) -x -R .note -R .comment $@ - ./$@ - -@ echo " " - -clean: - $(RM) *.[oa] *~ core $(TARGETS) +TESTS = clone fork getcwd getopt getopt_long preadwrite vfork +include ../Test.mak +export OPTS_getopt = -abcXXX -9 +export OPTS_getopt_long = --add XXX --delete YYY --verbose |