svn commit: branches/uClibc-nptl: test

sjhill at uclibc.org sjhill at uclibc.org
Fri Aug 18 03:07:41 UTC 2006


Author: sjhill
Date: 2006-08-17 20:07:41 -0700 (Thu, 17 Aug 2006)
New Revision: 15816

Log:
Merge from trunk.


Modified:
   branches/uClibc-nptl/Makefile.in
   branches/uClibc-nptl/test/Test.mak


Changeset:
Modified: branches/uClibc-nptl/Makefile.in
===================================================================
--- branches/uClibc-nptl/Makefile.in	2006-08-18 03:05:30 UTC (rev 15815)
+++ branches/uClibc-nptl/Makefile.in	2006-08-18 03:07:41 UTC (rev 15816)
@@ -40,13 +40,13 @@
 	$(INSTALL) -d $(dir $@)
 	@$< -o $(top_srcdir)extra/Configs/Config.in
 
-# For the moment, we have to keep re-running this target 
-# because the fix includes scripts rely on pre-processers 
-# in order to generate the headers correctly :(.  That 
-# means we can't use the $(HOSTCC) in order to get the 
+# For the moment, we have to keep re-running this target
+# because the fix includes scripts rely on pre-processers
+# in order to generate the headers correctly :(.  That
+# means we can't use the $(HOSTCC) in order to get the
 # correct output.
 ifeq ($(ARCH_USE_MMU),y)
-export header_extra_args = 
+export header_extra_args =
 else
 export header_extra_args = -n
 endif
@@ -105,8 +105,10 @@
 endif
 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
 	$(MAKE) nptl_headers
+ ifeq ($(shell $(CC) --help >& /dev/null && echo yes),yes)
 	$(MAKE) nptl_arch_headers
 	$(MAKE) nptl_linux_headers
+ endif
 endif
 
 pregen: headers
@@ -129,7 +131,10 @@
 	printf '#ifndef _LIBC_INTERNAL_H\n#define _LIBC_INTERNAL_H 1\n#endif\n' > \
 		$(PREFIX)$(DEVEL_PREFIX)include/libc-internal.h
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
+	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/_lfs_64.h
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_uintmaxtostr.h
+	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/kernel_sigaction.h
+	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/kernel_stat.h
 ifneq ($(UCLIBC_HAS_FLOATS),y)
 	# Remove floating point related headers since float support is disabled.
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
@@ -178,9 +183,11 @@
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
 endif
 ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
+ifneq ($(UCLIBC_HAS_GETOPT_LONG),y)
 	# Remove getopt header since gnu getopt support is disabled.
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
 endif
+endif
 ifneq ($(HAS_SHADOW),y)
 	# Remove shadow header since shadow password support is disabled.
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
@@ -196,7 +203,7 @@
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
 endif
 ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-	# Remove this as it is only used for building.
+	# Remove this as it is only used internally.
 	$(RM) $(PREFIX)$(DEVEL_PREFIX)include/tls.h
 endif
 	- at for i in `find $(PREFIX)$(DEVEL_PREFIX)include -type d` ; do \
@@ -216,11 +223,21 @@
 	done
 	if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
 		$(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
-		sed 	-e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
-			-e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
-			-e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
-			$(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
+		sed -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
+		    -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
+		    -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
+		    $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
 	fi
+ifeq ($(UCLIBC_HAS_THREADS),y)
+ifneq ($(LINUXTHREADS_OLD),y)
+	if [ -f $(top_builddir)lib/libpthread.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/libpthread.so.$(MAJOR_VERSION) ] ; then \
+		$(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
+		cp $(top_srcdir)extra/scripts/format.lds $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
+		echo "GROUP ( $(RUNTIME_PREFIX)lib/libpthread.so.$(MAJOR_VERSION) $(DEVEL_PREFIX)lib/libpthread_nonshared.a )" \
+			>> $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
+	fi
+endif
+endif
 ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
 	$(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
 		$(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
@@ -243,12 +260,12 @@
 	$(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
 	$(INSTALL) -m 644 lib/lib*-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
 		$(PREFIX)$(RUNTIME_PREFIX)lib
-	cp -dRf lib/*.so.* $(PREFIX)$(RUNTIME_PREFIX)lib
+	cd lib && $(TAR) -cf - *.so.* | $(TAR) -xf - -C $(PREFIX)$(RUNTIME_PREFIX)lib
 	@if [ -x lib/$(UCLIBC_LDSO_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so ] ; then \
-	    set -e; \
+		set -e; \
 		$(SHELL_SET_X); \
-	    $(INSTALL) -m 755 lib/$(UCLIBC_LDSO_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
-	    		$(PREFIX)$(RUNTIME_PREFIX)lib; \
+		$(INSTALL) -m 755 lib/$(UCLIBC_LDSO_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so \
+			$(PREFIX)$(RUNTIME_PREFIX)lib; \
 	fi
 endif
 

Modified: branches/uClibc-nptl/test/Test.mak
===================================================================
--- branches/uClibc-nptl/test/Test.mak	2006-08-18 03:05:30 UTC (rev 15815)
+++ branches/uClibc-nptl/test/Test.mak	2006-08-18 03:07:41 UTC (rev 15816)
@@ -1,21 +1,23 @@
 # Common makefile rules for tests
 #
-# Copyright (C) 2000,2001 Erik Andersen <andersen at uclibc.org>
+# Copyright (C) 2000-2006 Erik Andersen <andersen at 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
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+ifeq ($(TESTS),)
+TESTS := $(patsubst %.c,%,$(wildcard *.c))
+endif
+ifneq ($(TESTS_DISABLED),)
+TESTS := $(filter-out $(TESTS_DISABLED),$(TESTS))
+endif
+ifeq ($(SHELL_TESTS),)
+SHELL_TESTS := $(patsubst %.sh,shell_%,$(wildcard *.sh))
+endif
+
+ifneq ($(filter-out test,$(TESTS)),$(TESTS))
+$(error Sanity check: cannot have a test named "test.c")
+endif
+
 include ../Rules.mak
 
 U_TARGETS := $(TESTS)
@@ -23,44 +25,86 @@
 U_TARGETS += $(U_TESTS)
 G_TARGETS += $(G_TESTS)
 
-TARGETS    = 
+TARGETS   := $(SHELL_TESTS)
 ifeq ($(GLIBC_ONLY),)
 TARGETS   += $(U_TARGETS)
 endif
 ifeq ($(UCLIBC_ONLY),)
 TARGETS   += $(G_TARGETS)
 endif
+CLEAN_TARGETS := $(U_TARGETS) $(G_TARGETS)
 
-all: $(TARGETS)
+test check all: $(TARGETS)
 
-$(TARGETS): Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
+$(TARGETS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
 $(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
 $(G_TARGETS): $(patsubst %_glibc,%.c,$(G_TARGETS))
 
-$(U_TARGETS):
-	-@ echo "----------------------------"
-	-@ echo "Compiling $@ vs uClibc: "
-	-@ echo " "
-	$(CC) $(CFLAGS) -c $@.c -o $@.o
-	$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
-	$$WRAPPER_$@ ./$@ $$OPTS_$@ ; \
+define diff_test
+	$(Q)\
+	for x in "$@.out" "$(patsubst %_glibc,%,$@).out" ; do \
+		test -e "$$x.good" && $(do_showdiff) "$@.out" "$$x.good" && exec diff -u "$@.out" "$$x.good" ; \
+	done ; \
+	true
+endef
+define uclibc_glibc_diff_test
+	$(Q)\
+	test -z "$(DODIFF_$(patsubst %_glibc,%,$@))" && exec true ; \
+	uclibc_out="$@.out" ; \
+	glibc_out="$(patsubst %_glibc,%,$@).out" ; \
+	$(do_showdiff) $$uclibc_out $$glibc_out ; \
+	exec diff -u "$$uclibc_out" "$$glibc_out"
+endef
+define exec_test
+	$(showtest)
+	$(Q)\
+	$(WRAPPER) $(WRAPPER_$(patsubst %_glibc,%,$@)) \
+	./$@ $(OPTS) $(OPTS_$(patsubst %_glibc,%,$@)) &> "$@.out" ; \
 		ret=$$? ; \
-		test -z "$$RET_$@" && export RET_$@=0 ; \
-		test $$ret -eq $$RET_$@
-	-@ echo " "
+		expected_ret="$(RET_$(patsubst %_glibc,%,$@))" ; \
+		test -z "$$expected_ret" && export expected_ret=0 ; \
+	if ! test $$ret -eq $$expected_ret ; then \
+		$(RM) $@ ; \
+		cat "$@.out" ; \
+		exec false ; \
+	fi
+	$(SCAT) "$@.out"
+endef
 
+$(U_TARGETS):
+	$(showlink)
+	$(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c $@.c -o $@.o
+	$(Q)$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@)
+ifeq ($(COMPILE_ONLY),)
+	$(exec_test)
+	$(diff_test)
+endif
+
 $(G_TARGETS):
-	-@ echo "----------------------------"
-	-@ echo "Compiling $@ vs glibc: "
-	-@ echo " "
-	$(HOSTCC) $(GLIBC_CFLAGS) -c $(patsubst %_glibc,%,$@).c -o $@.o
-	$(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
-	$(STRIPTOOL) -x -R .note -R .comment $@
-	$$WRAPPER_$(patsubst %_glibc,%,$@) ./$@ $$OPTS_$(patsubst %_glibc,%,$@) ; \
-		ret=$$? ; \
-		test -z "$$RET_$(patsubst %_glibc,%,$@)" && export RET_$(patsubst %_glibc,%,$@)=0 ; \
-		test $$ret -eq $$RET_$(patsubst %_glibc,%,$@)
-	-@ echo " "
+	$(showlink)
+	$(Q)$(HOSTCC) $(HOST_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) -c $(patsubst %_glibc,%,$@).c -o $@.o
+	$(Q)$(HOSTCC) $(HOST_LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
+ifeq ($(COMPILE_ONLY),)
+	$(exec_test)
+	$(diff_test)
+	$(uclibc_glibc_diff_test)
+endif
 
+shell_%:
+ifeq ($(COMPILE_ONLY),)
+	$(showtest)
+	$(Q)$(SHELL) $(patsubst shell_%,%.sh,$@)
+endif
+
+%.so: %.c
+	$(showlink)
+	$(Q)$(CC) \
+		$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) \
+		-fPIC -shared $< -o $@ -Wl,-soname,$@ \
+		$(LDFLAGS) $(EXTRA_LIBS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
+
 clean:
-	$(RM) *.[oa] *~ core $(TARGETS)
+	$(showclean)
+	$(Q)$(RM) *.a *.o *.so *~ core *.out *.gdb $(CLEAN_TARGETS) $(EXTRA_CLEAN)
+
+.PHONY: all check clean test




More information about the uClibc-cvs mailing list