Bug 30545

Summary: "make tests-clean" is not reliable
Product: glibc Reporter: Maxim Kuvyrkov <maxim.kuvyrkov>
Component: buildAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: minor CC: carlos, sam
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed: 2023-06-13 00:00:00

Description Maxim Kuvyrkov 2023-06-12 15:30:34 UTC
$ ../glibc/configure --prefix=/usr
$ make -j160
$ find -name "*.out" -o -name "*.test-result" | wc -l
0
$ make -j160 check
$ find -name "*.out" -o -name "*.test-result" | wc -l
9210
$ make tests-clean
$ find -name "*.out" -o -name "*.test-result" | wc -l
3297

"tests-clean" relies on do-tests-clean to clean individual subdirs, which, in turn, relies for subdirs to provide exhaustive list of all tests:
===
do-tests-clean:
	-rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) \
						      $(tests-internal) \
						      $(xtests) \
						      $(test-srcs)) \
				     $(addsuffix .test-result,$(tests) \
							      $(tests-internal) \
							      $(xtests) \
							      $(test-srcs)))
===

I suggest changing the above to:
===
do-tests-clean:
	-find $(objpfx) -name "*.out" -delete
	-find $(objpfx) -name "*.test-result" -delete
===
... or something similar.

Another alternative is to remove the "tests-clean" target, since most developers don't trust it now.
Comment 1 Carlos O'Donell 2023-06-13 12:11:06 UTC
(In reply to Maxim Kuvyrkov from comment #0)
> I suggest changing the above to:
> ===
> do-tests-clean:
> 	-find $(objpfx) -name "*.out" -delete
> 	-find $(objpfx) -name "*.test-result" -delete
> ===
> ... or something similar.

Agreed, this is a better solution than the recursive one.

Please propose this change as a patch and I'll happily review.

Then I'll go over the test-container tests with DJ to add a stage that deletes the container chroot so it gets recreated.