svn commit: trunk/uClibc/test

kraj at uclibc.org kraj at uclibc.org
Mon Mar 5 20:49:59 UTC 2007


Author: kraj
Date: 2007-03-05 12:49:57 -0800 (Mon, 05 Mar 2007)
New Revision: 18013

Log:
New test targets 'compile' and 'run'


Modified:
   trunk/uClibc/test/Makefile
   trunk/uClibc/test/README
   trunk/uClibc/test/Rules.mak
   trunk/uClibc/test/Test.mak


Changeset:
Modified: trunk/uClibc/test/Makefile
===================================================================
--- trunk/uClibc/test/Makefile	2007-03-05 20:46:46 UTC (rev 18012)
+++ trunk/uClibc/test/Makefile	2007-03-05 20:49:57 UTC (rev 18013)
@@ -29,20 +29,32 @@
 DIRS := $(filter-out math,$(DIRS))
 
 
-test check all: subdirs
+test check all: run
 
+run: compile subdirs_run
+
+compile:subdirs_compile
+
 tags:
 	ctags -R
 
 clean: subdirs_clean
 
 subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_compile: $(patsubst %, _dircompile_%, $(DIRS))
+subdirs_run: $(patsubst %, _dirrun_%, $(DIRS))
 subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
 
 $(patsubst %, _dir_%, $(DIRS)) : dummy
 	$(Q)$(MAKE) -C $(patsubst _dir_%, %, $@)
 
+$(patsubst %, _dirrun_%, $(DIRS)) : dummy
+	$(Q)$(MAKE) -C $(patsubst _dirrun_%, %, $@) run
+
+$(patsubst %, _dircompile_%, $(DIRS)) : dummy
+	$(Q)$(MAKE) -C $(patsubst _dircompile_%, %, $@) compile
+
 $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
 	$(Q)$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
 
-.PHONY: all check clean dummy subdirs subdirs_clean test
+.PHONY: all check clean dummy subdirs_compile subdirs_run subdirs subdirs_clean test run compile

Modified: trunk/uClibc/test/README
===================================================================
--- trunk/uClibc/test/README	2007-03-05 20:46:46 UTC (rev 18012)
+++ trunk/uClibc/test/README	2007-03-05 20:49:57 UTC (rev 18013)
@@ -1,14 +1,29 @@
 -----------
  For: User
 -----------
+Following make targets are avaialable
 
+make compile
+
+This will compile and link the tests
+
+make run
+
+This will check for binaries if they are not there it
+will call 'compile' target then it will execute all the
+tests.
+
+make check
+make all
+
+This will build and run tests.
+
 The following make variables may help you in testing:
  - UCLIBC_ONLY  - only run tests against uClibc
  - GLIBC_ONLY   - only run tests against glibc
- - COMPILE_ONLY - just build the tests, don't run them
- - CHECK_ONLY   - only run the tests, don't compile or link them
  - V / VERBOSE  - run tests with a lot of output
-
+ - TEST_INSTALLED_UCLIBC - Test installed libraries 
+                           under /lib and /usr/lib.
 So, to just run the uClibc tests, try this:
 make check UCLIBC_ONLY=1
 

Modified: trunk/uClibc/test/Rules.mak
===================================================================
--- trunk/uClibc/test/Rules.mak	2007-03-05 20:46:46 UTC (rev 18012)
+++ trunk/uClibc/test/Rules.mak	2007-03-05 20:49:57 UTC (rev 18013)
@@ -10,10 +10,11 @@
 #
 
 top_builddir ?= ../
+
 TESTDIR=$(top_builddir)test/
 
 include $(top_builddir)/Rules.mak
-
+ifndef TEST_INSTALLED_UCLIBC
 ifdef UCLIBC_LDSO
 ifeq (,$(findstring /,$(UCLIBC_LDSO)))
 UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO)
@@ -21,7 +22,7 @@
 else
 UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*))
 endif
-
+endif
 #--------------------------------------------------------
 # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
 LC_ALL:= C
@@ -96,8 +97,14 @@
 	HOST_LDFLAGS  += -static
 endif
 LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
+UCLIBC_LDSO_ABSPATH=$(shell pwd)
+ifdef TEST_INSTALLED_UCLIBC
+LDFLAGS += -Wl,-rpath,./
+UCLIBC_LDSO_ABSPATH=/lib
+endif
+
 ifeq ($(findstring -static,$(LDFLAGS)),)
-LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO)
+	LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)
 endif
 
 
@@ -123,7 +130,7 @@
 pur_showclean = echo "  "CLEAN $(notdir $(CURDIR))
 pur_showdiff  = echo "  "TEST_DIFF $(notdir $(CURDIR))/
 pur_showlink  = echo "  "TEST_LINK $(notdir $(CURDIR))/ $@
-pur_showtest  = echo "  "TEST_EXEC $(notdir $(CURDIR))/ $@
+pur_showtest  = echo "  "TEST_EXEC $(notdir $(CURDIR))/ $(patsubst %.exe,%,$@)
 sil_showclean =
 sil_showdiff  = true
 sil_showlink  = true
@@ -131,7 +138,7 @@
 ver_showclean =
 ver_showdiff  = true echo
 ver_showlink  = true echo
-ver_showtest  = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $@\n$(banner)\n"
+ver_showtest  = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $(patsubst %.exe,%,$@)\n$(banner)\n"
 do_showclean  = $($(DISP)_showclean)
 do_showdiff   = $($(DISP)_showdiff)
 do_showlink   = $($(DISP)_showlink)

Modified: trunk/uClibc/test/Test.mak
===================================================================
--- trunk/uClibc/test/Test.mak	2007-03-05 20:46:46 UTC (rev 18012)
+++ trunk/uClibc/test/Test.mak	2007-03-05 20:49:57 UTC (rev 18013)
@@ -23,10 +23,7 @@
 
 U_TARGETS := $(TESTS)
 G_TARGETS := $(patsubst %,%_glibc,$(U_TARGETS))
-U_TARGETS += $(U_TESTS)
-G_TARGETS += $(G_TESTS)
 
-TARGETS   := $(SHELL_TESTS)
 ifeq ($(GLIBC_ONLY),)
 TARGETS   += $(U_TARGETS)
 endif
@@ -34,72 +31,78 @@
 TARGETS   += $(G_TARGETS)
 endif
 CLEAN_TARGETS := $(U_TARGETS) $(G_TARGETS)
+COMPILE_TARGETS :=  $(TARGETS)
+TARGETS += $(SHELL_TESTS)
+RUN_TARGETS := $(patsubst %,%.exe,$(TARGETS))
 
-test check all: $(TARGETS)
-	@true
+define binary_name
+$(patsubst %.exe,%,$@)
+endef
 
-$(TARGETS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
-$(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
-$(G_TARGETS): $(patsubst %_glibc,%.c,$(G_TARGETS))
-
 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" ; \
+	for x in "$(binary_name).out" "$(patsubst %_glibc,%,$(binary_name)).out" ; do \
+		test -e "$$x.good" && $(do_showdiff) "$(binary_name).out" "$$x.good" && exec diff -u "$(binary_name).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" ; \
+	test -z "$(DODIFF_$(patsubst %_glibc,%,$(binary_name)))" && exec true ; \
+	uclibc_out="$(binary_name).out" ; \
+	glibc_out="$(patsubst %_glibc,%,$(binary_name)).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" ; \
+	$(WRAPPER) $(WRAPPER_$(patsubst %_glibc,%,$(binary_name))) \
+	./$(binary_name) $(OPTS) $(OPTS_$(patsubst %_glibc,%,$(binary_name))) &> "$(binary_name).out" ; \
 		ret=$$? ; \
-		expected_ret="$(RET_$(patsubst %_glibc,%,$@))" ; \
+		expected_ret="$(RET_$(patsubst %_glibc,%,$(binary_name)))" ; \
 		test -z "$$expected_ret" && export expected_ret=0 ; \
 	if ! test $$ret -eq $$expected_ret ; then \
-		$(RM) $@ ; \
+		$(RM) $(binary_name) ; \
 		echo "ret == $$ret ; expected_ret == $$expected_ret" ; \
-		cat "$@.out" ; \
+		cat "$(binary_name).out" ; \
 		exit 1 ; \
 	fi
-	$(SCAT) "$@.out"
+	$(SCAT) "$(binary_name).out"
 endef
 
-$(U_TARGETS):
-ifeq ($(CHECK_ONLY),)
-	$(showlink)
-	$(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c $@.c -o $@.o
-	$(Q)$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@)
-endif
-ifeq ($(COMPILE_ONLY),)
+test check all: run
+run: $(RUN_TARGETS) compile
+$(RUN_TARGETS): $(TARGETS)
+ifeq ($(shell echo "$(SHELL_TESTS)"|grep "$(binary_name)"),)
 	$(exec_test)
 	$(diff_test)
+ifeq ($(UCLIBC_ONLY),)
+	$(uclibc_glibc_diff_test)
 endif
+endif
 
-$(G_TARGETS):
+compile: $(COMPILE_TARGETS)
+
+G_TARGET_SRCS := $(patsubst %,%.c,$(G_TARGETS))
+U_TARGET_SRCS := $(patsubst %,%.c,$(U_TARGETS))
+
+$(MAKE_SRCS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
+
+$(U_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS)
 	$(showlink)
+	$(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c $@.c -o $@.o
+	$(Q)$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@)
+
+$(G_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS)
+	$(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
+	$(Q)$(SHELL) $(patsubst shell_%,%.sh,$(binary_name))
 
 %.so: %.c
 	$(showlink)
@@ -112,4 +115,4 @@
 	$(showclean)
 	$(Q)$(RM) *.a *.o *.so *~ core *.out *.gdb $(CLEAN_TARGETS) $(EXTRA_CLEAN)
 
-.PHONY: all check clean test
+.PHONY: all check clean test run compile




More information about the uClibc-cvs mailing list