From: Cristian Marussi <cristian.marussi@arm.com> To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, shuah@kernel.org Subject: [PATCH v2] selftests: fix build behaviour on targets' failures Date: Tue, 10 Dec 2019 11:44:59 +0000 [thread overview] Message-ID: <20191210114459.11405-1-cristian.marussi@arm.com> (raw) Currently, when some of the KSFT subsystems fails to build, the toplevel KSFT Makefile just keeps carrying on with the build process. This behaviour is expected and desirable especially in the context of a CI system running KSelfTest, since it is not always easy to guarantee that the most recent and esoteric dependencies are respected across all KSFT TARGETS in a timely manner. Unfortunately, as of now, this holds true only if the very last of the built subsystems could have been successfully compiled: if the last of those subsystem instead failed to build, such failure is taken as the whole outcome of the Makefile target and the complete build/install process halts even though many other preceding subsytems were in fact already built successfully. Fix the KSFT Makefile behaviour related to all/install targets in order to fail as a whole only when the all/install targets have failed for all of the requested TARGETS, while succeeding when at least one of TARGETS has been successfully built. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> --- This patch is based on ksft/fixes branch from: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git on top of commit (~5.5-rc1): 99e51aa8f701 Documentation: kunit: add documentation for kunit_tool Building with either: make kselftest-install \ KSFT_INSTALL_PATH=/tmp/KSFT \ TARGETS="exec arm64 bpf" make -C tools/testing/selftests install \ KSFT_INSTALL_PATH=/tmp/KSFT \ TARGETS="exec arm64 bpf" (with 'bpf' not building clean on my setup in the above case) and veryfying that build/install completes if at least one of TARGETS can be successfully built, and any successfully built subsystem is installed. Changes: ------- V1 --> V2 - rebased on 5.5-rc1 - rewording commit message - dropped RFC tag --- tools/testing/selftests/Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index b001c602414b..86b2a3fca04d 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -143,11 +143,13 @@ else endif all: khdr - @for TARGET in $(TARGETS); do \ - BUILD_TARGET=$$BUILD/$$TARGET; \ - mkdir $$BUILD_TARGET -p; \ - $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\ - done; + @ret=1; \ + for TARGET in $(TARGETS); do \ + BUILD_TARGET=$$BUILD/$$TARGET; \ + mkdir $$BUILD_TARGET -p; \ + $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET; \ + ret=$$((ret * $$?)); \ + done; exit $$ret; run_tests: all @for TARGET in $(TARGETS); do \ @@ -196,10 +198,12 @@ ifdef INSTALL_PATH install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/ install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/ install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/ - @for TARGET in $(TARGETS); do \ + @ret=1; \ + for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ - done; + ret=$$((ret * $$?)); \ + done; exit $$ret; @# Ask all targets to emit their test scripts echo "#!/bin/sh" > $(ALL_SCRIPT) -- 2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Cristian Marussi <cristian.marussi@arm.com> To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, shuah@kernel.org Subject: [PATCH v2] selftests: fix build behaviour on targets' failures Date: Tue, 10 Dec 2019 11:44:59 +0000 [thread overview] Message-ID: <20191210114459.11405-1-cristian.marussi@arm.com> (raw) Currently, when some of the KSFT subsystems fails to build, the toplevel KSFT Makefile just keeps carrying on with the build process. This behaviour is expected and desirable especially in the context of a CI system running KSelfTest, since it is not always easy to guarantee that the most recent and esoteric dependencies are respected across all KSFT TARGETS in a timely manner. Unfortunately, as of now, this holds true only if the very last of the built subsystems could have been successfully compiled: if the last of those subsystem instead failed to build, such failure is taken as the whole outcome of the Makefile target and the complete build/install process halts even though many other preceding subsytems were in fact already built successfully. Fix the KSFT Makefile behaviour related to all/install targets in order to fail as a whole only when the all/install targets have failed for all of the requested TARGETS, while succeeding when at least one of TARGETS has been successfully built. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> --- This patch is based on ksft/fixes branch from: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git on top of commit (~5.5-rc1): 99e51aa8f701 Documentation: kunit: add documentation for kunit_tool Building with either: make kselftest-install \ KSFT_INSTALL_PATH=/tmp/KSFT \ TARGETS="exec arm64 bpf" make -C tools/testing/selftests install \ KSFT_INSTALL_PATH=/tmp/KSFT \ TARGETS="exec arm64 bpf" (with 'bpf' not building clean on my setup in the above case) and veryfying that build/install completes if at least one of TARGETS can be successfully built, and any successfully built subsystem is installed. Changes: ------- V1 --> V2 - rebased on 5.5-rc1 - rewording commit message - dropped RFC tag --- tools/testing/selftests/Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index b001c602414b..86b2a3fca04d 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -143,11 +143,13 @@ else endif all: khdr - @for TARGET in $(TARGETS); do \ - BUILD_TARGET=$$BUILD/$$TARGET; \ - mkdir $$BUILD_TARGET -p; \ - $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\ - done; + @ret=1; \ + for TARGET in $(TARGETS); do \ + BUILD_TARGET=$$BUILD/$$TARGET; \ + mkdir $$BUILD_TARGET -p; \ + $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET; \ + ret=$$((ret * $$?)); \ + done; exit $$ret; run_tests: all @for TARGET in $(TARGETS); do \ @@ -196,10 +198,12 @@ ifdef INSTALL_PATH install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/ install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/ install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/ - @for TARGET in $(TARGETS); do \ + @ret=1; \ + for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ - done; + ret=$$((ret * $$?)); \ + done; exit $$ret; @# Ask all targets to emit their test scripts echo "#!/bin/sh" > $(ALL_SCRIPT) -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2019-12-10 11:45 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-10 11:44 Cristian Marussi [this message] 2019-12-10 11:44 ` [PATCH v2] selftests: fix build behaviour on targets' failures Cristian Marussi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20191210114459.11405-1-cristian.marussi@arm.com \ --to=cristian.marussi@arm.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=shuah@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.