From: Tommi Rantala <tommi.t.rantala@nokia.com>
To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
Shuah Khan <shuah@kernel.org>
Cc: Tommi Rantala <tommi.t.rantala@nokia.com>,
Kees Cook <keescook@chromium.org>
Subject: [PATCH 01/13] selftests: filter kselftest headers from command in lib.mk
Date: Thu, 8 Oct 2020 15:26:21 +0300 [thread overview]
Message-ID: <20201008122633.687877-2-tommi.t.rantala@nokia.com> (raw)
In-Reply-To: <20201008122633.687877-1-tommi.t.rantala@nokia.com>
Commit 1056d3d2c97e ("selftests: enforce local header dependency in
lib.mk") added header dependency to the rule, but as the rule uses $^,
the headers are added to the compiler command line.
This can cause unexpected precompiled header files being generated when
compilation fails:
$ echo { >> openat2_test.c
$ make
gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined openat2_test.c
tools/testing/selftests/kselftest_harness.h tools/testing/selftests/kselftest.h helpers.c
-o tools/testing/selftests/openat2/openat2_test
openat2_test.c:313:1: error: expected identifier or ‘(’ before ‘{’ token
313 | {
| ^
make: *** [../lib.mk:140: tools/testing/selftests/openat2/openat2_test] Error 1
$ file openat2_test*
openat2_test: GCC precompiled header (version 014) for C
openat2_test.c: C source, ASCII text
Fix it by filtering out the headers, so that we'll only pass the actual
*.c files in the compiler command line.
Fixes: 1056d3d2c97e ("selftests: enforce local header dependency in lib.mk")
Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
---
tools/testing/selftests/lib.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 7a17ea815736..66f3317dc365 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -137,7 +137,7 @@ endif
ifeq ($(OVERRIDE_TARGETS),)
LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
$(OUTPUT)/%:%.c $(LOCAL_HDRS)
- $(LINK.c) $^ $(LDLIBS) -o $@
+ $(LINK.c) $(filter-out $(LOCAL_HDRS),$^) $(LDLIBS) -o $@
$(OUTPUT)/%.o:%.S
$(COMPILE.S) $^ -o $@
--
2.26.2
next prev parent reply other threads:[~2020-10-08 12:26 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-08 12:26 [PATCH 00/13] selftests fixes Tommi Rantala
2020-10-08 12:26 ` Tommi Rantala [this message]
2020-10-08 20:05 ` [PATCH 01/13] selftests: filter kselftest headers from command in lib.mk Kees Cook
2020-10-09 12:06 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 02/13] selftests: pidfd: fix compilation errors due to wait.h Tommi Rantala
2020-10-08 20:12 ` Kees Cook
2020-10-09 9:43 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 03/13] selftests: add vmaccess to .gitignore Tommi Rantala
2020-10-08 20:05 ` Kees Cook
2020-10-09 12:02 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 04/13] selftests/harness: prettify SKIP message whitespace again Tommi Rantala
2020-10-08 20:06 ` Kees Cook
2020-10-09 12:02 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 05/13] selftests: pidfd: use ksft_test_result_skip() when skipping test Tommi Rantala
2020-10-09 12:03 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 06/13] selftests: pidfd: skip test on kcmp() ENOSYS Tommi Rantala
2020-10-09 12:04 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 07/13] selftests: pidfd: add CONFIG_CHECKPOINT_RESTORE=y to config Tommi Rantala
2020-10-09 12:04 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 08/13] selftests: pidfd: drop needless linux/kcmp.h inclusion in pidfd_setns_test.c Tommi Rantala
2020-10-09 12:04 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 09/13] selftests: android: fix multiple definition of sock_name Tommi Rantala
2020-10-09 12:05 ` Christian Brauner
2020-11-05 17:14 ` Shuah Khan
2020-10-08 12:26 ` [PATCH 10/13] selftests: proc: fix warning: _GNU_SOURCE redefined Tommi Rantala
2020-10-08 12:26 ` [PATCH 11/13] selftests: core: use SKIP instead of XFAIL in close_range_test.c Tommi Rantala
2020-10-08 20:06 ` Kees Cook
2020-10-09 9:44 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 12/13] selftests: clone3: use SKIP instead of XFAIL Tommi Rantala
2020-10-08 20:06 ` Kees Cook
2020-10-09 9:44 ` Christian Brauner
2020-10-08 12:26 ` [PATCH 13/13] selftests: binderfs: " Tommi Rantala
2020-10-08 20:06 ` Kees Cook
2020-10-09 9:43 ` Christian Brauner
2020-10-09 12:07 ` [PATCH 00/13] selftests fixes Christian Brauner
2020-10-27 23:12 ` Shuah Khan
2020-10-28 1:37 ` Michael Ellerman
2020-10-28 14:31 ` Shuah Khan
2020-10-30 6:15 ` Michael Ellerman
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=20201008122633.687877-2-tommi.t.rantala@nokia.com \
--to=tommi.t.rantala@nokia.com \
--cc=keescook@chromium.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: 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;
as well as URLs for NNTP newsgroup(s).