diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-28 18:43:57 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-28 18:43:57 +0200 |
commit | e65912f8b2a6fa966b1ba45360070cf9f25568b4 (patch) | |
tree | 7fd84c87041f86ba24c03cacd0aa0c656ef88d33 | |
parent | 7988979a722b4cdf287b2093956a76a3f19b9897 (diff) |
rework most tests to work as standalone package
77 files changed, 116 insertions, 797 deletions
diff --git a/test/Makefile b/test/Makefile index 532a43a..3044d7b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,9 +1,5 @@ -# Makefile for uClibc -# -# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> -# +# Makefile for uClibc-ng-test # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# top_srcdir=../ top_builddir=../ @@ -12,41 +8,9 @@ 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)$(ARCH_USE_MMU),yy) - DIRS := $(filter-out pthread,$(DIRS)) -endif -ifneq ($(UCLIBC_HAS_FLOATS),y) - DIRS := $(filter-out math,$(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 ($(HAVE_SHARED)$(UCLIBC_HAS_THREADS_NATIVE),yy) - 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_IMPL),y) - DIRS := $(filter-out crypt,$(DIRS)) -endif -ifeq ($(HAS_NO_THREADS),y) - DIRS := $(filter-out pthread,$(DIRS)) -endif -ifneq ($(UCLIBC_HAS_ARGP),y) - DIRS := $(filter-out argp,$(DIRS)) + +ifeq ($(NO_LOCALE),1) +DIRS := $(filter-out locale,$(DIRS)) endif test check all: run @@ -57,13 +21,7 @@ gen: -rm -f $(top_builddir)/test/uclibcng-testrunner.in $(MAKE) run UCLIBCNG_GENERATE_TESTRUNNER=1 -compile: $(top_builddir)$(LOCAL_INSTALL_PATH) subdirs_compile - -$(top_builddir)$(LOCAL_INSTALL_PATH): - $(Q)$(MAKE) -C $(top_builddir) $(LOCAL_INSTALL_PATH) - -tags: - ctags -R +compile: subdirs_compile clean: subdirs_clean @@ -78,12 +36,10 @@ $(patsubst %, _dir_%, $(DIRS)) : dummy $(patsubst %, _dirrun_%, $(DIRS)) : dummy $(Q)$(MAKE) -C $(patsubst _dirrun_%, %, $@) run \ - UCLIBCNG_TEST_SUBDIR=$(strip $(patsubst _dirrun_%, %, $@)) \ - KCONFIG_CONFIG=$(KCONFIG_CONFIG) + UCLIBCNG_TEST_SUBDIR=$(strip $(patsubst _dirrun_%, %, $@)) $(patsubst %, _dircompile_%, $(DIRS)) : dummy - $(Q)$(MAKE) -C $(patsubst _dircompile_%, %, $@) compile \ - KCONFIG_CONFIG=$(KCONFIG_CONFIG) + $(Q)$(MAKE) -C $(patsubst _dircompile_%, %, $@) compile $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy $(Q)$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean diff --git a/test/README b/test/README deleted file mode 100644 index 723ce6e..0000000 --- a/test/README +++ /dev/null @@ -1,87 +0,0 @@ ------------ - For: User ------------ -Following make targets are avaialable - -make compile - -This will compile and link the tests. - -make run - -This will execute all the tests. - -make check -make all - -This will build and run tests. - -The following make variables may help you in testing: - - - UCLIBC_ONLY - only run tests against uClibc - - GLIBC_ONLY - only run tests against glibc - - V / VERBOSE - run tests with a lot of output - - TEST_INSTALLED_UCLIBC - Test installed libraries - under /lib and /usr/lib. - - TIMEOUTFACTOR=nn - increase test timeout nn times. - At least REGEX_OLD + regex/tst-regex2 needs it increased. - -So, to just run the uClibc tests, try this: -make check UCLIBC_ONLY=1 - -You can pass the following 2 environment variables to "make run": - - make run SIMULATOR_uclibc=qemu-sh4 SIMULATOR_glibc=qemu-x86_64 - -If you need to test just a subset of all test, delete subdirectories -you do not need. - -As of 2009-07, build machinery does not track dependencies on uclibc. -If you edit a header and re-run "make compile", it does not re-install it -into ../install_dir. If you delete ../install_dir, "make compile" -rebuilds uclibc as needed and re-installs ../install_dir, -but still does not rebuild testcases. -(You can work around it by "touch */*.c" for now). - ----------------- - For: Developer ----------------- - -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.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 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 -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: -CFLAGS_foo := extra cflags to use to compile test -DODIFF_foo := compare the output of the glibc and uClibc tests (see below) -LDFLAGS_foo := extra ldflags to use to link test -OPTS_foo := extra options to pass to test -RET_foo := expected exit code of test; default is 0 -WRAPPER_foo := execute stuff just before test - -Or to control all tests in a subdir: -EXTRA_CLEAN := extra files to remove in the clean target -EXTRA_DIRS := extra directories to remove in the clean target -EXTRA_CFLAGS := -DFOO -EXTRA_LDFLAGS := -lpthread -OPTS := -WRAPPER := - -If you want to compare the output of a test with known good output, then just -create a local file named "foo.out.good" and the output generated by the test -"foo" will be automatically stored in "foo.out" and compared to "foo.out.good". diff --git a/test/Rules.mak b/test/Rules.mak index 9416a0c..b9dabbd 100644 --- a/test/Rules.mak +++ b/test/Rules.mak @@ -1,9 +1,5 @@ -# Rules.mak for uClibc test subdirs -# -# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> -# +# Rules.mak for uClibc-ng-test subdirs # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# .SUFFIXES: @@ -13,30 +9,7 @@ abs_top_builddir ?= $(shell cd $(top_builddir); pwd)/ TESTDIR=$(top_builddir)test/ include $(top_srcdir)Rules.mak -ifeq ($(filter $(clean_targets) CLEAN_%,$(MAKECMDGOALS)),) -ifeq ($(HAVE_DOT_CONFIG),) -$(error no HAVE_DOT_CONFIG, failed to read .config) -endif -endif -ifdef UCLIBC_LDSO -ifeq (,$(findstring /,$(UCLIBC_LDSO))) -UCLIBC_LDSO := $(UCLIBC_LDSO) -else -UCLIBC_LDSO := $(notdir $(UCLIBC_LDSO)) -endif -else -UCLIBC_LDSO := $(notdir $(firstword $(wildcard $(top_builddir)lib/ld*))) -endif -ifndef TEST_INSTALLED_UCLIBC -ifeq ($(LDSO_SAFE_RUNPATH),y) -UCLIBC_PATH := $(abs_top_builddir)lib -else -UCLIBC_PATH := $(top_builddir)lib -endif -else -UCLIBC_PATH := $(RUNTIME_PREFIX)$(MULTILIB_DIR) -endif #-------------------------------------------------------- # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. LC_ALL:= C @@ -61,20 +34,10 @@ 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 ?= +CFLAGS += $(XCOMMON_CFLAGS) CFLAGS += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS) $(eval $(call check-gcc-var,-Wno-missing-field-initializers)) @@ -84,37 +47,8 @@ CFLAGS += $(CFLAG_-Wno-missing-field-initializers) # 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 -endif - -ifeq ($(DOSTRIP),y) - LDFLAGS += -Wl,-s - HOST_LDFLAGS += -Wl,-s -endif - -ifneq ($(HAVE_SHARED),y) - LDFLAGS += -Wl,-static -static-libgcc -endif - -ifndef TEST_INSTALLED_UCLIBC -LDFLAGS += -B$(UCLIBC_PATH) -Wl,-rpath,$(UCLIBC_PATH):$(shell pwd) -Wl,-rpath-link,$(UCLIBC_PATH):$(shell pwd) -else -LDFLAGS += -Wl,-rpath,$(shell pwd) -endif - -ifeq ($(findstring -static,$(LDFLAGS)),) -LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_PATH)/$(UCLIBC_LDSO) -endif - -ifeq ($(LDSO_GNU_HASH_SUPPORT),y) -# Check for binutils support is done on root Rules.mak -LDFLAGS += $(CFLAG_-Wl--hash-style=gnu) -endif +#LDFLAGS := $(CPU_LDFLAGS-y) -Wl,-z,now +#LDFLAGS += -Wl,-rpath,$(shell pwd) ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"") CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS)) diff --git a/test/Test.mak b/test/Test.mak index c9b1f5a..14ccb7f 100644 --- a/test/Test.mak +++ b/test/Test.mak @@ -1,7 +1,4 @@ # Common makefile rules for tests -# -# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> -# # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. shellescape='$(subst ','\'',$(1))' @@ -20,29 +17,16 @@ 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)) +TARGETS := $(TESTS) -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) +CLEAN_TARGETS := $(TARGETS) +CLEAN_TARGETS += $(TESTS_DISABLED) COMPILE_TARGETS := $(TARGETS) # We sort the targets so uClibc and host-libc tests are run adjacent RUN_TARGETS := $(sort $(addsuffix .exe,$(TARGETS))) COMPILE_TARGETS := $(sort $(COMPILE_TARGETS)) # provide build rules even for disabled tests: -U_TARGETS += $(TESTS_DISABLED) -G_TARGETS += $(addsuffix _glibc,$(TESTS_DISABLED)) $(GLIBC_TESTS_DISABLED) +TARGETS += $(TESTS_DISABLED) TARGETS += $(SHELL_TESTS) CFLAGS += $(CFLAGS_$(notdir $(CURDIR))) ifeq (1,$(UCLIBCNG_GENERATE_TESTRUNNER)) @@ -91,8 +75,7 @@ endef test check all: run run: $(RUN_TARGETS) -$(addsuffix .exe,$(U_TARGETS)): SIMULATOR:=$(SIMULATOR_uclibc) -$(addsuffix .exe,$(G_TARGETS)): SIMULATOR:=$(SIMULATOR_glibc) +$(addsuffix .exe,$(TARGETS)): SIMULATOR:=$(SIMULATOR) $(RUN_TARGETS): ifeq (1,$(UCLIBCNG_GENERATE_TESTRUNNER)) $(Q)\ @@ -106,32 +89,19 @@ ifeq (1,$(UCLIBCNG_GENERATE_TESTRUNNER)) else $(exec_test) $(diff_test) -ifeq ($(UCLIBC_ONLY),) - $(uclibc_glibc_diff_test) -endif endif compile: $(COMPILE_TARGETS) -G_TARGET_SRCS := $(addsuffix .c,$(G_TARGETS)) -U_TARGET_SRCS := $(addsuffix .c,$(U_TARGETS)) +TARGET_SRCS := $(addsuffix .c,$(TARGETS)) MAKE_SRCS := $(wildcard Makefile.in) $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak -$(U_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS) +$(TARGETS): $(TARGET_SRCS) $(MAKE_SRCS) $(showlink) $(Q)$(CC) $(filter-out $(CFLAGS-OMIT-$@),$(CFLAGS)) $(EXTRA_CFLAGS) $(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$@) -c $@.c -o $@.o $(Q)$(CC) $(filter-out $(LDFLAGS-OMIT-$@),$(LDFLAGS)) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@) -$(G_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS) - $(showlink) - $(Q)$(HOSTCC) $(filter-out $(HOST_CFLAGS-OMIT-$(patsubst %_glibc,%,$@)),$(HOST_CFLAGS)) \ - $(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$(patsubst %_glibc,%,$@)) \ - -c $(patsubst %_glibc,%,$@).c -o $@.o - $(Q)$(HOSTCC) $(filter-out $(LDFLAGS-OMIT-$(patsubst %_glibc,%,$@)),$(HOST_LDFLAGS)) \ - $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@)) $(LDFLAGS_$@) - - shell_%: $(showtest) $(Q)$(if $(PRE_RUN_$(@)),$(PRE_RUN_$(@))) diff --git a/test/argp/Makefile.in b/test/argp/Makefile.in index c472964..e490076 100644 --- a/test/argp/Makefile.in +++ b/test/argp/Makefile.in @@ -1,4 +1,4 @@ -# uClibc argp tests +# uClibc-ng argp tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. TESTS := $(addprefix argp-, ex1 ex2 ex3 ex4 test) \ diff --git a/test/args/Makefile.in b/test/args/Makefile.in index f4edab4..cc5a56c 100644 --- a/test/args/Makefile.in +++ b/test/args/Makefile.in @@ -1,4 +1,4 @@ -# uClibc args tests +# uClibc-ng 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 diff --git a/test/assert/Makefile.in b/test/assert/Makefile.in index 8e3514f..c0d5687 100644 --- a/test/assert/Makefile.in +++ b/test/assert/Makefile.in @@ -1,4 +1,4 @@ -# uClibc assert tests +# uClibc-ng assert tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. RET_assert := 134 diff --git a/test/crypt/Makefile.in b/test/crypt/Makefile.in index f852219..28aeb54 100644 --- a/test/crypt/Makefile.in +++ b/test/crypt/Makefile.in @@ -1,15 +1,8 @@ -# uClibc crypt tests +# uClibc-ng crypt tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. EXTRA_LDFLAGS := -lcrypt OPTS_crypt = < crypt.input -ifneq ($(UCLIBC_HAS_SHA512_CRYPT_IMPL),y) -TESTS_DISABLED += sha512c-test -endif -ifneq ($(UCLIBC_HAS_SHA256_CRYPT_IMPL),y) -TESTS_DISABLED += sha256c-test -endif - WRAPPER := env TIMEOUTFACTOR=50 diff --git a/test/crypt/sha256c-test.c b/test/crypt/sha256c-test.c index 357f0d8..5334cc8 100644 --- a/test/crypt/sha256c-test.c +++ b/test/crypt/sha256c-test.c @@ -40,6 +40,8 @@ static int do_test (void) { int result = 0; + +#if __UCLIBC_HAS_SHA256_CRYPT_IMPL__ int i; for (i = 0; i < ntests; ++i) @@ -53,6 +55,7 @@ do_test (void) result = 1; } } +#endif return result; } diff --git a/test/crypt/sha512c-test.c b/test/crypt/sha512c-test.c index c829242..be55b59 100644 --- a/test/crypt/sha512c-test.c +++ b/test/crypt/sha512c-test.c @@ -41,6 +41,8 @@ static int do_test (void) { int result = 0; + +#if __UCLIBC_HAS_SHA512_CRYPT_IMPL__ int i; for (i = 0; i < ntests; ++i) @@ -54,6 +56,7 @@ do_test (void) result = 1; } } +#endif return result; } diff --git a/test/ctype/Makefile.in b/test/ctype/Makefile.in index ee10d59..e5e26b8 100644 --- a/test/ctype/Makefile.in +++ b/test/ctype/Makefile.in @@ -1,4 +1,4 @@ -# uClibc ctype tests +# uClibc-ng ctype tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. TESTS := ctype |