[POC PATCH] buildsys: test: integrate directly

Mike Frysinger vapier at gentoo.org
Wed Jan 18 12:07:53 UTC 2012


The test framework predates the rest of the build system clean up (moving
to a kbuild style), so it doesn't integrate well and has some warts.

Rewrite it to merge with the new top level kbuild system.

Note: this converts most subdirs, but not all.  I'm having trouble mostly
with the shared library targets (pthread/dlopen/etc...).  Any suggestions
for how to better write test/Makefile.in would be appreciated.  I feel
like I'm over complicating things here, but I don't really know how the
Linux kbuild system is able to work its magic.  I'll post a query to the
kbuild lists though for help.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 Makefile.in                  |    4 +-
 Makerules                    |   12 ++++
 test/.gitignore              |    1 +
 test/API/Makefile            |   10 ++-
 test/API/Makefile.in         |    2 +-
 test/Makefile                |   73 ++--------------------
 test/Makefile.in             |  113 ++++++++++++++++++++++++++++++++++
 test/Rules.mak               |  140 ------------------------------------------
 test/Test.mak                |  129 --------------------------------------
 test/args/Makefile           |   10 ++-
 test/args/Makefile.in        |    8 ++-
 test/assert/Makefile         |   10 ++-
 test/assert/Makefile.in      |    8 ++-
 test/build/Makefile          |   10 ++-
 test/build/Makefile.in       |    4 +
 test/crypt/Makefile          |   10 ++-
 test/crypt/Makefile.in       |    7 +-
 test/ctype/Makefile          |   10 ++-
 test/ctype/Makefile.in       |    4 +-
 test/dlopen/Makefile         |   15 ++---
 test/dlopen/Makefile.in      |   49 ++++++++------
 test/inet/Makefile           |   10 ++-
 test/inet/Makefile.in        |   14 +++--
 test/librt/Makefile          |   10 ++-
 test/librt/Makefile.in       |    6 +-
 test/locale-mbwc/Makefile    |   10 ++-
 test/locale-mbwc/Makefile.in |   16 ++---
 test/locale/Makefile         |   10 ++-
 test/locale/Makefile.in      |   32 ++++------
 test/malloc/Makefile         |   10 ++-
 test/malloc/Makefile.in      |   18 +++++-
 test/math/Makefile           |   10 ++-
 test/math/Makefile.in        |   28 +++++----
 test/misc/Makefile           |   10 ++-
 test/misc/Makefile.in        |   31 ++++++---
 test/mmap/Makefile           |   10 ++-
 test/mmap/Makefile.in        |    4 +
 test/nptl/Makefile           |   11 ++--
 test/nptl/Makefile.in        |    5 +-
 test/pthread/Makefile        |   10 ++-
 test/pthread/Makefile.in     |   18 ++++--
 test/pwd_grp/Makefile        |   10 ++-
 test/pwd_grp/Makefile.in     |   20 ++++--
 test/regex/Makefile          |   10 ++-
 test/regex/Makefile.in       |    7 ++
 test/rpc/Makefile            |   10 ++-
 test/rpc/Makefile.in         |   14 ++---
 test/setjmp/Makefile         |   10 ++-
 test/setjmp/Makefile.in      |    4 +
 test/signal/Makefile         |   10 ++-
 test/signal/Makefile.in      |   13 +++-
 test/silly/Makefile          |   10 ++-
 test/silly/Makefile.in       |    8 ++-
 test/stat/Makefile           |   10 ++-
 test/stat/Makefile.in        |   20 +++---
 test/stdio/Makefile          |   10 ++-
 test/stdio/Makefile.in       |    9 ++-
 test/stdlib/Makefile         |   10 ++-
 test/stdlib/Makefile.in      |   21 +++++--
 test/string/Makefile         |   10 ++-
 test/string/Makefile.in      |   19 +++++-
 test/termios/Makefile        |   10 ++-
 test/termios/Makefile.in     |    4 +
 test/time/Makefile           |   10 ++-
 test/time/Makefile.in        |   26 ++++++---
 test/tls/Makefile            |   11 ++--
 test/tls/Makefile.in         |   12 +---
 test/unistd/Makefile         |   10 ++-
 test/unistd/Makefile.in      |   39 ++++++++----
 69 files changed, 619 insertions(+), 640 deletions(-)
 create mode 100644 test/Makefile.in
 delete mode 100644 test/Rules.mak
 delete mode 100644 test/Test.mak
 create mode 100644 test/build/Makefile.in
 create mode 100644 test/mmap/Makefile.in
 create mode 100644 test/regex/Makefile.in
 create mode 100644 test/setjmp/Makefile.in
 create mode 100644 test/termios/Makefile.in

diff --git a/Makefile.in b/Makefile.in
index d0ac6c0..855b540 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -50,6 +50,7 @@ include $(top_srcdir)libpthread/Makefile.in
 include $(top_srcdir)librt/Makefile.in
 include $(top_srcdir)libubacktrace/Makefile.in
 include $(top_srcdir)extra/locale/Makefile.in
+include $(top_srcdir)test/Makefile.in
 
 # last included to catch all the objects added by others (locales/threads)
 include $(top_srcdir)libc/Makefile.in
@@ -474,10 +475,9 @@ include_clean:
 	$(Q)$(RM) -r $(top_builddir)include/bits
 	$(Q)find $(top_builddir)include/ -type l -exec rm -f {} +
 
-clean: include_clean
+clean: include_clean CLEAN_tests
 	$(Q)$(RM) -r $(top_builddir)lib
 	@$(MAKE) -C utils CLEAN_utils
-	+$(MAKE) -s -C test clean
 	$(Q)$(RM) $(top_builddir)extra/scripts/unifdef
 	$(Q)$(RM) -r $(LOCAL_INSTALL_PATH)
 
diff --git a/Makerules b/Makerules
index 7153836..25deda0 100644
--- a/Makerules
+++ b/Makerules
@@ -92,6 +92,7 @@ endef
 pur_disp_compile.c = echo "  "CC $(show_objs)
 pur_disp_compile.i = echo "  "CPP $(show_objs)
 pur_disp_compile.s = echo "  "CC-S $(show_objs)
+pur_disp_compile.t = echo "  "CC $(show_objs)
 pur_disp_compile.u = echo "  "CC $(show_objs)
 pur_disp_compile.S = echo "  "AS $(show_objs)
 pur_disp_compile.m = $(pur_disp_compile.c)
@@ -109,10 +110,12 @@ pur_disp_gen       = echo "  "GEN $(show_objs)
 pur_disp_install   = echo "  "INSTALL $(1)
 pur_disp_unifdef   = echo "  "UNIFDEF $(show_objs)
 pur_disp_rm        = echo "  "CLEAN $(subst CLEAN_,,$(patsubst HEADERCLEAN_%,include \(%\),$@))
+pur_disp_test.u    = echo "  "TEST $(disp_test_name)
 
 sil_disp_compile.c = true
 sil_disp_compile.i = true
 sil_disp_compile.s = true
+sil_disp_compile.t = true
 sil_disp_compile.u = true
 sil_disp_compile.S = true
 sil_disp_compile.m = true
@@ -130,10 +133,12 @@ sil_disp_gen       = true
 sil_disp_install   = true
 sil_disp_unifdef   = true
 sil_disp_rm        = true
+sil_disp_test.u    = true
 
 bri_disp_compile.c = $(pur_disp_compile.c) $(call show_defs,$(cmd_compile.c))
 bri_disp_compile.i = $(pur_disp_compile.i) $(call show_defs,$(cmd_compile.i))
 bri_disp_compile.s = $(pur_disp_compile.s) $(call show_defs,$(cmd_compile.s))
+bri_disp_compile.t = $(pur_disp_compile.t) $(call show_defs,$(cmd_compile.t))
 bri_disp_compile.u = $(pur_disp_compile.u) $(call show_defs,$(cmd_compile.u))
 bri_disp_compile.S = $(pur_disp_compile.S) $(call show_defs,$(cmd_compile.S))
 bri_disp_compile.m = $(pur_disp_compile.m) $(call show_defs,$(cmd_compile.m))
@@ -151,12 +156,14 @@ bri_disp_gen = $(pur_disp_gen)
 bri_disp_install = $(pur_disp_install)
 bri_disp_unifdef = $(pur_disp_unifdef)
 bri_disp_rm = $(pur_disp_rm)
+bri_disp_test.u = $(pur_disp_test.u)
 
 esc=$(subst ','\'',$(1))
 # ')
 ver_disp_compile.c = echo '$(call esc,$(cmd_compile.c))'
 ver_disp_compile.i = echo '$(call esc,$(cmd_compile.i))'
 ver_disp_compile.s = echo '$(call esc,$(cmd_compile.s))'
+ver_disp_compile.t = echo '$(call esc,$(cmd_compile.t))'
 ver_disp_compile.u = echo '$(call esc,$(cmd_compile.u))'
 ver_disp_compile.S = echo '$(call esc,$(cmd_compile.S))'
 ver_disp_compile.m = echo '$(call esc,$(cmd_compile.m))'
@@ -174,10 +181,12 @@ ver_disp_gen       =
 ver_disp_install   =
 ver_disp_unifdef   = echo '$(call esc,$(cmd_unifdef))'
 ver_disp_rm        =
+ver_disp_test.u    =
 
 disp_compile.c = $($(DISP)_disp_compile.c)
 disp_compile.i = $($(DISP)_disp_compile.i)
 disp_compile.s = $($(DISP)_disp_compile.s)
+disp_compile.t = $($(DISP)_disp_compile.t)
 disp_compile.u = $($(DISP)_disp_compile.u)
 disp_compile.S = $($(DISP)_disp_compile.S)
 disp_compile.m = $($(DISP)_disp_compile.m)
@@ -195,6 +204,7 @@ disp_gen       = $($(DISP)_disp_gen)
 disp_install   = $($(DISP)_disp_install)
 disp_unifdef   = $($(DISP)_disp_unifdef)
 disp_rm        = $($(DISP)_disp_rm)
+disp_test.u    = $($(DISP)_disp_test.u)
 
 any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
 
@@ -235,6 +245,7 @@ cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) \
 	$(CFLAGS_gen.dep)
 cmd_compile.i = $(cmd_compile.c:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS)
 cmd_compile.s = $(cmd_compile.c:-c=-S)
+cmd_compile.t = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(TEST_CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep) $(TEST_LDFLAGS) $(LDFLAGS-$(notdir $(^D))) $(LDFLAGS-$(notdir $@))
 cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep)
 cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@))
 cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
@@ -273,6 +284,7 @@ endef
 compile.c = @$(call maybe_exec,compile.c)
 compile.i =  $(call maybe_exec,compile.i)
 compile.s =  $(call maybe_exec,compile.s)
+compile.t = @$(call maybe_exec,compile.t)
 compile.S = @$(call maybe_exec,compile.S)
 compile.m = @$(call maybe_exec,compile.m)
 compile.mi=  $(call maybe_exec,compile.mi)
diff --git a/test/.gitignore b/test/.gitignore
index e3b896f..01f8169 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -10,6 +10,7 @@
 # Executable test
 #
 *_glibc
+*.host
 argp/argp-ex[1-4]
 argp/argp-test
 argp/bug-argp1
diff --git a/test/API/Makefile b/test/API/Makefile
index 458d6c5..2e9dc12 100644
--- a/test/API/Makefile
+++ b/test/API/Makefile
@@ -1,7 +1,9 @@
-# uClibc API tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/API/Makefile.in b/test/API/Makefile.in
index 9e7cfdf..13f78f3 100644
--- a/test/API/Makefile.in
+++ b/test/API/Makefile.in
@@ -1,4 +1,4 @@
-# uClibc API tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
 SHELL_TESTS := shell_tst-API
diff --git a/test/Makefile b/test/Makefile
index 857ac8a..e0d6a73 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -5,72 +5,9 @@
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
 
+top_srcdir=../
 top_builddir=../
-include Rules.mak
-
-ALL_SUBDIRS := $(patsubst %/Makefile,%,$(wildcard */Makefile))
-
-DIRS := $(ALL_SUBDIRS)
-ifneq ($(HAVE_SHARED)$(UCLIBC_HAS_THREADS),yy)
-	DIRS := $(filter-out dlopen,$(DIRS))
-endif
-ifneq ($(findstring -static,$(LDFLAGS)),)
-	DIRS := $(filter-out dlopen,$(DIRS))
-endif
-ifneq ($(UCLIBC_HAS_THREADS),y)
-	DIRS := $(filter-out pthread,$(DIRS))
-endif
-ifneq ($(UCLIBC_HAS_FULL_RPC),y)
-	DIRS := $(filter-out rpc,$(DIRS))
-endif
-ifneq ($(UCLIBC_HAS_REGEX),y)
-	DIRS := $(filter-out regex,$(DIRS))
-endif
-ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
-	DIRS := $(filter-out tls nptl,$(DIRS))
-endif
-ifneq ($(UCLIBC_HAS_WCHAR),y)
-	DIRS := $(filter-out locale-mbwc,$(DIRS))
-endif
-ifneq ($(UCLIBC_HAS_LOCALE),y)
-	DIRS := $(filter-out locale,$(DIRS))
-endif
-ifneq ($(UCLIBC_HAS_CRYPT),y)
-	DIRS := $(filter-out crypt,$(DIRS))
-endif
-ifeq ($(HAS_NO_THREADS),y)
-	DIRS := $(filter-out pthread,$(DIRS))
-endif
-
-test check all: run
-
-run: compile subdirs_run
-
-compile: $(top_builddir)/$(LOCAL_INSTALL_PATH) subdirs_compile
-
-$(top_builddir)/$(LOCAL_INSTALL_PATH):
-	$(Q)$(MAKE) -C $(top_builddir) $(LOCAL_INSTALL_PATH)
-
-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_compile subdirs_run subdirs subdirs_clean test run compile
+include $(top_builddir)Rules.mak
+all: check
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/Makefile.in b/test/Makefile.in
new file mode 100644
index 0000000..8f2f149
--- /dev/null
+++ b/test/Makefile.in
@@ -0,0 +1,113 @@
+# uClibc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+abs_top_builddir := $(shell readlink -f $(top_builddir))/
+
+TEST_COMMON_CFLAGS = \
+	-I$(top_builddir)test -D_GNU_SOURCE $(CFLAG_-Wstrict-prototypes) \
+	$(CFLAGS-$(test_name)) $(CFLAGS-test/$(dir $(test_name)))
+TEST_HOST_CFLAGS = $(TEST_COMMON_CFLAGS)
+TEST_CFLAGS = $(TEST_COMMON_CFLAGS) \
+	-nostdinc -isystem $(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include \
+	-isystem $(top_srcdir)include -isystem $(KERNEL_HEADERS) $(CC_INC) $(CPU_CFLAGS)
+
+TEST_COMMON_LDFLAGS = $(LDFLAGS-$(test_name)) $(LDFLAGS-test/$(dir $(test_name)))
+TEST_LDFLAGS = $(TEST_COMMON_LDFLAGS) \
+	-B$(top_builddir)lib \
+	-Wl,-rpath,$(abs_top_builddir)lib \
+	-Wl,-rpath-link,$(abs_top_builddir)lib
+ifeq ($(findstring -static,$(LDFLAGS)),)
+TEST_LDFLAGS += -Wl,--dynamic-linker,$(abs_top_builddir)lib/$(UCLIBC_LDSO)
+endif
+TEST_HOST_LDFLAGS = $(TEST_COMMON_LDFLAGS)
+
+define disp_test_name
+$(patsubst %.out,%,$(patsubst $(tests_OUT)/%,%,$@))
+endef
+define test_name
+$(patsubst %.host,%,$(disp_test_name))
+endef
+define do_test.u
+	@$(disp_test.u)
+	$(Q)cd $(dir $@); tst=$(notdir $<); \
+	$(TEST_WRAPPER-$(test_name)) $(TEST_WRAPPER-$(dir $(test_name))) \
+	./$${tst} $(TEST_OPTS-$(test_name)) > $(notdir $@) 2>&1 ; \
+	ret=$$? exp_ret=$(TEST_RET-$(test_name)); : $${exp_ret:=0} ; \
+	if ! test $$ret -eq $$exp_ret ; then \
+		echo "ret == $$ret ; expected_ret == $$exp_ret" ; \
+		echo "The output of failed test is:" ; \
+		mv $${tst}.out $${tst}.fail.out ; \
+		cat $${tst}.fail.out ; \
+		exit 1 ; \
+	fi
+	$(Q)out="$(test_name).out" ; \
+	if test -e "$${out}.good" && ! diff -u "$${out}" "$${out}.good" ; then \
+		mv "$${out}" "$${test_name}.fail.out" ; \
+		exit 1 ; \
+	fi
+endef
+
+tests_DIR = $(top_srcdir)test
+tests_OUT = $(top_builddir)test
+
+tests-y =
+tests-extra-y =
+define include-testdir
+_tests-y := $$(tests-y)
+_tests-extra-y := $$(tests-extra-y)
+tests-y :=
+tests-extra-y :=
+test_DIR = $(tests_DIR)/$(1)
+include $$(test_DIR)/Makefile.in
+tests-y := $$(_tests-y) $$(addprefix $(1)/,$$(tests-y))
+tests-extra-y := $$(_tests-extra-y) $$(addprefix $(1)/,$$(tests-extra-y))
+#$$(test_DIR)/%: $$(test_DIR)/%.c
+#	$$(compile.t)
+# Needs a new line at the end here
+
+endef
+# API math nptl plt tls
+# inet setjmp misc signal regex
+tests_DIRS ?= args assert build crypt ctype librt mmap malloc pwd_grp silly stat stdlib string termios time unistd stdio pthread rpc locale locale-mbwc dlopen
+$(eval $(foreach f,$(patsubst %,$(tests_DIR)/%/Makefile.in,$(tests_DIRS)),\
+	$(call include-testdir,$(patsubst $(tests_DIR)/%/Makefile.in,%,$(f)))))
+
+tests_OBJ = $(addprefix $(tests_OUT)/,$(tests-y))
+tests_RUN = $(addsuffix .out,$(tests_OBJ))
+host_tests_OBJ = $(addsuffix .host,$(tests_OBJ))
+host_tests_RUN = $(addsuffix .out,$(host_tests_OBJ))
+
+check test: test-uclibc test-host $(addprefix $(tests_OUT)/,$(tests-extra-y))
+test-uclibc: $(tests_RUN)
+test-host: $(host_tests_RUN)
+test-cmp: $(addsuffix .cmp.out,$(tests_OBJ))
+test-compile: test-compile-uclibc test-compile-host
+test-compile-uclibc: $(tests_OBJ) 
+test-compile-host: $(host_tests_OBJ)
+
+%.sh.out: %.sh
+	$(do_test.u)
+
+define declare-test-rules
+$(tests_OUT)/$(1): $(tests_OUT)/$(1).c
+	$$(compile.t)
+$(tests_OUT)/$(1).out: $(tests_OUT)/$(1)
+	$$(do_test.u)
+$(tests_OUT)/$(1).host: $(tests_OUT)/$(1).c
+	$$(hcompile.u)
+$(tests_OUT)/$(1).host: BUILD_LDFLAGS += $$(TEST_HOST_LDFLAGS)
+$(tests_OUT)/$(1).host: BUILD_CFLAGS += $$(TEST_HOST_CFLAGS)
+$(tests_OUT)/$(1).host.out: $(tests_OUT)/$(1).host
+	$$(do_test.u)
+$(tests_OUT)/$(1).cmp.out: $(tests_OUT)/$(1).out $(tests_OUT)/$(1).host.out
+	$$(SECHO) "  CMP $(1)"
+	$$(Q)diff -u $$^ > $$@
+# Needs a new line at the end here
+
+endef
+$(eval $(foreach t,$(tests-y),$(call declare-test-rules,$(t))))
+
+objclean-y += CLEAN_tests
+
+CLEAN_tests:
+	$(do_rm) $(tests_OBJ) */*.host */*.out
diff --git a/test/Rules.mak b/test/Rules.mak
deleted file mode 100644
index 900ff44..0000000
--- a/test/Rules.mak
+++ /dev/null
@@ -1,140 +0,0 @@
-# Rules.mak for uClibc test subdirs
-#
-# Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
-#
-# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-#
-
-.SUFFIXES:
-
-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)
-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
-export LC_ALL
-
-ifeq ($(strip $(TARGET_ARCH)),)
-TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
-	-e 's/i.86/i386/' \
-	-e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \
-	-e 's/sa110/arm/' -e 's/arm.*/arm/g' \
-	-e 's/m68k.*/m68k/' \
-	-e 's/parisc.*/hppa/' \
-	-e 's/ppc/powerpc/g' \
-	-e 's/v850.*/v850/g' \
-	-e 's/sh[234]/sh/' \
-	-e 's/mips.*/mips/' \
-	-e 's/cris.*/cris/' \
-	-e 's/xtensa.*/xtensa/' \
-	)
-endif
-export TARGET_ARCH
-
-RM_R = $(Q)$(RM) -r
-LN_S = $(Q)$(LN) -fs
-
-ifneq ($(KERNEL_HEADERS),)
-ifeq ($(patsubst /%,/,$(KERNEL_HEADERS)),/)
-# Absolute path in KERNEL_HEADERS
-KERNEL_INCLUDES += -I$(KERNEL_HEADERS)
-else
-# Relative path in KERNEL_HEADERS
-KERNEL_INCLUDES += -I$(top_builddir)$(KERNEL_HEADERS)
-endif
-endif
-
-XCOMMON_CFLAGS := -I$(top_builddir)test -D_GNU_SOURCE
-XWARNINGS      += $(CFLAG_-Wstrict-prototypes)
-CFLAGS         := -nostdinc -I$(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include
-CFLAGS         += $(XCOMMON_CFLAGS) $(KERNEL_INCLUDES) $(CC_INC)
-CFLAGS         += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS)
-
-# Can't add $(OPTIMIZATION) here, it may be target-specific.
-# Just adding -Os for now.
-HOST_CFLAGS    += $(XCOMMON_CFLAGS) -Os $(XWARNINGS) -std=gnu99
-
-LDFLAGS        := $(CPU_LDFLAGS-y) -Wl,-z,now
-ifeq ($(DODEBUG),y)
-	CFLAGS        += -g
-	HOST_CFLAGS   += -g
-	LDFLAGS       += -Wl,-g
-	HOST_LDFLAGS  += -Wl,-g
-else
-	LDFLAGS       += -Wl,-s
-	HOST_LDFLAGS  += -Wl,-s
-endif
-
-ifneq ($(HAVE_SHARED),y)
-	LDFLAGS       += -Wl,-static -static-libgcc
-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=$(RUNTIME_PREFIX)$(MULTILIB_DIR)
-endif
-
-ifeq ($(findstring -static,$(LDFLAGS)),)
-LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO)
-endif
-
-ifeq ($(LDSO_GNU_HASH_SUPPORT),y)
-# Check for binutils support is done on root Rules.mak
-LDFLAGS += -Wl,${LDFLAGS_GNUHASH}
-endif
-
-
-ifneq ($(findstring -s,$(MAKEFLAGS)),)
-DISP := sil
-Q    := @
-SCAT := - at true
-else
-ifneq ($(V)$(VERBOSE),)
-DISP := ver
-Q    :=
-SCAT := cat
-else
-DISP := pur
-Q    := @
-SCAT := - at true
-endif
-endif
-ifneq ($(Q),)
-MAKEFLAGS += --no-print-directory
-endif
-
-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))/ $(@:.exe=)
-sil_showclean =
-sil_showdiff  = true
-sil_showlink  = true
-sil_showtest  = true
-ver_showclean =
-ver_showdiff  = true echo
-ver_showlink  = true echo
-ver_showtest  = printf "\n$(banner)\nTEST $(notdir $(CURDIR))/ $(@:.exe=)\n$(banner)\n"
-do_showclean  = $($(DISP)_showclean)
-do_showdiff   = $($(DISP)_showdiff)
-do_showlink   = $($(DISP)_showlink)
-do_showtest   = $($(DISP)_showtest)
-showclean = @$(do_showclean)
-showdiff  = @$(do_showdiff)
-showlink  = @$(do_showlink)
-showtest  = @$(do_showtest)
diff --git a/test/Test.mak b/test/Test.mak
deleted file mode 100644
index dd3fcc3..0000000
--- a/test/Test.mak
+++ /dev/null
@@ -1,129 +0,0 @@
-# Common makefile rules for tests
-#
-# Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
-#
-# 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,$(strip $(TESTS))),$(strip $(TESTS)))
-$(error Sanity check: cannot have a test named "test.c")
-endif
-
-U_TARGETS := $(TESTS)
-G_TARGETS := $(addsuffix _glibc,$(U_TARGETS))
-
-ifneq ($(GLIBC_TESTS_DISABLED),)
-G_TARGETS := $(filter-out $(GLIBC_TESTS_DISABLED),$(G_TARGETS))
-endif
-
-ifeq ($(GLIBC_ONLY),)
-TARGETS   += $(U_TARGETS)
-endif
-ifeq ($(UCLIBC_ONLY),)
-TARGETS   += $(G_TARGETS)
-endif
-
-CLEAN_TARGETS := $(U_TARGETS) $(G_TARGETS)
-CLEAN_TARGETS += $(TESTS_DISABLED) $(addsuffix _glibc,$(TESTS_DISABLED)) $(GLIBC_TESTS_DISABLED)
-COMPILE_TARGETS :=  $(TARGETS)
-RUN_TARGETS := $(addsuffix .exe,$(TARGETS))
-# provide build rules even for disabled tests:
-U_TARGETS += $(TESTS_DISABLED)
-G_TARGETS += $(addsuffix _glibc,$(TESTS_DISABLED)) $(GLIBC_TESTS_DISABLED)
-TARGETS += $(SHELL_TESTS)
-CFLAGS += $(CFLAGS_$(notdir $(CURDIR)))
-
-define binary_name
-$(patsubst %.exe,%,$@)
-endef
-define tst_src_name
-$(patsubst %_glibc,%,$(binary_name))
-endef
-
-define diff_test
-	$(Q)\
-	for x in "$(binary_name).out" "$(tst_src_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_$(tst_src_name))" && exec true ; \
-	uclibc_out="$(binary_name).out" ; \
-	glibc_out="$(tst_src_name).out" ; \
-	$(do_showdiff) $$uclibc_out $$glibc_out ; \
-	exec diff -u "$$uclibc_out" "$$glibc_out"
-endef
-define exec_test
-	$(showtest)
-	$(Q)\
-	$(WRAPPER) $(WRAPPER_$(tst_src_name)) \
-	./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name)) > "$(binary_name).out" 2>&1 ; \
-		ret=$$? ; \
-		expected_ret="$(RET_$(tst_src_name))" ; \
-		test -z "$$expected_ret" && export expected_ret=0 ; \
-	if ! test $$ret -eq $$expected_ret ; then \
-		echo "ret == $$ret ; expected_ret == $$expected_ret" ; \
-		echo "The output of failed test is:"; \
-		cat "$(binary_name).out"; \
-		exit 1 ; \
-	fi
-	$(SCAT) "$(binary_name).out"
-endef
-
-test check all: run
-run: $(RUN_TARGETS)
-$(RUN_TARGETS):
-	$(exec_test)
-	$(diff_test)
-ifeq ($(UCLIBC_ONLY),)
-	$(uclibc_glibc_diff_test)
-endif
-
-compile: $(COMPILE_TARGETS)
-
-G_TARGET_SRCS := $(addsuffix .c,$(G_TARGETS))
-U_TARGET_SRCS := $(addsuffix .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_$(notdir $(CURDIR))) $(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) $(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$(patsubst %_glibc,%,$@)) -c $(patsubst %_glibc,%,$@).c -o $@.o
-	$(Q)$(HOSTCC) $(HOST_LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
-
-
-shell_%:
-	$(showtest)
-	$(Q)$(if $(PRE_RUN_$(@)),$(PRE_RUN_$(@)))
-	$(Q)$(SHELL) $(patsubst shell_%,%.sh,$(binary_name))
-	$(Q)$(if $(POST_RUN_$(@)),$(POST_RUN_$(@)))
-
-%.so: %.c
-	$(showlink)
-	$(Q)$(CC) \
-		$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) \
-		-fPIC -shared $< -o $@ -Wl,-soname,$@ \
-		$(LDFLAGS) $(EXTRA_LIBS) $(LDFLAGS_$(patsubst %_glibc,%,$@))
-
-clean:
-	$(showclean)
-	$(Q)$(RM) *.a *.o *.so *~ core *.out *.gdb $(CLEAN_TARGETS) $(EXTRA_CLEAN)
-	$(Q)$(RM_R) $(EXTRA_DIRS)
-
-.PHONY: all check clean test run compile
diff --git a/test/args/Makefile b/test/args/Makefile
index 67ee452..2e9dc12 100644
--- a/test/args/Makefile
+++ b/test/args/Makefile
@@ -1,7 +1,9 @@
-# uClibc args tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/args/Makefile.in b/test/args/Makefile.in
index f4edab4..06e3578 100644
--- a/test/args/Makefile.in
+++ b/test/args/Makefile.in
@@ -1,8 +1,10 @@
-# uClibc args tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-OPTS_arg_test = a b c d e f g h
-WRAPPER_arg_test = \
+tests-y += arg_test
+
+TEST_OPTS-args/arg_test = a b c d e f g h
+TEST_WRAPPER-args/arg_test = \
 	env -i \
 	ENVVAR=123 \
 	SOMETHING=sldajfasdf \
diff --git a/test/assert/Makefile b/test/assert/Makefile
index 6913254..2e9dc12 100644
--- a/test/assert/Makefile
+++ b/test/assert/Makefile
@@ -1,7 +1,9 @@
-# uClibc assert tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/assert/Makefile.in b/test/assert/Makefile.in
index 8e3514f..b9a7fdf 100644
--- a/test/assert/Makefile.in
+++ b/test/assert/Makefile.in
@@ -1,5 +1,7 @@
-# uClibc assert tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-RET_assert     := 134
-WRAPPER_assert := trap ":" ABRT ;
+tests-y += assert
+
+TEST_RET-assert/assert     = 134
+TEST_WRAPPER-assert/assert = trap ":" ABRT ;
diff --git a/test/build/Makefile b/test/build/Makefile
index 99a64d5..2e9dc12 100644
--- a/test/build/Makefile
+++ b/test/build/Makefile
@@ -1,7 +1,9 @@
-# uClibc build tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/build/Makefile.in b/test/build/Makefile.in
new file mode 100644
index 0000000..6488a82
--- /dev/null
+++ b/test/build/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+tests-extra-y += check_config_options.sh.out
diff --git a/test/crypt/Makefile b/test/crypt/Makefile
index 44bbde0..2e9dc12 100644
--- a/test/crypt/Makefile
+++ b/test/crypt/Makefile
@@ -1,7 +1,9 @@
-# uClibc crypt tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/crypt/Makefile.in b/test/crypt/Makefile.in
index 22c27e9..9e80505 100644
--- a/test/crypt/Makefile.in
+++ b/test/crypt/Makefile.in
@@ -1,6 +1,7 @@
-# uClibc crypt tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-EXTRA_LDFLAGS := -lcrypt
+tests-$(UCLIBC_HAS_CRYPT) += crypt
 
-OPTS_crypt = < crypt.input
+LDFLAGS-crypt/crypt = -lcrypt
+TEST_OPTS-crypt/crypt = < crypt.input
diff --git a/test/ctype/Makefile b/test/ctype/Makefile
index fd72584..2e9dc12 100644
--- a/test/ctype/Makefile
+++ b/test/ctype/Makefile
@@ -1,7 +1,9 @@
-# uClibc ctype tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/ctype/Makefile.in b/test/ctype/Makefile.in
index ee10d59..f3d8267 100644
--- a/test/ctype/Makefile.in
+++ b/test/ctype/Makefile.in
@@ -1,4 +1,4 @@
-# uClibc ctype tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS := ctype
+tests-y += ctype
diff --git a/test/dlopen/Makefile b/test/dlopen/Makefile
index 92d14b9..2e9dc12 100644
--- a/test/dlopen/Makefile
+++ b/test/dlopen/Makefile
@@ -1,12 +1,9 @@
-# uClibc dlopen tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-ifneq ($(HAVE_SHARED),y)
-TESTS_DISABLED := test3
-LDFLAGS_libtest.so := -lpthread
-endif
-
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/dlopen/Makefile.in b/test/dlopen/Makefile.in
index 22190d9..fd7fd26 100644
--- a/test/dlopen/Makefile.in
+++ b/test/dlopen/Makefile.in
@@ -1,26 +1,33 @@
-# uClibc dlopen tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
 # rules need a little love to work with glibc ...
-export UCLIBC_ONLY := 1
+export UCLIBC_ONLY = 1
 
-TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr
+tests-$(HAVE_SHARED) += \
+	dladdr \
+	dlafk \
+	dlstatic \
+	dlundef \
+	test1 \
+	test2 \
+	test3
+ifeq ($(UCLIBC_HAS_THREADS),y)
+tests-$(HAVE_SHARED) += \
+	dltest \
+	dltest2
+endif
 
-CFLAGS_dltest    := -DLIBNAME="\"./libtest.so\""
-CFLAGS_dltest2   := -DLIBNAME="\"./libtest3.so\""
+CFLAGS-dlopen/dltest  = -DLIBNAME="\"./libtest.so\""
+CFLAGS-dlopen/dltest2 = -DLIBNAME="\"./libtest3.so\""
 
-LDFLAGS_dlstatic := -ldl
-LDFLAGS_dltest   := -ldl
-LDFLAGS_dltest2  := -ldl
-LDFLAGS_dlundef  := -ldl
-LDFLAGS_dlafk    := -ldl ./libafk.so -Wl,-rpath,.
-LDFLAGS_test1    := -ldl
-LDFLAGS_test2    := -ldl
-LDFLAGS_test3    := -ldl ./libtest1.so ./libtest2.so -Wl,-rpath,.
-LDFLAGS_dladdr   := -ldl
+LDFLAGS-test/dlopen/ = -ldl
 
-DEBUG_LIBS := X
-WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
+LDFLAGS-dlopen/dlafk = ./libafk.so -Wl,-rpath,'$$ORIGIN:.'
+LDFLAGS-dlopen/test3 = ./libtest1.so ./libtest2.so -Wl,-rpath,'$$ORIGIN:.'
+
+DEBUG_LIBS = X
+WRAPPER-dlopen = env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
 
 dltest: libtest.so
 dltest2: libtest3.so
@@ -28,12 +35,12 @@ dlstatic: libstatic.so
 dlundef: libundef.so
 dlafk: libafk.so
 libafk.so: libafk-temp.so
-LDFLAGS_libafk.so := ./libafk-temp.so -Wl,-rpath,.
+LDFLAGS-dlopen/libafk.so = ./libafk-temp.so -Wl,-rpath,.
 test1: libtest1.so
 test2: libtest1.so libtest2.so
 test3: libtest1.so libtest2.so
 libtest1.so: libtest2.so
-LDFLAGS_libtest.so := -lpthread
-LDFLAGS_libtest1.so := ./libtest2.so -Wl,-rpath,.
-LDFLAGS_libtest2.so := -Wl,-rpath,.
-LDFLAGS_libtest3.so := -lpthread -Wl,-rpath,.
+LDFLAGS-dlopen/libtest.so = -lpthread
+LDFLAGS-dlopen/libtest1.so = ./libtest2.so -Wl,-rpath,.
+LDFLAGS-dlopen/libtest2.so = -Wl,-rpath,.
+LDFLAGS-dlopen/libtest3.so = -lpthread -Wl,-rpath,.
diff --git a/test/inet/Makefile b/test/inet/Makefile
index 9605dca..2e9dc12 100644
--- a/test/inet/Makefile
+++ b/test/inet/Makefile
@@ -1,7 +1,9 @@
-# uClibc inet tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/inet/Makefile.in b/test/inet/Makefile.in
index 0710d3d..886d610 100644
--- a/test/inet/Makefile.in
+++ b/test/inet/Makefile.in
@@ -1,11 +1,13 @@
-# uClibc inet tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-#
-ifeq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
-TESTS_DISABLED := bug-if1 gethost_r-align gethostid if_nameindex tst-aton \
+
+tests-y += getnetent
+
+ifneq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
+tests-y += bug-if1 gethost_r-align gethostid if_nameindex tst-aton \
 	tst-network tst-ntoa
 endif
 
-ifeq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
-TESTS_DISABLED := tst-ether_aton tst-ethers tst-ethers-line
+ifneq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),)
+tests-y += tst-ether_aton tst-ethers tst-ethers-line
 endif
diff --git a/test/librt/Makefile b/test/librt/Makefile
index 354c681..2e9dc12 100644
--- a/test/librt/Makefile
+++ b/test/librt/Makefile
@@ -1,7 +1,9 @@
-# uClibc shm tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/librt/Makefile.in b/test/librt/Makefile.in
index 15ecbae..b1fbddd 100644
--- a/test/librt/Makefile.in
+++ b/test/librt/Makefile.in
@@ -1,4 +1,6 @@
-# uClibc shm tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-LDFLAGS_shmtest := -lrt
+tests-y += shmtest
+
+LDFLAGS-librt/shmtest = -lrt
diff --git a/test/locale-mbwc/Makefile b/test/locale-mbwc/Makefile
index 771c3d1..2e9dc12 100644
--- a/test/locale-mbwc/Makefile
+++ b/test/locale-mbwc/Makefile
@@ -1,7 +1,9 @@
-# uClibc locale tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/locale-mbwc/Makefile.in b/test/locale-mbwc/Makefile.in
index 7c0e9d5..cabe457 100644
--- a/test/locale-mbwc/Makefile.in
+++ b/test/locale-mbwc/Makefile.in
@@ -1,8 +1,12 @@
-# uClibc locale tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+# NOTE: For now disabled tst_strfmon to avoid build failure.
+#	 tst_strfmon
 #	 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm    \
 
-TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl          \
+tests-$(UCLIBC_HAS_WCHAR) += \
+	 tst_iswalnum tst_iswalpha tst_iswcntrl          \
 	 tst_iswctype tst_iswdigit tst_iswgraph          \
 	 tst_iswlower tst_iswprint tst_iswpunct          \
 	 tst_iswspace tst_iswupper tst_iswxdigit         \
@@ -18,10 +22,4 @@ TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl          \
 	 tst_wctype tst_wcwidth tst_strfmon \
 	 tst2_mbrtowc
 
-# NOTE: For now disabled tst_strfmon to avoid build failure.
-TESTS_DISABLED := tst_strfmon
-
-DODIFF_rint     := 1
-
-EXTRA_CFLAGS    := -D__USE_GNU -fno-builtin
-
+CFLAGS-test/locale-mbwc/ = -D__USE_GNU -fno-builtin
diff --git a/test/locale/Makefile b/test/locale/Makefile
index 771c3d1..2e9dc12 100644
--- a/test/locale/Makefile
+++ b/test/locale/Makefile
@@ -1,7 +1,9 @@
-# uClibc locale tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/locale/Makefile.in b/test/locale/Makefile.in
index 5a57ca5..890e9b4 100644
--- a/test/locale/Makefile.in
+++ b/test/locale/Makefile.in
@@ -1,29 +1,21 @@
-# uClibc locale tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+# NOTE: For now disabled some tests that are known not build
+#	 tst-ctype tst-fmon tst-leaks tst-rpmatch tst-strfmon1
 #	 tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm    \
 
-TESTS := bug-iconv-trans bug-usesetlocale collate-test dump-ctype \
+tests-$(UCLIBC_HAS_LOCALE) += bug-iconv-trans collate-test dump-ctype \
 	 gen-unicode-ctype show-ucs-data tst-ctype \
 	 tst-digits tst-fmon tst-langinfo tst-leaks tst-mbswcs1 \
 	 tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 tst-mbswcs6 \
 	 tst_nl_langinfo tst-numeric tst-rpmatch tst-setlocale \
-	 tst-sscanf tst-strfmon1 tst-trans tst-wctype tst-xlocale1 \
-	 tst-xlocale2 xfrm-test
-
-
-# NOTE: For now disabled some tests that are known not build
-TESTS_DISABLED := tst-ctype tst-fmon tst-leaks tst-rpmatch tst-strfmon1
-
-ifneq ($(UCLIBC_HAS_XLOCALE),y)
-TESTS_DISABLED += bug-usesetlocale tst-xlocale1 tst-xlocale2 xfrm-test tst-C-locale
-endif
-
-DODIFF_rint     := 1
-
-EXTRA_CFLAGS    := -D__USE_GNU -fno-builtin
+	 tst-sscanf tst-strfmon1 tst-trans tst-wctype
+tests-$(UCLIBC_HAS_XLOCALE) += \
+	bug-usesetlocale tst-xlocale1 tst-xlocale2 xfrm-test tst-C-locale
 
-OPTS_dump-ctype = C
-OPTS_tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in
-OPTS_tst-langinfo = < tst-langinfo.input
+CFLAGS-test/locale/ = -D__USE_GNU -fno-builtin
 
-EXTRA_DIRS := C
+TEST_OPTS-locale/dump-ctype = C
+TEST_OPTS-locale/tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in
+TEST_OPTS-locale/tst-langinfo = < tst-langinfo.input
diff --git a/test/malloc/Makefile b/test/malloc/Makefile
index d76f07b..2e9dc12 100644
--- a/test/malloc/Makefile
+++ b/test/malloc/Makefile
@@ -1,7 +1,9 @@
-# uClibc malloc tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/malloc/Makefile.in b/test/malloc/Makefile.in
index 7b8c0fa..94d0405 100644
--- a/test/malloc/Makefile.in
+++ b/test/malloc/Makefile.in
@@ -1,4 +1,18 @@
-# uClibc malloc tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS_DISABLED := time_malloc
+tests-y = \
+	mallocbug \
+	malloc \
+	malloc-standard-alignment \
+	realloc0 \
+	realloc-can-shrink \
+	testmalloc \
+	tst-calloc \
+	tst-malloc \
+	tst-mallocfork \
+	tst-mcheck \
+	tst-obstack \
+	tst-valloc
+
+# time_malloc
diff --git a/test/math/Makefile b/test/math/Makefile
index 135aedb..2e9dc12 100644
--- a/test/math/Makefile
+++ b/test/math/Makefile
@@ -1,7 +1,9 @@
-# uClibc math tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/math/Makefile.in b/test/math/Makefile.in
index e76cbdb..2c84ff2 100644
--- a/test/math/Makefile.in
+++ b/test/math/Makefile.in
@@ -1,24 +1,28 @@
-# uClibc math tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS := basic-test tst-definitions test-fpucw test-float test-ifloat test-double test-idouble \
-    rint signgam ilogb
-# gamma (removed from TESTS, need to add "small errors are ok" machinery there)
-ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),y)
-TESTS += test-ldouble test-ildoubl compile_test c99_test
-else
-CFLAGS_basic-test := -DNO_LONG_DOUBLE
+tests-y = \
+	basic-test tst-definitions test-fpucw test-float test-ifloat \
+    test-double test-idouble rint signgam ilogb
+# gamma (removed from tests-y; need to add "small errors are ok" machinery there)
+
+tests-$(UCLIBC_HAS_LONG_DOUBLE_MATH) += test-ldouble test-ildoubl compile_test c99_test
+
+ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),)
+CFLAGS-math/basic-test = -DNO_LONG_DOUBLE
 endif
 
-DODIFF_rint     := 1
-DODIFF_signgam  := 1
+tests-extra-y += \
+	rint.cmp.out \
+	signgam.cmp.out
 
 # NOTE: For basic-test we must disable the floating point optimization.
 #       Only for sh architecture because in the other architecture are disabled.
 ifeq ($(TARGET_ARCH),sh)
-CFLAGS_basic-test += -mieee
+CFLAGS-math/basic-test = -mieee
 endif
-EXTRA_CFLAGS    := -fno-builtin
+
+CFLAGS-math    := -fno-builtin
 EXTRA_LDFLAGS   := -lm
 
 PERL := /usr/bin/perl
diff --git a/test/misc/Makefile b/test/misc/Makefile
index 52f6c67..2e9dc12 100644
--- a/test/misc/Makefile
+++ b/test/misc/Makefile
@@ -1,7 +1,9 @@
-# uClibc misc tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
index 2263211..3480e38 100644
--- a/test/misc/Makefile.in
+++ b/test/misc/Makefile.in
@@ -1,14 +1,25 @@
-# uClibc misc tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob
-ifeq  ($(UCLIBC_HAS_LFS),)
-TESTS_DISABLED += dirent64
-endif
-CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+# disabled: outb tst-fnmatch bug-glob1 tst-gnuglob
+tests-y += \
+	bug-glob2 \
+	bug-readdir1 \
+	dirent \
+	fdopen \
+	opendir-tst1 \
+	popen \
+	seek \
+	sem \
+	stdarg \
+	tst-scandir \
+	tst-seekdir \
+	tst-utmp
+tests-extra-y += dirent.cmp.out
 
-DODIFF_dirent    := 1
-DODIFF_dirent64  := 1
+tests-$(UCLIBC_HAS_LFS) += dirent64
+tests-extra-$(UCLIBC_HAS_LFS) += dirent64.cmp.out
+CFLAGS-misc/dirent64 = -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 
-OPTS_bug-glob1   := $(PWD)
-OPTS_tst-fnmatch := < tst-fnmatch.input
+TEST_OPTS-misc/bug-glob1   = $(PWD)
+TEST_OPTS-misc/tst-fnmatch = < tst-fnmatch.input
diff --git a/test/mmap/Makefile b/test/mmap/Makefile
index 64b652d..2e9dc12 100644
--- a/test/mmap/Makefile
+++ b/test/mmap/Makefile
@@ -1,7 +1,9 @@
-# uClibc mmap tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/mmap/Makefile.in b/test/mmap/Makefile.in
new file mode 100644
index 0000000..b5b31d3
--- /dev/null
+++ b/test/mmap/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+tests-y += mmap mmap2 mmap64
diff --git a/test/nptl/Makefile b/test/nptl/Makefile
index c22b635..2e9dc12 100644
--- a/test/nptl/Makefile
+++ b/test/nptl/Makefile
@@ -1,8 +1,9 @@
-# uClibc NPTL tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-top_builddir=../../
 top_srcdir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+top_builddir=../../
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/nptl/Makefile.in b/test/nptl/Makefile.in
index b914802..a906901 100644
--- a/test/nptl/Makefile.in
+++ b/test/nptl/Makefile.in
@@ -1,7 +1,8 @@
-# uClibc NPTL tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS := tst-align tst-align2 tst-atfork1 tst-attr1 tst-attr2 tst-attr3	\
+tests-$(UCLIBC_HAS_THREADS_NATIVE) += \
+	tst-align tst-align2 tst-atfork1 tst-attr1 tst-attr2 tst-attr3	\
 	tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 tst-basic1	\
 	tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6		\
 	tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel6 tst-cancel7	\
diff --git a/test/pthread/Makefile b/test/pthread/Makefile
index d6f00d6..2e9dc12 100644
--- a/test/pthread/Makefile
+++ b/test/pthread/Makefile
@@ -1,7 +1,9 @@
-# uClibc pthread tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/pthread/Makefile.in b/test/pthread/Makefile.in
index c50748d..b0671ad 100644
--- a/test/pthread/Makefile.in
+++ b/test/pthread/Makefile.in
@@ -1,8 +1,16 @@
-# uClibc pthread tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS_DISABLED += cancellation-points
+# disabled: cancellation-points
+tests-$(UCLIBC_HAS_THREADS) += \
+	ex1 \
+	ex2 \
+	ex3 \
+	ex4 \
+	ex5 \
+	ex6 \
+	ex7 \
+	tst-too-many-cleanups
 
-EXTRA_LDFLAGS := -lpthread
-
-LDFLAGS_cancellation-points := -lrt
+LDFLAGS-test/pthread/ += -lpthread
+LDFLAGS-pthread/cancellation-points := -lrt
diff --git a/test/pwd_grp/Makefile b/test/pwd_grp/Makefile
index 21070f4..2e9dc12 100644
--- a/test/pwd_grp/Makefile
+++ b/test/pwd_grp/Makefile
@@ -1,7 +1,9 @@
-# uClibc pwd_grp tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/pwd_grp/Makefile.in b/test/pwd_grp/Makefile.in
index d561f3d..a49077a 100644
--- a/test/pwd_grp/Makefile.in
+++ b/test/pwd_grp/Makefile.in
@@ -1,8 +1,16 @@
-# uClibc pwd_grp tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-DODIFF_test_pwd  := 1
-DODIFF_test_grp  := 1
-DODIFF_pwcat     := 1
-DODIFF_grcat     := 1
-DODIFF_getgroups := 1
+tests-y += \
+	getgroups \
+	grcat \
+	pwcat \
+	test_grp \
+	test_pwd
+
+tests-extra-y += \
+	getgroups.cmp.out \
+	grcat.cmp.out \
+	pwcat.cmp.out \
+	test_grp.cmp.out \
+	test_pwd.cmp.out
diff --git a/test/regex/Makefile b/test/regex/Makefile
index 6391222..2e9dc12 100644
--- a/test/regex/Makefile
+++ b/test/regex/Makefile
@@ -1,7 +1,9 @@
-# uClibc regex tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/regex/Makefile.in b/test/regex/Makefile.in
new file mode 100644
index 0000000..10afa68
--- /dev/null
+++ b/test/regex/Makefile.in
@@ -0,0 +1,7 @@
+# uClibc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+tests-$(UCLIBC_HAS_REGEX) += \
+	testregex \
+	tst-regex2 \
+	tst-regexloc
diff --git a/test/rpc/Makefile b/test/rpc/Makefile
index 47accc6..2e9dc12 100644
--- a/test/rpc/Makefile
+++ b/test/rpc/Makefile
@@ -1,7 +1,9 @@
-# uClibc rpc tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/rpc/Makefile.in b/test/rpc/Makefile.in
index 5612ff2..6b1f352 100644
--- a/test/rpc/Makefile.in
+++ b/test/rpc/Makefile.in
@@ -1,11 +1,9 @@
-# uClibc rpc tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS := getrpcent
-
-ifeq ($(UCLIBC_HAS_REENTRANT_RPC),y)
-TESTS += getrpcent_r
-endif
-
-DODIFF_getrpcent := 1
+tests-$(UCLIBC_HAS_RPC) += \
+	getrpcent
+tests-$(UCLIBC_HAS_REENTRANT_RPC) += getrpcent_r
 
+tests-extra-$(UCLIBC_HAS_RPC) += \
+	getrpcent.cmp.out
diff --git a/test/setjmp/Makefile b/test/setjmp/Makefile
index a26e2d5..2e9dc12 100644
--- a/test/setjmp/Makefile
+++ b/test/setjmp/Makefile
@@ -1,7 +1,9 @@
-# uClibc setjmp tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/setjmp/Makefile.in b/test/setjmp/Makefile.in
new file mode 100644
index 0000000..a458a1f
--- /dev/null
+++ b/test/setjmp/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+tests-y += bug269-setjmp jmpbug sigjmpbug tst-setjmp tst-vfork-longjmp
diff --git a/test/signal/Makefile b/test/signal/Makefile
index e829365..2e9dc12 100644
--- a/test/signal/Makefile
+++ b/test/signal/Makefile
@@ -1,7 +1,9 @@
-# uClibc signal tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/signal/Makefile.in b/test/signal/Makefile.in
index c8e2545..ac7b0f0 100644
--- a/test/signal/Makefile.in
+++ b/test/signal/Makefile.in
@@ -1,6 +1,11 @@
-# uClibc signal tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),)
-TESTS_DISABLED := tst-sigsimple
-endif
+tests-y += \
+	sigchld \
+	signal \
+	tst-raise \
+	tst-signal \
+	tst-sigset
+
+tests-$(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL) += tst-sigsimple
diff --git a/test/silly/Makefile b/test/silly/Makefile
index 4db1850..2e9dc12 100644
--- a/test/silly/Makefile
+++ b/test/silly/Makefile
@@ -1,7 +1,9 @@
-# uClibc silly tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
index bb08e0d..1b348c0 100644
--- a/test/silly/Makefile.in
+++ b/test/silly/Makefile.in
@@ -1,5 +1,7 @@
-# uClibc silly tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-RET_hello := 42
-RET_tiny  := 42
+tests-y += hello tiny
+
+TEST_RET-silly/hello = 42
+TEST_RET-silly/tiny  = 42
diff --git a/test/stat/Makefile b/test/stat/Makefile
index ecde416..2e9dc12 100644
--- a/test/stat/Makefile
+++ b/test/stat/Makefile
@@ -1,7 +1,9 @@
-# uClibc stat tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/stat/Makefile.in b/test/stat/Makefile.in
index 9c06ded..e57642a 100644
--- a/test/stat/Makefile.in
+++ b/test/stat/Makefile.in
@@ -1,13 +1,15 @@
-# uClibc stat tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-ifeq ($(UCLIBC_HAS_LFS),)
-TESTS_DISABLED := stat64
-endif
-CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+tests-y += \
+	memcmp-stat \
+	stat
+tests-extra-y += \
+	stat.cmp.out
 
-DODIFF_stat   := 1
-DODIFF_stat64 := 1
+tests-$(UCLIBC_HAS_LFS) += stat64
+tests-extra-$(UCLIBC_HAS_LFS) += stat64.cmp.out
+CFLAGS-stat/stat64 = -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 
-OPTS_stat   := Makefile
-OPTS_stat64 := Makefile
+TEST_OPTS-stat/stat   = Makefile
+TEST_OPTS-stat/stat64 = Makefile
diff --git a/test/stdio/Makefile b/test/stdio/Makefile
index a5d662a..2e9dc12 100644
--- a/test/stdio/Makefile
+++ b/test/stdio/Makefile
@@ -1,7 +1,9 @@
-# uClibc stdio tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/stdio/Makefile.in b/test/stdio/Makefile.in
index 0bfbd13..71b3fb0 100644
--- a/test/stdio/Makefile.in
+++ b/test/stdio/Makefile.in
@@ -1,4 +1,9 @@
-# uClibc stdio tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-DODIFF_64bit := 1
+tests-y += \
+	64bit \
+	fclose-loop
+
+tests-extra-y += \
+	64bit.cmp.out
diff --git a/test/stdlib/Makefile b/test/stdlib/Makefile
index f8a4038..2e9dc12 100644
--- a/test/stdlib/Makefile
+++ b/test/stdlib/Makefile
@@ -1,7 +1,9 @@
-# uClibc stdlib tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/stdlib/Makefile.in b/test/stdlib/Makefile.in
index 0bb0697..9283422 100644
--- a/test/stdlib/Makefile.in
+++ b/test/stdlib/Makefile.in
@@ -1,7 +1,18 @@
-# uClibc stdlib tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-DODIFF_qsort       := 1
-DODIFF_testatexit  := 1
-DODIFF_teston_exit := 1
-DODIFF_teststrtol  := 1
+tests-y += \
+	ptytest \
+	qsort \
+	testatexit \
+	test-canon2 \
+	test-canon \
+	teston_exit \
+	teststrtol \
+	teststrtoq
+
+tests-extra-y += \
+	qsort.cmp.out \
+	testatexit.cmp.out \
+	teston_exit.cmp.out \
+	teststrtol.cmp.out
diff --git a/test/string/Makefile b/test/string/Makefile
index 62c8269..2e9dc12 100644
--- a/test/string/Makefile
+++ b/test/string/Makefile
@@ -1,7 +1,9 @@
-# uClibc string tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/string/Makefile.in b/test/string/Makefile.in
index ad52a9f..bff00ff 100644
--- a/test/string/Makefile.in
+++ b/test/string/Makefile.in
@@ -1,4 +1,19 @@
-# uClibc string tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-EXTRA_CFLAGS := -fno-builtin
+tests-y += \
+	bug-strcoll1 \
+	bug-strncat1 \
+	bug-strpbrk1 \
+	bug-strspn1 \
+	stratcliff \
+	testcopy \
+	tester \
+	test-ffs \
+	tst-bswap \
+	tst-inlcall \
+	tst-strlen \
+	tst-strtok \
+	tst-strxfrm
+
+CFLAGS-test/string/ = -fno-builtin
diff --git a/test/termios/Makefile b/test/termios/Makefile
index 926e052..2e9dc12 100644
--- a/test/termios/Makefile
+++ b/test/termios/Makefile
@@ -1,7 +1,9 @@
-# uClibc termios tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/termios/Makefile.in b/test/termios/Makefile.in
new file mode 100644
index 0000000..0ef829d
--- /dev/null
+++ b/test/termios/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+tests-y += termios
diff --git a/test/time/Makefile b/test/time/Makefile
index 103acb8..2e9dc12 100644
--- a/test/time/Makefile
+++ b/test/time/Makefile
@@ -1,7 +1,9 @@
-# uClibc time tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/time/Makefile.in b/test/time/Makefile.in
index 05f73a4..0ae6459 100644
--- a/test/time/Makefile.in
+++ b/test/time/Makefile.in
@@ -1,12 +1,22 @@
-# uClibc time tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS_DISABLED := bug-asctime bug-asctime_r time tst-mktime2 tst-posixtz \
-	tst-strftime tst-strptime tst-timezone
+tests-y += \
+	clocktest \
+	test_time \
+	tst-ctime \
+	tst-futimens1 \
+	tst-mktime3 \
+	tst-mktime \
+	tst-strptime2 \
+	tst_wcsftime
+tests-$(UCLIBC_HAS_XLOCALE) += tst-ftime_l
 
-ifneq ($(UCLIBC_HAS_XLOCALE),y)
-TESTS_DISABLED += tst-ftime_l
-endif
+tests-extra-y += \
+	tst-futimens1.cmp.out
 
-CFLAGS_tst-strptime2 := -std=c99
-DODIFF_futimens1 := 1
+# disabled:
+# bug-asctime bug-asctime_r time tst-mktime2 tst-posixtz tst-strftime
+# tst-strptime tst-timezone
+
+CFLAGS-time/tst-strptime2 = -std=c99
diff --git a/test/tls/Makefile b/test/tls/Makefile
index 607fec2..2e9dc12 100644
--- a/test/tls/Makefile
+++ b/test/tls/Makefile
@@ -1,8 +1,9 @@
-# uClibc TLS tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-top_builddir=../../
 top_srcdir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+top_builddir=../../
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/tls/Makefile.in b/test/tls/Makefile.in
index 875c607..b8b08fa 100644
--- a/test/tls/Makefile.in
+++ b/test/tls/Makefile.in
@@ -1,16 +1,12 @@
-# uClibc TLS tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-TESTS := tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7	\
+# disabled: tst-tls1-static tst-tls2-static tst-tls9-static
+tests-$(HAVE_SHARED) += \
+	tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7	\
 	tst-tls8 tst-tls9 tst-tls10 tst-tls11 tst-tls12 tst-tls13	\
 	tst-tls14 tst-tls15 tst-tls16 tst-tls17 tst-tls18 tst-tls-at-ctor \
 	tst-tls1-static tst-tls2-static tst-tls9-static
-TESTS_DISABLED := tst-tls1-static tst-tls2-static tst-tls9-static
-
-#all these tests require shared libraries
-ifeq ($(HAVE_SHARED),)
-TESTS_DISABLED := $(TESTS)
-endif
 
 # All these tests need tls.h, which is not installed with glibc
 GLIBC_TESTS_DISABLED := $(addsuffix _glibc,$(filter-out $(TESTS_DISABLED),$(TESTS)))
diff --git a/test/unistd/Makefile b/test/unistd/Makefile
index 0dbd52e..2e9dc12 100644
--- a/test/unistd/Makefile
+++ b/test/unistd/Makefile
@@ -1,7 +1,9 @@
-# uClibc unistd tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
+top_srcdir=../../
 top_builddir=../../
-include ../Rules.mak
--include Makefile.in
-include ../Test.mak
+include $(top_builddir)Rules.mak
+all: check
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
index c542f98..a199082 100644
--- a/test/unistd/Makefile.in
+++ b/test/unistd/Makefile.in
@@ -1,23 +1,34 @@
-# uClibc unistd tests
+# uClibc tests
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 
-ifeq ($(UCLIBC_HAS_LFS),)
-TESTS_DISABLED := tst-preadwrite64
-endif
-OPTS_getopt      := -abcXXX -9
-OPTS_getopt_long := --add XXX --delete YYY --verbose
+# disabled: clone
+tests-y += \
+	errno \
+	exec-null \
+	fork \
+	getcwd \
+	getopt \
+	getopt_long \
+	tstgetopt \
+	tst-preadwrite \
+	vfork
+tests-$(UCLIBC_HAS_LFS) += tst-preadwrite64
+
+TEST_OPTS-unistd/getopt      = -abcXXX -9
+TEST_OPTS-unistd/getopt_long = --add XXX --delete YYY --verbose
+
 ifeq ($(UCLIBC_HAS_GNU_GETOPT),y)
-OPTS_tstgetopt   := -a -b -cfoobar --required foobar --optional=bazbug --none random --col --color --colour
+TEST_OPTS-unistd/tstgetopt   = -a -b -cfoobar --required foobar --optional=bazbug --none random --col --color --colour
 else
 # reordering is not supported, behaves as if POSIXLY_CORRECT would be set
-OPTS_tstgetopt   := -a -b -cfoobar --required foobar --optional=bazbug --none --colou --color --colour random
+TEST_OPTS-unistd/tstgetopt   = -a -b -cfoobar --required foobar --optional=bazbug --none --colou --color --colour random
 endif
 
 # getconf.c lives in utils/
 # Testsuite cannot currently be built with O= anyway, so hardcode path here
-getconf.c:
-	$(LN_S) ../../utils/$(@F) .
-EXTRA_CLEAN    += getconf.c
-TESTS_DISABLED += getconf
-CFLAGS_getconf = -DGETCONF_DIR='"$(CURDIR)"'
-shell_tst-getconf: getconf getconf_glibc
+#getconf.c:
+#	$(LN_S) ../../utils/$(@F) .
+#EXTRA_CLEAN    += getconf.c
+#TESTS_DISABLED += getconf
+#CFLAGS_getconf = -DGETCONF_DIR='"$(CURDIR)"'
+#shell_tst-getconf: getconf getconf_glibc
-- 
1.7.8.3



More information about the uClibc mailing list