From: John Hubbard <jhubbard@nvidia.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Anders Roxell <anders.roxell@linaro.org>,
David Hildenbrand <david@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Muhammad Usama Anjum <usama.anjum@collabora.com>,
Nathan Chancellor <nathan@kernel.org>,
Peter Xu <peterx@redhat.com>, Shuah Khan <shuah@kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <linux-mm@kvack.org>,
<linux-kselftest@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Mark Brown" <broonie@kernel.org>
Subject: Re: [PATCH] selftests/arm64: fix build failure during the "emit_tests" step
Date: Mon, 10 Jul 2023 17:58:30 -0700 [thread overview]
Message-ID: <c30ff285-176f-4d76-38a0-4917a1c55c2b@nvidia.com> (raw)
In-Reply-To: <20230711005629.2547838-1-jhubbard@nvidia.com>
On 7/10/23 17:56, John Hubbard wrote:
> The build failure reported in [1] occurred because commit 9fc96c7c19df
> ("selftests: error out if kernel header files are not yet built") added
> a new "kernel_header_files" dependency to "all", and that triggered
> another, pre-existing problem. Specifically, the arm64 selftests
> override the emit_tests target, and that override improperly declares
> itself to depend upon the "all" target.
I also have a corresponding fix for selftests/riscv, which has copied the
arm64 selftest approach. But I'll wait to see how reviews go here,
before sending that out.
thanks,
--
John Hubbard
NVIDIA
>
> This is a problem because the "emit_tests" target in lib.mk was not
> intended to be overridden. emit_tests is a very simple, sequential build
> target that was originally invoked from the "install" target, which in
> turn, depends upon "all".
>
> That approach worked for years. But with 9fc96c7c19df in place,
> emit_tests failed, because it does not set up all of the elaborate
> things that "install" does. And that caused the new
> "kernel_header_files" target (which depends upon $(KBUILD_OUTPUT) being
> correct) to fail.
>
> Some detail: The "all" target is .PHONY. Therefore, each target that
> depends on "all" will cause it to be invoked again, and because
> dependencies are managed quite loosely in the selftests Makefiles, many
> things will run, even "all" is invoked several times in immediate
> succession. So this is not a "real" failure, as far as build steps go:
> everything gets built, but "all" reports a problem when invoked a second
> time from a bad environment.
>
> To fix this, simply remove the unnecessary "all" dependency from the
> overridden emit_tests target. The dependency is still effectively
> honored, because again, invocation is via "install", which also depends
> upon "all".
>
> An alternative approach would be to harden the emit_tests target so that
> it can depend upon "all", but that's a lot more complicated and hard to
> get right, and doesn't seem worth it, especially given that emit_tests
> should probably not be overridden at all.
>
> [1] https://lore.kernel.org/20230710-kselftest-fix-arm64-v1-1-48e872844f25@kernel.org
>
> Fixes: 9fc96c7c19df ("selftests: error out if kernel header files are not yet built")
> Reported-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
> tools/testing/selftests/arm64/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/arm64/Makefile b/tools/testing/selftests/arm64/Makefile
> index 9460cbe81bcc..ace8b67fb22d 100644
> --- a/tools/testing/selftests/arm64/Makefile
> +++ b/tools/testing/selftests/arm64/Makefile
> @@ -42,7 +42,7 @@ run_tests: all
> done
>
> # Avoid any output on non arm64 on emit_tests
> -emit_tests: all
> +emit_tests:
> @for DIR in $(ARM64_SUBTARGETS); do \
> BUILD_TARGET=$(OUTPUT)/$$DIR; \
> make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \
>
> base-commit: d5fe758c21f4770763ae4c05580be239be18947d
next prev parent reply other threads:[~2023-07-11 0:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 0:56 John Hubbard
2023-07-11 0:58 ` John Hubbard [this message]
2023-07-11 14:57 ` Mark Brown
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=c30ff285-176f-4d76-38a0-4917a1c55c2b@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=anders.roxell@linaro.org \
--cc=broonie@kernel.org \
--cc=corbet@lwn.net \
--cc=david@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nathan@kernel.org \
--cc=peterx@redhat.com \
--cc=shuah@kernel.org \
--cc=usama.anjum@collabora.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox