Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: Preserve subtarget failures in all/install

Track failures explicitly in the top-level selftests all/install loops.

The current code multiplies `ret` by each sub-make exit status. For
example, with `TARGETS=net`, the implicit `net/lib` dependency runs after
`net`, so a failed `net` build can be followed by a successful `net/lib`
build and reset the final result to success.

Set `ret` to 1 on any non-zero sub-make exit code and keep it sticky, so
the top-level make returns failure when any selected selftest target
fails.

Signed-off-by: Ricardo B. Marlière <rbm@suse.com>
Link: https://lore.kernel.org/r/20260320-selftests-fixes-v1-5-79144f76be01@suse.com
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Ricardo B. Marlière and committed by
Shuah Khan
7e473891 d6ea9f40

+4 -4
+4 -4
tools/testing/selftests/Makefile
··· 209 209 .DEFAULT_GOAL := all 210 210 211 211 all: 212 - @ret=1; \ 212 + @ret=0; \ 213 213 for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \ 214 214 BUILD_TARGET=$$BUILD/$$TARGET; \ 215 215 mkdir $$BUILD_TARGET -p; \ 216 216 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \ 217 217 O=$(abs_objtree) \ 218 218 $(if $(FORCE_TARGETS),|| exit); \ 219 - ret=$$((ret * $$?)); \ 219 + [ $$? -eq 0 ] || ret=1; \ 220 220 done; exit $$ret; 221 221 222 222 run_tests: all ··· 274 274 install -m 744 kselftest/ksft.py $(INSTALL_PATH)/kselftest/ 275 275 install -m 744 run_kselftest.sh $(INSTALL_PATH)/ 276 276 rm -f $(TEST_LIST) 277 - @ret=1; \ 277 + @ret=0; \ 278 278 for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \ 279 279 BUILD_TARGET=$$BUILD/$$TARGET; \ 280 280 $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \ ··· 283 283 OBJ_PATH=$(INSTALL_PATH) \ 284 284 O=$(abs_objtree) \ 285 285 $(if $(FORCE_TARGETS),|| exit); \ 286 - ret=$$((ret * $$?)); \ 286 + [ $$? -eq 0 ] || ret=1; \ 287 287 done; exit $$ret; 288 288 289 289