summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKhem Raj <kraj@mvista.com>2007-03-05 20:49:57 +0000
committerKhem Raj <kraj@mvista.com>2007-03-05 20:49:57 +0000
commitd81e53c5fa66c5accc0d436e58c36fd62f7fee0c (patch)
tree20594c79961a4fc45850d344e923377d19a394b3 /test
parent530155cb274b725f3c275b19c6dc6c5875ad9b60 (diff)
New test targets 'compile' and 'run'
Diffstat (limited to 'test')
-rw-r--r--test/Makefile16
-rw-r--r--test/README21
-rw-r--r--test/Rules.mak17
-rw-r--r--test/Test.mak77
4 files changed, 84 insertions, 47 deletions
diff --git a/test/Makefile b/test/Makefile
index b306045cb..63d299092 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -29,7 +29,11 @@ endif
DIRS := $(filter-out math,$(DIRS))
-test check all: subdirs
+test check all: run
+
+run: compile subdirs_run
+
+compile:subdirs_compile
tags:
ctags -R
@@ -37,12 +41,20 @@ tags:
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
diff --git a/test/README b/test/README
index fe07a53f5..b59945c54 100644
--- a/test/README
+++ b/test/README
@@ -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
diff --git a/test/Rules.mak b/test/Rules.mak
index 878e9ea6a..ac210a72e 100644
--- a/test/Rules.mak
+++ b/test/Rules.mak
@@ -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 @@ endif
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 @@ ifneq ($(strip $(HAVE_SHARED)),y)
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 @@ banner := ---------------------------------
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 @@ sil_showtest = true
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)
diff --git a/test/Test.mak b/test/Test.mak
index a5bc968c7..a3a9c463b 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -23,10 +23,7 @@ include ../Rules.mak
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 @@ ifeq ($(UCLIBC_ONLY),)
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
-
-$(TARGETS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak
-$(U_TARGETS): $(patsubst %,%.c,$(U_TARGETS))
-$(G_TARGETS): $(patsubst %_glibc,%.c,$(G_TARGETS))
+define binary_name
+$(patsubst %.exe,%,$@)
+endef
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 @@ clean:
$(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