public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Fix tests-clean Makefile target (bug 30545)
@ 2023-06-26 13:38 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2023-06-26 13:38 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=7c507f4473911a13273ac535b02fd55edc8e19f9

commit 7c507f4473911a13273ac535b02fd55edc8e19f9
Author: Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
Date:   Thu Jun 15 15:25:47 2023 +0000

    Fix tests-clean Makefile target (bug 30545)
    
    This patch improves tests-clean Makefile target to reliably clean
    test artifacts from a build directory.  Before this patch tests-clean
    missed around 3k (out of total 9k) .out and .test-result files.
    
    Signed-off-by: Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 Makefile  |  5 ++++-
 Makerules | 23 +++++------------------
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/Makefile b/Makefile
index 523efd42c1..f324df7a1f 100644
--- a/Makefile
+++ b/Makefile
@@ -518,7 +518,10 @@ mostlyclean: parent-mostlyclean
 	@$(MAKE) subdir_mostlyclean no_deps=t
 	-rm -f $(postclean)
 
-tests-clean:
+# Remove test artifacts from the whole glibc build.
+# do-tests-clean removes test artifacts from top-level directory, and
+# subdir_testclean removes them from individual sub-directories.
+tests-clean: do-tests-clean
 	@$(MAKE) subdir_testclean no_deps=t
 
 ifneq (,$(CXX))
diff --git a/Makerules b/Makerules
index 2ccf26d320..018780c818 100644
--- a/Makerules
+++ b/Makerules
@@ -1334,18 +1334,13 @@ echo-headers:
 clean: common-clean
 mostlyclean: common-mostlyclean
 
+# Remove test artifacts from a given directory
 do-tests-clean:
-	-rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) \
-						      $(tests-internal) \
-						      $(xtests) \
-						      $(test-srcs)) \
-				     $(addsuffix .test-result,$(tests) \
-							      $(tests-internal) \
-							      $(xtests) \
-							      $(test-srcs)))
+	-find $(objpfx) -name '*.out' -delete
+	-find $(objpfx) -name '*.test-result' -delete
 
 # Remove the object files.
-common-mostlyclean:
+common-mostlyclean: do-tests-clean
 	-rm -f $(addprefix $(objpfx),$(tests) $(tests-internal) $(xtests) \
 				     $(test-srcs) \
 				     $(others) $(sysdep-others) stubs \
@@ -1354,15 +1349,7 @@ common-mostlyclean:
 						    $(xtests) \
 						    $(test-srcs) \
 						    $(others) \
-						    $(sysdep-others)) \
-				     $(addsuffix .out,$(tests) \
-						      $(tests-internal) \
-						      $(xtests) \
-						      $(test-srcs)) \
-				     $(addsuffix .test-result,$(tests) \
-							      $(tests-internal) \
-							      $(xtests) \
-							      $(test-srcs)))
+						    $(sysdep-others)))
 	-rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \
 				     $(install-lib) $(install-lib.so) \
 				     $(install-lib.so:%.so=%_pic.a))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-26 13:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26 13:38 [glibc] Fix tests-clean Makefile target (bug 30545) Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).