From: Kees Cook <keescook@chromium.org>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
shuah@kernel.org, luto@amacapital.net, wad@chromium.org,
daniel@iogearbox.net, kafai@fb.com, yhs@fb.com, andriin@fb.com,
gregkh@linuxfoundation.org, tglx@linutronix.de,
khilman@baylibre.com, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
bpf@vger.kernel.org
Subject: Re: [PATCH v3] selftests: Fix seccomp to support relocatable build (O=objdir)
Date: Mon, 23 Mar 2020 13:50:39 -0700 [thread overview]
Message-ID: <202003231346.2D1FF7E0C3@keescook> (raw)
In-Reply-To: <eb90dd83-7988-b3ac-1ee6-bf16c0aacc10@linuxfoundation.org>
On Mon, Mar 23, 2020 at 02:18:29PM -0600, Shuah Khan wrote:
> The following two changes work. You both have better make foo than
> I do. Can you see any issues with this proposal? I can send patch
> to do this, so we can do a larger test.
>
> --------------------------------------------------------------
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 3ed0134a764d..54caa9a4ec8a 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -137,7 +137,7 @@ endif
> # Selftest makefiles can override those targets by setting
> # OVERRIDE_TARGETS = 1.
> ifeq ($(OVERRIDE_TARGETS),)
> -$(OUTPUT)/%:%.c
> +$(OUTPUT)/%:%.c ../kselftest_harness.h ../kselftest.h
> $(LINK.c) $^ $(LDLIBS) -o $@
I don't think this will work because some tests are in subdirectories.
The Makefile needs to know what the top-level directory of the selftest
tree is (which I think is $(selfdir) ?) I think this might be more
complete:
$(OUTPUT)/%: %.c $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
$(LINK.c) $^ $(LDLIBS) -o $@
> diff --git a/tools/testing/selftests/seccomp/Makefile
> b/tools/testing/selftests/seccomp/Makefile
> index a0388fd2c3f2..0ebfe8b0e147 100644
> --- a/tools/testing/selftests/seccomp/Makefile
> +++ b/tools/testing/selftests/seccomp/Makefile
> @@ -2,14 +2,5 @@
> CFLAGS += -Wl,-no-as-needed -Wall
> LDFLAGS += -lpthread
>
> -.PHONY: all clean
> -
> +TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark
> include ../lib.mk
> -
> -# OUTPUT set by lib.mk
> -TEST_GEN_PROGS := $(OUTPUT)/seccomp_bpf $(OUTPUT)/seccomp_benchmark
> -
> -$(TEST_GEN_PROGS): ../kselftest_harness.h
> -
> -all: $(TEST_GEN_PROGS)
> -
This part looks right. :)
--
Kees Cook
prev parent reply other threads:[~2020-03-23 20:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 21:24 [PATCH v3] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
2020-03-13 23:18 ` Kees Cook
2020-03-13 23:38 ` Shuah Khan
2020-03-16 12:12 ` Michael Ellerman
2020-03-16 21:05 ` Kees Cook
2020-03-19 3:15 ` Michael Ellerman
2020-03-23 20:18 ` Shuah Khan
2020-03-23 20:50 ` Kees Cook [this message]
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=202003231346.2D1FF7E0C3@keescook \
--to=keescook@chromium.org \
--cc=andriin@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=gregkh@linuxfoundation.org \
--cc=kafai@fb.com \
--cc=khilman@baylibre.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=tglx@linutronix.de \
--cc=wad@chromium.org \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).