about summary refs log tree commit diff
path: root/stdio-common/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common/Makefile')
-rw-r--r--stdio-common/Makefile129
1 files changed, 128 insertions, 1 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 948d960ccc..e76e40e587 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -22,6 +22,34 @@ subdir	:= stdio-common
 
 include ../Makeconfig
 
+# List of markers for printf family function tests.
+xprintf-funcs := p as d f s sn v vas vd vf vs vsn
+
+# List of data types and formats for individual per-conversion printf tests.
+fmt-convs := double ldouble
+fmts := E e F f G g
+
+# List of data types grouping all conversions in single printf tests.
+nonfmt-convs := c char int llong long s short
+nonfmt-convs += uchar uint ullong ulong ushort
+
+convs := $(sort $(fmt-convs) $(nonfmt-convs))
+
+xprintf-srcs := \
+  $(foreach p,$(xprintf-funcs), \
+	    $(foreach c,$(convs),tst-printf-format-$(p)-$(c)))
+
+fmt-xprintf-stems := \
+  $(foreach f,$(fmts), \
+	    $(foreach p,$(xprintf-funcs), \
+		      $(foreach c,$(fmt-convs), \
+				tst-printf-format-$(p)-$(c)-$(f))))
+nonfmt-xprintf-stems := \
+  $(foreach p,$(xprintf-funcs), \
+	    $(foreach c,$(nonfmt-convs),tst-printf-format-$(p)-$(c)))
+
+xprintf-stems := $(sort $(fmt-xprintf-stems) $(nonfmt-xprintf-stems))
+
 headers := \
   bits/printf-ldbl.h \
   bits/stdio_lim.h \
@@ -207,8 +235,10 @@ tests := \
   tst-cookie \
   tst-dprintf-length \
   tst-fdopen \
+  tst-fdopen2 \
   tst-ferror \
   tst-fgets \
+  tst-fgets2 \
   tst-fileno \
   tst-fmemopen \
   tst-fmemopen2 \
@@ -216,8 +246,23 @@ tests := \
   tst-fmemopen4 \
   tst-fphex \
   tst-fphex-wide \
+  tst-fread \
+  tst-freopen2 \
+  tst-freopen3 \
+  tst-freopen4 \
+  tst-freopen5 \
+  tst-freopen6 \
+  tst-freopen64-2 \
+  tst-freopen64-3 \
+  tst-freopen64-4 \
+  tst-freopen64-6 \
+  tst-freopen64-7 \
+  tst-freopen7 \
   tst-fseek \
   tst-fwrite \
+  tst-fwrite-memstrm \
+  tst-fwrite-overflow \
+  tst-fwrite-ro \
   tst-getline \
   tst-getline-enomem \
   tst-gets \
@@ -244,6 +289,7 @@ tests := \
   tst-scanf-binary-gnu89 \
   tst-scanf-bz27650 \
   tst-scanf-intn \
+  tst-scanf-nan \
   tst-scanf-round \
   tst-scanf-to_inpunct \
   tst-setvbuf1 \
@@ -299,6 +345,7 @@ tests-internal = \
   # tests-internal
 
 test-srcs = \
+  $(xprintf-srcs) \
   tst-printf \
   tst-printfsz-islongdouble \
   tst-unbputc \
@@ -306,6 +353,7 @@ test-srcs = \
 
 ifeq ($(run-built-tests),yes)
 tests-special += \
+  $(foreach f,$(xprintf-stems),$(objpfx)$(f).out) \
   $(objpfx)tst-printf.out \
   $(objpfx)tst-printfsz-islongdouble.out \
   $(objpfx)tst-setvbuf1-cmp.out \
@@ -315,6 +363,16 @@ tests-special += \
 ifeq (yes,$(build-shared))
 ifneq ($(PERL),no)
 tests-special += \
+  $(foreach f,$(xprintf-stems),$(objpfx)$(f)-mem.out) \
+  $(objpfx)tst-freopen2-mem.out \
+  $(objpfx)tst-freopen3-mem.out \
+  $(objpfx)tst-freopen4-mem.out \
+  $(objpfx)tst-freopen5-mem.out \
+  $(objpfx)tst-freopen6-mem.out \
+  $(objpfx)tst-freopen64-2-mem.out \
+  $(objpfx)tst-freopen64-3-mem.out \
+  $(objpfx)tst-freopen64-4-mem.out \
+  $(objpfx)tst-freopen64-6-mem.out \
   $(objpfx)tst-getline-enomem-mem.out \
   $(objpfx)tst-getline-mem.out \
   $(objpfx)tst-printf-bz18872-mem.out \
@@ -326,6 +384,26 @@ tests-special += \
   # tests-special
 
 generated += \
+  $(foreach f,$(xprintf-stems),$(f)-mem.out) \
+  $(foreach f,$(xprintf-stems),$(f).mtrace) \
+  tst-freopen2-mem.out \
+  tst-freopen2.mtrace \
+  tst-freopen3-mem.out \
+  tst-freopen3.mtrace \
+  tst-freopen4-mem.out \
+  tst-freopen4.mtrace \
+  tst-freopen5-mem.out \
+  tst-freopen5.mtrace \
+  tst-freopen6-mem.out \
+  tst-freopen6.mtrace \
+  tst-freopen64-2-mem.out \
+  tst-freopen64-2.mtrace \
+  tst-freopen64-3-mem.out \
+  tst-freopen64-3.mtrace \
+  tst-freopen64-4-mem.out \
+  tst-freopen64-4.mtrace \
+  tst-freopen64-6-mem.out \
+  tst-freopen64-6.mtrace \
   tst-getline-enomem-mem.out \
   tst-getline-enomem.mtrace \
   tst-getline-mem.out \
@@ -445,6 +523,33 @@ tst-getline-ENV = \
 tst-getline-enomem-ENV = \
   MALLOC_TRACE=$(objpfx)tst-getline-enomem.mtrace \
   LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen2-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen2.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen64-2-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen64-2.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen3-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen3.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen64-3-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen64-3.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen4-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen4.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen64-4-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen64-4.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen5-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen5.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen6-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen6.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
+tst-freopen64-6-ENV = \
+  MALLOC_TRACE=$(objpfx)tst-freopen64-6.mtrace \
+  LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so
 
 $(objpfx)tst-unbputc.out: tst-unbputc.sh $(objpfx)tst-unbputc
 	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
@@ -454,6 +559,21 @@ $(objpfx)tst-printf.out: tst-printf.sh $(objpfx)tst-printf
 	$(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
 	$(evaluate-test)
 
+# We can't split a quoted recipe line, so do it via an auxiliary variable.
+make-tst-printf-format-out = \
+  AWK='$(AWK)' BASH='$(BASH)' \
+    $(BASH) $< $@ $(common-objpfx) \
+    '$(run-program-prefix-before-env) \
+     $(run-program-env) \
+     MALLOC_TRACE=$(@:.out=.mtrace) \
+     LD_PRELOAD=$(common-objpfx)malloc/libc_malloc_debug.so \
+     $(run-program-prefix-after-env)'
+$(objpfx)tst-printf-format-%.out: \
+  tst-printf-format.sh $(foreach c,$(convs),tst-printf-format-$(c).sh) \
+  $(foreach f,$(xprintf-srcs),$(objpfx)$(f)) tst-printf-format.awk
+	$(make-tst-printf-format-out) > $@; \
+	$(evaluate-test)
+
 $(objpfx)tst-printfsz-islongdouble.out: \
   tst-printfsz-islongdouble.sh $(objpfx)tst-printfsz-islongdouble
 	$(SHELL) $^ '$(test-program-prefix)' $@; \
@@ -467,6 +587,10 @@ $(objpfx)tst-printf-bz18872.c: tst-printf-bz18872.sh
 $(objpfx)tst-%-mem.out: $(objpfx)tst-%.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-$*.mtrace > $@; \
 	$(evaluate-test)
+$(objpfx)tst-printf-format-%-mem.out: $(objpfx)tst-printf-format-%.out
+	$(common-objpfx)malloc/mtrace \
+	  $(objpfx)tst-printf-format-$*.mtrace > $@; \
+	$(evaluate-test)
 
 errlist-h = $(firstword $(wildcard $(addsuffix /errlist.h,$(sysdirs) .)))
 
@@ -529,7 +653,7 @@ CFLAGS-tst-gets.c += -Wno-deprecated-declarations
 
 # BZ #11319 was first fixed for regular vdprintf, then reopened because
 # the fortified version had the same bug.
-CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2
+CFLAGS-tst-bz11319-fortify2.c += $(no-fortify-source) -D_FORTIFY_SOURCE=2
 
 CFLAGS-tst-memstream-string.c += -fno-builtin-fprintf
 
@@ -554,3 +678,6 @@ $(objpfx)tst-setvbuf1-cmp.out: tst-setvbuf1.expect $(objpfx)tst-setvbuf1.out
 
 $(objpfx)tst-printf-round: $(libm)
 $(objpfx)tst-scanf-round: $(libm)
+
+$(objpfx)tst-freopen7: $(shared-thread-library)
+$(objpfx)tst-freopen64-7: $(shared-thread-library)