summaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2025-08-05 16:17:42 -0700
committerH.J. Lu <hjl.tools@gmail.com>2025-08-05 17:58:55 -0700
commit9d054eca1a6bb2585beec9d338b3aa978ad6e152 (patch)
treece76a0d2b86aad2e91f9c861abab0453b4c4ca11 /stdio-common
parentadec0bf05bc23ec35573c7a5b96440089b69265e (diff)
tst-freopen4: Remove temporary directory from warning message
tst-freopen4-main.c issues a warning message: warning: could not remove temporary file: /tmp/tst-freopen4potgti: No such file or directory since chroot makes generated temporary directories inaccessible. Add special rules for tst-freopen4.out and tst-freopen64-4.out to remove the temporary directory in warning message from tst-freopen4 and tst-freopen64-4. This partially fixes BZ #33182. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 64b3575acb..ae2b90c2ad 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -759,6 +759,30 @@ CFLAGS-tst-scanf-binary-gnu89.c += -std=gnu89 -DOBJPFX=\"$(objpfx)\"
CPPFLAGS += $(libio-mtsafe)
+make-tst-freopen4-out = \
+ $(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) $<
+
+freopen4-temp-dir-before = warning: could not remove temporary file:
+freopen4-temp-dir-after = : No such file or directory
+
+$(objpfx)tst-freopen4.out: $(objpfx)tst-freopen4
+ $(make-tst-freopen4-out) > $@ && \
+ grep "$(freopen4-temp-dir-before)" $@ \
+ | sed -e "s/$(freopen4-temp-dir-before)//; s/$(freopen4-temp-dir-after)//" \
+ | xargs rm -rf; \
+ $(evaluate-test)
+
+$(objpfx)tst-freopen64-4.out: $(objpfx)tst-freopen64-4
+ $(make-tst-freopen4-out) > $@ && \
+ grep "$(freopen4-temp-dir-before)" $@ \
+ | sed -e "s/$(freopen4-temp-dir-before)//; s/$(freopen4-temp-dir-after)//" \
+ | xargs rm -rf; \
+ $(evaluate-test)
+
$(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
$(test-program-cmd) > $@ 2>&1; \
$(evaluate-test)