summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/README1
-rw-r--r--test/Rules.mak1
-rw-r--r--test/Test.mak3
-rw-r--r--test/misc/bug-readdir1.c1
-rw-r--r--test/misc/tst-scandir.c23
-rw-r--r--test/string/tester.c1
6 files changed, 28 insertions, 2 deletions
diff --git a/test/README b/test/README
index b59945c54..2bc92ab4b 100644
--- a/test/README
+++ b/test/README
@@ -57,6 +57,7 @@ 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 :=
diff --git a/test/Rules.mak b/test/Rules.mak
index 10fbe869f..105140edc 100644
--- a/test/Rules.mak
+++ b/test/Rules.mak
@@ -58,6 +58,7 @@ export TARGET_ARCH
CROSS = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
CC = $(CROSS)gcc
RM = rm -f
+RM_R = $(RM) -r
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
diff --git a/test/Test.mak b/test/Test.mak
index 1e1cfdc94..c495f8141 100644
--- a/test/Test.mak
+++ b/test/Test.mak
@@ -59,7 +59,7 @@ define exec_test
$(showtest)
$(Q)\
$(WRAPPER) $(WRAPPER_$(patsubst %_glibc,%,$(binary_name))) \
- ./$(binary_name) $(OPTS) $(OPTS_$(patsubst %_glibc,%,$(binary_name))) >/dev/null 2>&1 > "$(binary_name).out" ; \
+ ./$(binary_name) $(OPTS) $(OPTS_$(patsubst %_glibc,%,$(binary_name))) > "$(binary_name).out" 2>&1 ; \
ret=$$? ; \
expected_ret="$(RET_$(patsubst %_glibc,%,$(binary_name)))" ; \
test -z "$$expected_ret" && export expected_ret=0 ; \
@@ -111,5 +111,6 @@ shell_%:
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/misc/bug-readdir1.c b/test/misc/bug-readdir1.c
index 4c3521dbb..a8594a82e 100644
--- a/test/misc/bug-readdir1.c
+++ b/test/misc/bug-readdir1.c
@@ -1,6 +1,5 @@
#include <dirent.h>
#include <errno.h>
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/test/misc/tst-scandir.c b/test/misc/tst-scandir.c
new file mode 100644
index 000000000..df62a40d4
--- /dev/null
+++ b/test/misc/tst-scandir.c
@@ -0,0 +1,23 @@
+#include <dirent.h>
+#include <errno.h>
+#include <stdio.h> /* perror() */
+#include <stdlib.h>
+
+int skip_all(const struct dirent *dirbuf)
+{
+ errno = EBADF;
+ return 0;
+}
+
+int main(void)
+{
+ struct dirent **namelist;
+ int n;
+
+ n = scandir(".", &namelist, skip_all, 0);
+ if (n < 0) {
+ perror("scandir");
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
+}
diff --git a/test/string/tester.c b/test/string/tester.c
index ac1b90118..7c8d314dc 100644
--- a/test/string/tester.c
+++ b/test/string/tester.c
@@ -427,6 +427,7 @@ test_strncmp (void)
check (strncmp ("abc", "def", 0) == 0, 13); /* Zero count. */
check (strncmp ("abc", "", (size_t)-1) > 0, 14); /* set sign bit in count */
check (strncmp ("abc", "abc", (size_t)-2) == 0, 15);
+ check (strncmp ("aa", "ab", (size_t)-1) < 0, 16);
}
static void