diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-02-14 03:12:08 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-02-14 03:12:08 +0000 |
commit | 61a3d74953d486d1a1a22ff23360abd71f04547f (patch) | |
tree | e16c7d7b3179480cc3f15581574c752c73fe8f91 /test | |
parent | 68742b37aa9e8c0a164d3d78f1a6aa9f8afd5958 (diff) |
- tighten up output
- add support for per-test and per-subdir CFLAGS/LDFLAGS
- move common uClibc/glibc code into defines
- add support for diffing output between uClibc/glibc
- add rules for generating libraries (needed by dlopen) ... only supports uClibc atm though
Diffstat (limited to 'test')
-rw-r--r-- | test/Test.mak | 84 |
1 files changed, 60 insertions, 24 deletions
diff --git a/test/Test.mak b/test/Test.mak index 6e1ced516..ed3f0785d 100644 --- a/test/Test.mak +++ b/test/Test.mak @@ -31,36 +31,72 @@ ifeq ($(UCLIBC_ONLY),) TARGETS += $(G_TARGETS) endif -all: $(TARGETS) +test check all: $(TARGETS) +# dummy rule to prevent the "Nothing to be done for `all'." message +ifeq ($(Q),@) + @true +endif -$(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 + $(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): + $(showtest) + $(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 " " + $(showtest) + $(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 + +%.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 $(TARGETS) |