summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libc/sysdeps/linux/bfin/sys/user.h57
-rw-r--r--libc/sysdeps/linux/common/mprotect.c2
-rw-r--r--test/Makefile2
-rw-r--r--test/README22
-rw-r--r--test/Test.mak3
-rw-r--r--test/args/Makefile10
-rw-r--r--test/args/Makefile.in9
-rw-r--r--test/assert/Makefile6
-rw-r--r--test/assert/Makefile.in5
-rw-r--r--test/build/Makefile3
-rw-r--r--test/crypt/Makefile7
-rw-r--r--test/crypt/Makefile.in6
-rw-r--r--test/ctype/Makefile5
-rw-r--r--test/ctype/Makefile.in4
-rw-r--r--test/dlopen/Makefile39
-rw-r--r--test/dlopen/Makefile.in38
-rw-r--r--test/inet/Makefile3
-rw-r--r--test/locale-mbwc/Makefile28
-rw-r--r--test/locale-mbwc/Makefile.in27
-rw-r--r--test/locale/Makefile30
-rw-r--r--test/locale/Makefile.in29
-rw-r--r--test/malloc/Makefile5
-rw-r--r--test/malloc/Makefile.in4
-rw-r--r--test/math/Makefile29
-rw-r--r--test/math/Makefile.in27
-rw-r--r--test/misc/Makefile13
-rw-r--r--test/misc/Makefile.in12
-rw-r--r--test/mmap/Makefile3
-rw-r--r--test/pthread/Makefile7
-rw-r--r--test/pthread/Makefile.in7
-rw-r--r--test/pwd_grp/Makefile9
-rw-r--r--test/pwd_grp/Makefile.in8
-rw-r--r--test/regex/Makefile3
-rw-r--r--test/rpc/Makefile11
-rw-r--r--test/rpc/Makefile.in11
-rw-r--r--test/rpc/getrpcent_r.c1
-rw-r--r--test/setjmp/Makefile3
-rw-r--r--test/signal/Makefile7
-rw-r--r--test/signal/Makefile.in6
-rw-r--r--test/silly/Makefile6
-rw-r--r--test/silly/Makefile.in5
-rw-r--r--test/stat/Makefile11
-rw-r--r--test/stat/Makefile.in10
-rw-r--r--test/stdio/Makefile7
-rw-r--r--test/stdio/Makefile.in4
-rw-r--r--test/stdlib/Makefile8
-rw-r--r--test/stdlib/Makefile.in7
-rw-r--r--test/string/Makefile5
-rw-r--r--test/string/Makefile.in4
-rw-r--r--test/termios/Makefile3
-rw-r--r--test/time/Makefile12
-rw-r--r--test/time/Makefile.in11
-rw-r--r--test/unistd/Makefile12
-rw-r--r--test/unistd/Makefile.in11
54 files changed, 400 insertions, 217 deletions
diff --git a/libc/sysdeps/linux/bfin/sys/user.h b/libc/sysdeps/linux/bfin/sys/user.h
new file mode 100644
index 000000000..558abd6ad
--- /dev/null
+++ b/libc/sysdeps/linux/bfin/sys/user.h
@@ -0,0 +1,57 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+
+struct user_bfinfp_struct {
+};
+
+/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
+ is still the layout used by user (the new pt_regs doesn't have
+ all registers). */
+struct user_regs_struct {
+ long r0, r1, r2, r3, r4, r5, r6, r7;
+ long p0, p1, p2, p3, p4, p5, usp, fp;
+ long i0, i1, i2, i3;
+ long l0, l1, l2, l3;
+ long b0, b1, b2, b3;
+ long m0, m1, m2, m3;
+ long a0w, a1w;
+ long a0x, a1x;
+ unsigned long rets;
+ unsigned long astat;
+ unsigned long pc;
+ unsigned long orig_p0;
+};
+
+/* When the kernel dumps core, it starts by dumping the user struct -
+ this will be used by gdb to figure out where the data and stack segments
+ are within the file, and what virtual addresses to use. */
+
+struct user {
+/* We start with the registers, to mimic the way that "memory" is returned
+ from the ptrace(3,...) function. */
+
+ struct user_regs_struct regs; /* Where the registers are actually stored */
+
+/* The rest of this junk is to help gdb figure out what goes where */
+ unsigned long int u_tsize; /* Text segment size (pages). */
+ unsigned long int u_dsize; /* Data segment size (pages). */
+ unsigned long int u_ssize; /* Stack segment size (pages). */
+ unsigned long start_code; /* Starting virtual address of text. */
+ unsigned long start_stack; /* Starting virtual address of stack area.
+ This is actually the bottom of the stack,
+ the top of the stack is always found in the
+ esp register. */
+ long int signal; /* Signal that caused the core dump. */
+ int reserved; /* No longer used */
+ unsigned long u_ar0;
+ /* Used by gdb to help find the values for */
+ /* the registers. */
+ unsigned long magic; /* To uniquely identify a core file */
+ char u_comm[32]; /* User command that was responsible */
+};
+#define NBPG PAGE_SIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
+#endif
diff --git a/libc/sysdeps/linux/common/mprotect.c b/libc/sysdeps/linux/common/mprotect.c
index a0e7610fd..d60fc04d6 100644
--- a/libc/sysdeps/linux/common/mprotect.c
+++ b/libc/sysdeps/linux/common/mprotect.c
@@ -10,6 +10,6 @@
#include <sys/syscall.h>
#include <sys/mman.h>
-#if defined __ARCH_USE_MMU__ && defined __NR_mprotect
+#if defined __NR_mprotect
_syscall3(int, mprotect, void *, addr, size_t, len, int, prot)
#endif
diff --git a/test/Makefile b/test/Makefile
index f5f62ee76..857ac8ad9 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -35,7 +35,7 @@ endif
ifneq ($(UCLIBC_HAS_LOCALE),y)
DIRS := $(filter-out locale,$(DIRS))
endif
-ifeq ($(UCLIBC_HAS_CRYPT_STUB),y)
+ifneq ($(UCLIBC_HAS_CRYPT),y)
DIRS := $(filter-out crypt,$(DIRS))
endif
ifeq ($(HAS_NO_THREADS),y)
diff --git a/test/README b/test/README
index 31db8f410..fcb41489b 100644
--- a/test/README
+++ b/test/README
@@ -36,19 +36,23 @@ make check UCLIBC_ONLY=1
----------------
The structure of this test system is:
- test/ toplevel dir containing common test code
- test/Rules.mak Common build code
- test/Test.mak Runtime test make code
- test/subdir/ code specific to a subsystem is stored in a subdir
- test/subdir/Makefile describe the tests to run
- test/subdir/*.c the tests
+ test/ toplevel dir containing common test code
+ test/Rules.mak Common build code
+ test/Test.mak Runtime test make code
+ test/subdir/ code specific to a subsystem is stored in a subdir
+ test/subdir/Makefile.in describe the tests to run
+ test/subdir/Makefile test entry point, includes needed upper-level
+ makefiles plus Makefile.in
+ test/subdir/*.c the tests
-Each subdir Makefile must include the toplevel Test.mak file. Before doing so,
-you may define the TESTS and TESTS_DISABLED variables. If you do not, TESTS
+Each subdir has a Makefile (same for any subdir) that must include in strict order :
+ - the upper-level Rules.mak file.
+ - the Makefile.in .
+ - the upper-level Test.mak file.
+Makefile.in may be used to define the TESTS and TESTS_DISABLED variables. If you do not, TESTS
is built automatically based upon all the .c files in the subdir.
TESTS := foo
TESTS_DISABLED := bar
-include ../Test.mak
Each test must use a similar .c name; so the "foo" test needs a "foo.c".
Additionally, the following options further control specific test behavior:
diff --git a/test/Test.mak b/test/Test.mak
index c495f8141..c5918a729 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -18,9 +18,6 @@ ifneq ($(filter-out test,$(TESTS)),$(TESTS))
$(error Sanity check: cannot have a test named "test.c")
endif
-top_builddir = ../../
-include ../Rules.mak
-
U_TARGETS := $(TESTS)
G_TARGETS := $(patsubst %,%_glibc,$(U_TARGETS))
diff --git a/test/args/Makefile b/test/args/Makefile
index 7ba8a31b4..67ee452aa 100644
--- a/test/args/Makefile
+++ b/test/args/Makefile
@@ -1,11 +1,7 @@
# uClibc args tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-OPTS_arg_test = a b c d e f g h
-WRAPPER_arg_test = \
- env -i \
- ENVVAR=123 \
- SOMETHING=sldajfasdf \
- BLAHBLAH=" hi hi "
diff --git a/test/args/Makefile.in b/test/args/Makefile.in
new file mode 100644
index 000000000..f4edab454
--- /dev/null
+++ b/test/args/Makefile.in
@@ -0,0 +1,9 @@
+# uClibc args 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 = \
+ env -i \
+ ENVVAR=123 \
+ SOMETHING=sldajfasdf \
+ BLAHBLAH=" hi hi "
diff --git a/test/assert/Makefile b/test/assert/Makefile
index 1c557fc84..691325418 100644
--- a/test/assert/Makefile
+++ b/test/assert/Makefile
@@ -1,7 +1,7 @@
# uClibc assert tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-RET_assert := 134
-WRAPPER_assert := trap ":" ABRT ;
diff --git a/test/assert/Makefile.in b/test/assert/Makefile.in
new file mode 100644
index 000000000..8e3514f4c
--- /dev/null
+++ b/test/assert/Makefile.in
@@ -0,0 +1,5 @@
+# uClibc assert tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+RET_assert := 134
+WRAPPER_assert := trap ":" ABRT ;
diff --git a/test/build/Makefile b/test/build/Makefile
index eb65c2ad3..99a64d517 100644
--- a/test/build/Makefile
+++ b/test/build/Makefile
@@ -1,4 +1,7 @@
# uClibc build tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/crypt/Makefile b/test/crypt/Makefile
index 11d420d9e..44bbde03a 100644
--- a/test/crypt/Makefile
+++ b/test/crypt/Makefile
@@ -1,8 +1,7 @@
# uClibc crypt tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-EXTRA_LDFLAGS := -lcrypt
-
-OPTS_crypt = < crypt.input
diff --git a/test/crypt/Makefile.in b/test/crypt/Makefile.in
new file mode 100644
index 000000000..22c27e9e9
--- /dev/null
+++ b/test/crypt/Makefile.in
@@ -0,0 +1,6 @@
+# uClibc crypt tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+EXTRA_LDFLAGS := -lcrypt
+
+OPTS_crypt = < crypt.input
diff --git a/test/ctype/Makefile b/test/ctype/Makefile
index d2b7bc5de..fd72584cb 100644
--- a/test/ctype/Makefile
+++ b/test/ctype/Makefile
@@ -1,6 +1,7 @@
# uClibc ctype tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-TESTS := ctype
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/ctype/Makefile.in b/test/ctype/Makefile.in
new file mode 100644
index 000000000..ee10d592e
--- /dev/null
+++ b/test/ctype/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc ctype tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS := ctype
diff --git a/test/dlopen/Makefile b/test/dlopen/Makefile
index 55231b8e8..66a2452e2 100644
--- a/test/dlopen/Makefile
+++ b/test/dlopen/Makefile
@@ -1,45 +1,12 @@
# uClibc dlopen 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
-
-TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
ifeq ($(UCLIBC_STATIC),y)
TESTS_DISABLED := test3
LDFLAGS_libtest.so := -lpthread
endif
include ../Test.mak
-
-CFLAGS_dltest := -DLIBNAME="\"./libtest.so\""
-CFLAGS_dltest2 := -DLIBNAME="\"./libtest3.so\""
-
-LDFLAGS_dlstatic := -ldl
-LDFLAGS_dltest := -ldl -lpthread
-LDFLAGS_dltest2 := -ldl -lpthread
-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
-
-DEBUG_LIBS := X
-WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
-
-dltest: libtest.so
-dltest2: libtest3.so
-dlstatic: libstatic.so
-dlundef: libundef.so
-dlafk: libafk.so
-libafk.so: libafk-temp.so
-LDFLAGS_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_libtest1.so := ./libtest2.so -Wl,-rpath,.
-LDFLAGS_libtest2.so := -Wl,-rpath,.
-LDFLAGS_libtest3.so := -lpthread -Wl,-rpath,.
diff --git a/test/dlopen/Makefile.in b/test/dlopen/Makefile.in
new file mode 100644
index 000000000..69f493724
--- /dev/null
+++ b/test/dlopen/Makefile.in
@@ -0,0 +1,38 @@
+# uClibc dlopen 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
+
+TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr
+
+CFLAGS_dltest := -DLIBNAME="\"./libtest.so\""
+CFLAGS_dltest2 := -DLIBNAME="\"./libtest3.so\""
+
+LDFLAGS_dlstatic := -ldl
+LDFLAGS_dltest := -ldl -lpthread
+LDFLAGS_dltest2 := -ldl -lpthread
+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
+
+DEBUG_LIBS := X
+WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
+
+dltest: libtest.so
+dltest2: libtest3.so
+dlstatic: libstatic.so
+dlundef: libundef.so
+dlafk: libafk.so
+libafk.so: libafk-temp.so
+LDFLAGS_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_libtest1.so := ./libtest2.so -Wl,-rpath,.
+LDFLAGS_libtest2.so := -Wl,-rpath,.
+LDFLAGS_libtest3.so := -lpthread -Wl,-rpath,.
diff --git a/test/inet/Makefile b/test/inet/Makefile
index 91927e42e..9605dca66 100644
--- a/test/inet/Makefile
+++ b/test/inet/Makefile
@@ -1,4 +1,7 @@
# uClibc inet tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/locale-mbwc/Makefile b/test/locale-mbwc/Makefile
index 8f5a2dba8..771c3d117 100644
--- a/test/locale-mbwc/Makefile
+++ b/test/locale-mbwc/Makefile
@@ -1,29 +1,7 @@
# uClibc locale tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
-
-TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl \
- tst_iswctype tst_iswdigit tst_iswgraph \
- tst_iswlower tst_iswprint tst_iswpunct \
- tst_iswspace tst_iswupper tst_iswxdigit \
- tst_mblen tst_mbrlen tst_mbrtowc tst_mbsrtowcs \
- tst_mbstowcs tst_mbtowc tst_strcoll tst_strxfrm \
- tst_swscanf tst_towctrans tst_towlower \
- tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
- tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
- tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
- tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
- tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
- tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
- tst_wctype tst_wcwidth tst_strfmon
-
-
-# NOTE: For now disabled tst_strfmon to avoid build failure.
-TESTS_DISABLED := tst_strfmon
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-DODIFF_rint := 1
-
-EXTRA_CFLAGS := -D__USE_GNU -fno-builtin
-
diff --git a/test/locale-mbwc/Makefile.in b/test/locale-mbwc/Makefile.in
new file mode 100644
index 000000000..05c232a9b
--- /dev/null
+++ b/test/locale-mbwc/Makefile.in
@@ -0,0 +1,27 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
+
+TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl \
+ tst_iswctype tst_iswdigit tst_iswgraph \
+ tst_iswlower tst_iswprint tst_iswpunct \
+ tst_iswspace tst_iswupper tst_iswxdigit \
+ tst_mblen tst_mbrlen tst_mbrtowc tst_mbsrtowcs \
+ tst_mbstowcs tst_mbtowc tst_strcoll tst_strxfrm \
+ tst_swscanf tst_towctrans tst_towlower \
+ tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \
+ tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \
+ tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \
+ tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \
+ tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \
+ tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \
+ tst_wctype tst_wcwidth tst_strfmon
+
+
+# NOTE: For now disabled tst_strfmon to avoid build failure.
+TESTS_DISABLED := tst_strfmon
+
+DODIFF_rint := 1
+
+EXTRA_CFLAGS := -D__USE_GNU -fno-builtin
+
diff --git a/test/locale/Makefile b/test/locale/Makefile
index 7e408b8cf..771c3d117 100644
--- a/test/locale/Makefile
+++ b/test/locale/Makefile
@@ -1,31 +1,7 @@
# uClibc locale tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
-
-TESTS := bug-iconv-trans bug-usesetlocale 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
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-DODIFF_rint := 1
-
-EXTRA_CFLAGS := -D__USE_GNU -fno-builtin
-
-OPTS_dump-ctype = C
-OPTS_tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in
-OPTS_tst-langinfo = < tst-langinfo.input
-
-EXTRA_DIRS := C
diff --git a/test/locale/Makefile.in b/test/locale/Makefile.in
new file mode 100644
index 000000000..5a57ca54d
--- /dev/null
+++ b/test/locale/Makefile.in
@@ -0,0 +1,29 @@
+# uClibc locale tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \
+
+TESTS := bug-iconv-trans bug-usesetlocale 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
+
+OPTS_dump-ctype = C
+OPTS_tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in
+OPTS_tst-langinfo = < tst-langinfo.input
+
+EXTRA_DIRS := C
diff --git a/test/malloc/Makefile b/test/malloc/Makefile
index 3e92e6cdb..d76f07b1e 100644
--- a/test/malloc/Makefile
+++ b/test/malloc/Makefile
@@ -1,6 +1,7 @@
# uClibc malloc tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-TESTS_DISABLED := time_malloc
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/malloc/Makefile.in b/test/malloc/Makefile.in
new file mode 100644
index 000000000..7b8c0fabd
--- /dev/null
+++ b/test/malloc/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc malloc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS_DISABLED := time_malloc
diff --git a/test/math/Makefile b/test/math/Makefile
index 1c6faee29..135aedb2b 100644
--- a/test/math/Makefile
+++ b/test/math/Makefile
@@ -1,30 +1,7 @@
# uClibc math tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../../.config
-
-TESTS := basic-test rint tst-definitions test-fpucw test-float test-ifloat test-double test-idouble
-ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH)),y)
-TESTS += test-ldouble test-ildoubl compile_test
-else
-CFLAGS_basic-test := -DNO_LONG_DOUBLE
-endif
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-DODIFF_rint := 1
-
-# 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
-endif
-EXTRA_CFLAGS := -fno-builtin
-EXTRA_LDFLAGS := -lm
-
-PERL := /usr/bin/perl
-ulps-file := $(firstword $(wildcard $(config-sysdirs:%=$(..)%/libm-test-ulps)))
-libm-test.c: $(ulps-file) libm-test.inc gen-libm-test.pl
- $(Q)$(PERL) ./gen-libm-test.pl -u $< ./libm-test.inc -o "." 2>&1 > /dev/null
-EXTRA_CLEAN := libm-test.c libm-test-ulps.h
-$(TARGETS): libm-test.c
diff --git a/test/math/Makefile.in b/test/math/Makefile.in
new file mode 100644
index 000000000..b160c875d
--- /dev/null
+++ b/test/math/Makefile.in
@@ -0,0 +1,27 @@
+# uClibc math tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS := basic-test rint tst-definitions test-fpucw test-float test-ifloat test-double test-idouble
+ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),y)
+TESTS += test-ldouble test-ildoubl compile_test
+else
+CFLAGS_basic-test := -DNO_LONG_DOUBLE
+endif
+
+DODIFF_rint := 1
+
+# 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
+endif
+EXTRA_CFLAGS := -fno-builtin
+EXTRA_LDFLAGS := -lm
+
+PERL := /usr/bin/perl
+ulps-file := $(firstword $(wildcard $(config-sysdirs:%=$(..)%/libm-test-ulps)))
+libm-test.c: $(ulps-file) libm-test.inc gen-libm-test.pl
+ $(Q)$(PERL) ./gen-libm-test.pl -u $< ./libm-test.inc -o "." 2>&1 > /dev/null
+EXTRA_CLEAN := libm-test.c libm-test-ulps.h
+TARGETS=libm-test.c
+
diff --git a/test/misc/Makefile b/test/misc/Makefile
index 48c549e73..52f6c679b 100644
--- a/test/misc/Makefile
+++ b/test/misc/Makefile
@@ -1,14 +1,7 @@
# uClibc misc tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-
-DODIFF_dirent := 1
-DODIFF_dirent64 := 1
-
-OPTS_bug-glob1 := $(PWD)
-OPTS_tst-fnmatch := < tst-fnmatch.input
diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in
new file mode 100644
index 000000000..43d1ae77f
--- /dev/null
+++ b/test/misc/Makefile.in
@@ -0,0 +1,12 @@
+# uClibc misc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob
+
+CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+
+DODIFF_dirent := 1
+DODIFF_dirent64 := 1
+
+OPTS_bug-glob1 := $(PWD)
+OPTS_tst-fnmatch := < tst-fnmatch.input
diff --git a/test/mmap/Makefile b/test/mmap/Makefile
index b4c301014..64b652de6 100644
--- a/test/mmap/Makefile
+++ b/test/mmap/Makefile
@@ -1,4 +1,7 @@
# uClibc mmap tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/pthread/Makefile b/test/pthread/Makefile
index 622cbe0fa..5f2033d42 100644
--- a/test/pthread/Makefile
+++ b/test/pthread/Makefile
@@ -2,8 +2,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
TESTS_DISABLED += cancellation-points
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-EXTRA_LDFLAGS := -lpthread
-
-LDFLAGS_cancellation-points := -lrt
diff --git a/test/pthread/Makefile.in b/test/pthread/Makefile.in
new file mode 100644
index 000000000..d3412f6b8
--- /dev/null
+++ b/test/pthread/Makefile.in
@@ -0,0 +1,7 @@
+# uClibc pthread tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+
+EXTRA_LDFLAGS := -lpthread
+
+LDFLAGS_cancellation-points := -lrt
diff --git a/test/pwd_grp/Makefile b/test/pwd_grp/Makefile
index e6362d352..21070f4cb 100644
--- a/test/pwd_grp/Makefile
+++ b/test/pwd_grp/Makefile
@@ -1,10 +1,7 @@
# uClibc pwd_grp tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-DODIFF_test_pwd := 1
-DODIFF_test_grp := 1
-DODIFF_pwcat := 1
-DODIFF_grcat := 1
-DODIFF_getgroups := 1
diff --git a/test/pwd_grp/Makefile.in b/test/pwd_grp/Makefile.in
new file mode 100644
index 000000000..d561f3dcc
--- /dev/null
+++ b/test/pwd_grp/Makefile.in
@@ -0,0 +1,8 @@
+# uClibc pwd_grp 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
diff --git a/test/regex/Makefile b/test/regex/Makefile
index afafc680f..639122211 100644
--- a/test/regex/Makefile
+++ b/test/regex/Makefile
@@ -1,4 +1,7 @@
# uClibc regex tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/rpc/Makefile b/test/rpc/Makefile
index 8ea934800..47accc62e 100644
--- a/test/rpc/Makefile
+++ b/test/rpc/Makefile
@@ -1,12 +1,7 @@
# uClibc rpc 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
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-DODIFF_getrpcent := 1
diff --git a/test/rpc/Makefile.in b/test/rpc/Makefile.in
new file mode 100644
index 000000000..5612ff202
--- /dev/null
+++ b/test/rpc/Makefile.in
@@ -0,0 +1,11 @@
+# uClibc rpc 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
+
diff --git a/test/rpc/getrpcent_r.c b/test/rpc/getrpcent_r.c
index 708deba10..65ca61cd9 100644
--- a/test/rpc/getrpcent_r.c
+++ b/test/rpc/getrpcent_r.c
@@ -1,6 +1,7 @@
#include <netdb.h>
#include <stdio.h>
#include <errno.h>
+#include <string.h>
int main(int argc, char *argv[])
{
diff --git a/test/setjmp/Makefile b/test/setjmp/Makefile
index 581ab3213..a26e2d571 100644
--- a/test/setjmp/Makefile
+++ b/test/setjmp/Makefile
@@ -1,4 +1,7 @@
# uClibc setjmp tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/signal/Makefile b/test/signal/Makefile
index 2ff96fa73..e8293658d 100644
--- a/test/signal/Makefile
+++ b/test/signal/Makefile
@@ -1,8 +1,7 @@
# uClibc signal 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
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/signal/Makefile.in b/test/signal/Makefile.in
new file mode 100644
index 000000000..c8e2545fa
--- /dev/null
+++ b/test/signal/Makefile.in
@@ -0,0 +1,6 @@
+# uClibc signal 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
diff --git a/test/silly/Makefile b/test/silly/Makefile
index ccd701852..4db1850d8 100644
--- a/test/silly/Makefile
+++ b/test/silly/Makefile
@@ -1,7 +1,7 @@
# uClibc silly tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-RET_hello := 42
-RET_tiny := 42
diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in
new file mode 100644
index 000000000..bb08e0db9
--- /dev/null
+++ b/test/silly/Makefile.in
@@ -0,0 +1,5 @@
+# uClibc silly tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+RET_hello := 42
+RET_tiny := 42
diff --git a/test/stat/Makefile b/test/stat/Makefile
index 008a81248..ecde416d1 100644
--- a/test/stat/Makefile
+++ b/test/stat/Makefile
@@ -1,12 +1,7 @@
# uClibc stat tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-
-DODIFF_stat := 1
-DODIFF_stat64 := 1
-
-OPTS_stat := Makefile
-OPTS_stat64 := Makefile
diff --git a/test/stat/Makefile.in b/test/stat/Makefile.in
new file mode 100644
index 000000000..ca5aa04a2
--- /dev/null
+++ b/test/stat/Makefile.in
@@ -0,0 +1,10 @@
+# uClibc stat tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+
+DODIFF_stat := 1
+DODIFF_stat64 := 1
+
+OPTS_stat := Makefile
+OPTS_stat64 := Makefile
diff --git a/test/stdio/Makefile b/test/stdio/Makefile
index d3ae2f368..a5d662a7c 100644
--- a/test/stdio/Makefile
+++ b/test/stdio/Makefile
@@ -1,6 +1,7 @@
-# uClibc assert tests
+# uClibc stdio tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-DODIFF_64bit := 1
diff --git a/test/stdio/Makefile.in b/test/stdio/Makefile.in
new file mode 100644
index 000000000..0bfbd1362
--- /dev/null
+++ b/test/stdio/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc stdio tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+DODIFF_64bit := 1
diff --git a/test/stdlib/Makefile b/test/stdlib/Makefile
index efec56d70..f8a40384b 100644
--- a/test/stdlib/Makefile
+++ b/test/stdlib/Makefile
@@ -1,9 +1,7 @@
# uClibc stdlib tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-DODIFF_qsort := 1
-DODIFF_testatexit := 1
-DODIFF_teston_exit := 1
-DODIFF_teststrtol := 1
diff --git a/test/stdlib/Makefile.in b/test/stdlib/Makefile.in
new file mode 100644
index 000000000..0bb06975e
--- /dev/null
+++ b/test/stdlib/Makefile.in
@@ -0,0 +1,7 @@
+# uClibc stdlib 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
diff --git a/test/string/Makefile b/test/string/Makefile
index a18d52e93..62c82695a 100644
--- a/test/string/Makefile
+++ b/test/string/Makefile
@@ -1,6 +1,7 @@
# uClibc string tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-EXTRA_CFLAGS := -fno-builtin
diff --git a/test/string/Makefile.in b/test/string/Makefile.in
new file mode 100644
index 000000000..ad52a9f2c
--- /dev/null
+++ b/test/string/Makefile.in
@@ -0,0 +1,4 @@
+# uClibc string tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+EXTRA_CFLAGS := -fno-builtin
diff --git a/test/termios/Makefile b/test/termios/Makefile
index 2aa6ccd90..926e05219 100644
--- a/test/termios/Makefile
+++ b/test/termios/Makefile
@@ -1,4 +1,7 @@
# uClibc termios tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
diff --git a/test/time/Makefile b/test/time/Makefile
index 8c6978f0d..103acb885 100644
--- a/test/time/Makefile
+++ b/test/time/Makefile
@@ -1,13 +1,7 @@
# uClibc time 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
-
-ifneq ($(UCLIBC_HAS_XLOCALE),y)
-TESTS_DISABLED += tst-ftime_l
-endif
-
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-CFLAGS_tst-strptime2 := -std=c99
diff --git a/test/time/Makefile.in b/test/time/Makefile.in
new file mode 100644
index 000000000..65d814a71
--- /dev/null
+++ b/test/time/Makefile.in
@@ -0,0 +1,11 @@
+# uClibc time 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
+
+ifneq ($(UCLIBC_HAS_XLOCALE),y)
+TESTS_DISABLED += tst-ftime_l
+endif
+
+CFLAGS_tst-strptime2 := -std=c99
diff --git a/test/unistd/Makefile b/test/unistd/Makefile
index c5007cdcc..0dbd52e94 100644
--- a/test/unistd/Makefile
+++ b/test/unistd/Makefile
@@ -1,13 +1,7 @@
# uClibc unistd tests
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+top_builddir=../../
+include ../Rules.mak
+-include Makefile.in
include ../Test.mak
-
-OPTS_getopt := -abcXXX -9
-OPTS_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
-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
-endif
diff --git a/test/unistd/Makefile.in b/test/unistd/Makefile.in
new file mode 100644
index 000000000..ecc4219bb
--- /dev/null
+++ b/test/unistd/Makefile.in
@@ -0,0 +1,11 @@
+# uClibc unistd tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+OPTS_getopt := -abcXXX -9
+OPTS_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
+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
+endif