diff mbox

[v2,net] selftests/bpf: fix broken build, take 2

Message ID 1489989794-6859-1-git-send-email-zlim.lnx@gmail.com
State New
Headers show

Commit Message

Zi Shen Lim March 20, 2017, 6:03 a.m. UTC
Merge of 'linux-kselftest-4.11-rc1':

1. Partially removed use of 'test_objs' target, breaking force rebuild of
BPFOBJ, introduced in commit d498f8719a09 ("bpf: Rebuild bpf.o for any
dependency update").

  Update target so dependency on BPFOBJ is restored.

2. Introduced commit 2047f1d8ba28 ("selftests: Fix the .c linking rule")
which fixes order of LDLIBS.

  Commit d02d8986a768 ("bpf: Always test unprivileged programs") added
libcap dependency into CFLAGS. Use LDLIBS instead to fix linking of
test_verifier.

3. Introduced commit d83c3ba0b926 ("selftests: Fix selftests build to
just build, not run tests").

  Reordering the Makefile allows us to remove the 'all' target.

Tested both:
    selftests/bpf$ make
and
    selftests$ make TARGETS=bpf
on Ubuntu 16.04.2.

Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>

---
v1:
  - Fixed build from selftests/bpf/.
v2:
  - Fixed build from selftests/ also.

 tools/testing/selftests/bpf/Makefile | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

-- 
2.7.4

Comments

Daniel Borkmann March 20, 2017, 3:31 p.m. UTC | #1
On 03/20/2017 07:03 AM, Zi Shen Lim wrote:
> Merge of 'linux-kselftest-4.11-rc1':

>

> 1. Partially removed use of 'test_objs' target, breaking force rebuild of

> BPFOBJ, introduced in commit d498f8719a09 ("bpf: Rebuild bpf.o for any

> dependency update").

>

>    Update target so dependency on BPFOBJ is restored.

>

> 2. Introduced commit 2047f1d8ba28 ("selftests: Fix the .c linking rule")

> which fixes order of LDLIBS.

>

>    Commit d02d8986a768 ("bpf: Always test unprivileged programs") added

> libcap dependency into CFLAGS. Use LDLIBS instead to fix linking of

> test_verifier.

>

> 3. Introduced commit d83c3ba0b926 ("selftests: Fix selftests build to

> just build, not run tests").

>

>    Reordering the Makefile allows us to remove the 'all' target.

>

> Tested both:

>      selftests/bpf$ make

> and

>      selftests$ make TARGETS=bpf

> on Ubuntu 16.04.2.

>

> Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>


Looks reasonable to me as follow up to 1da8ac7c49fb ("selftests/bpf:
fix broken build"), thanks for fixing Zi!

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

Tested-by: Daniel Borkmann <daniel@iogearbox.net>
Alexei Starovoitov March 20, 2017, 3:45 p.m. UTC | #2
On Mon, Mar 20, 2017 at 04:31:28PM +0100, Daniel Borkmann wrote:
> On 03/20/2017 07:03 AM, Zi Shen Lim wrote:

> >Merge of 'linux-kselftest-4.11-rc1':

> >

> >1. Partially removed use of 'test_objs' target, breaking force rebuild of

> >BPFOBJ, introduced in commit d498f8719a09 ("bpf: Rebuild bpf.o for any

> >dependency update").

> >

> >   Update target so dependency on BPFOBJ is restored.

> >

> >2. Introduced commit 2047f1d8ba28 ("selftests: Fix the .c linking rule")

> >which fixes order of LDLIBS.

> >

> >   Commit d02d8986a768 ("bpf: Always test unprivileged programs") added

> >libcap dependency into CFLAGS. Use LDLIBS instead to fix linking of

> >test_verifier.

> >

> >3. Introduced commit d83c3ba0b926 ("selftests: Fix selftests build to

> >just build, not run tests").

> >

> >   Reordering the Makefile allows us to remove the 'all' target.

> >

> >Tested both:

> >     selftests/bpf$ make

> >and

> >     selftests$ make TARGETS=bpf

> >on Ubuntu 16.04.2.

> >

> >Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>

> 

> Looks reasonable to me as follow up to 1da8ac7c49fb ("selftests/bpf:

> fix broken build"), thanks for fixing Zi!

> 

> Acked-by: Daniel Borkmann <daniel@iogearbox.net>

> Tested-by: Daniel Borkmann <daniel@iogearbox.net>


worked for me as well:
Acked-by: Alexei Starovoitov <ast@kernel.org>

Tested-by: Alexei Starovoitov <ast@kernel.org>
Shuah March 20, 2017, 4:37 p.m. UTC | #3
On 03/20/2017 09:45 AM, Alexei Starovoitov wrote:
> On Mon, Mar 20, 2017 at 04:31:28PM +0100, Daniel Borkmann wrote:

>> On 03/20/2017 07:03 AM, Zi Shen Lim wrote:

>>> Merge of 'linux-kselftest-4.11-rc1':

>>>

>>> 1. Partially removed use of 'test_objs' target, breaking force rebuild of

>>> BPFOBJ, introduced in commit d498f8719a09 ("bpf: Rebuild bpf.o for any

>>> dependency update").

>>>

>>>   Update target so dependency on BPFOBJ is restored.

>>>

>>> 2. Introduced commit 2047f1d8ba28 ("selftests: Fix the .c linking rule")

>>> which fixes order of LDLIBS.

>>>

>>>   Commit d02d8986a768 ("bpf: Always test unprivileged programs") added

>>> libcap dependency into CFLAGS. Use LDLIBS instead to fix linking of

>>> test_verifier.

>>>

>>> 3. Introduced commit d83c3ba0b926 ("selftests: Fix selftests build to

>>> just build, not run tests").

>>>

>>>   Reordering the Makefile allows us to remove the 'all' target.

>>>

>>> Tested both:

>>>     selftests/bpf$ make

>>> and

>>>     selftests$ make TARGETS=bpf

>>> on Ubuntu 16.04.2.

>>>

>>> Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>

>>

>> Looks reasonable to me as follow up to 1da8ac7c49fb ("selftests/bpf:

>> fix broken build"), thanks for fixing Zi!

>>

>> Acked-by: Daniel Borkmann <daniel@iogearbox.net>

>> Tested-by: Daniel Borkmann <daniel@iogearbox.net>

> 

> worked for me as well:

> Acked-by: Alexei Starovoitov <ast@kernel.org>

> Tested-by: Alexei Starovoitov <ast@kernel.org>

> 

> 

> 


David,

Could you please apply it to your tree. I think you already applied
the first fix.

Acked-by: Shuah Khan <shuahkh@osg.samsung.com>


thanks,
-- Shuah
David Miller March 22, 2017, 1:56 a.m. UTC | #4
From: Shuah Khan <shuah@kernel.org>

Date: Mon, 20 Mar 2017 10:37:26 -0600

> On 03/20/2017 09:45 AM, Alexei Starovoitov wrote:

>> On Mon, Mar 20, 2017 at 04:31:28PM +0100, Daniel Borkmann wrote:

>>> On 03/20/2017 07:03 AM, Zi Shen Lim wrote:

>>>> Merge of 'linux-kselftest-4.11-rc1':

>>>>

>>>> 1. Partially removed use of 'test_objs' target, breaking force rebuild of

>>>> BPFOBJ, introduced in commit d498f8719a09 ("bpf: Rebuild bpf.o for any

>>>> dependency update").

>>>>

>>>>   Update target so dependency on BPFOBJ is restored.

>>>>

>>>> 2. Introduced commit 2047f1d8ba28 ("selftests: Fix the .c linking rule")

>>>> which fixes order of LDLIBS.

>>>>

>>>>   Commit d02d8986a768 ("bpf: Always test unprivileged programs") added

>>>> libcap dependency into CFLAGS. Use LDLIBS instead to fix linking of

>>>> test_verifier.

>>>>

>>>> 3. Introduced commit d83c3ba0b926 ("selftests: Fix selftests build to

>>>> just build, not run tests").

>>>>

>>>>   Reordering the Makefile allows us to remove the 'all' target.

>>>>

>>>> Tested both:

>>>>     selftests/bpf$ make

>>>> and

>>>>     selftests$ make TARGETS=bpf

>>>> on Ubuntu 16.04.2.

>>>>

>>>> Signed-off-by: Zi Shen Lim <zlim.lnx@gmail.com>

>>>

>>> Looks reasonable to me as follow up to 1da8ac7c49fb ("selftests/bpf:

>>> fix broken build"), thanks for fixing Zi!

>>>

>>> Acked-by: Daniel Borkmann <daniel@iogearbox.net>

>>> Tested-by: Daniel Borkmann <daniel@iogearbox.net>

>> 

>> worked for me as well:

>> Acked-by: Alexei Starovoitov <ast@kernel.org>

>> Tested-by: Alexei Starovoitov <ast@kernel.org>

>> 

>> 

>> 

> 

> David,

> 

> Could you please apply it to your tree. I think you already applied

> the first fix.

> 

> Acked-by: Shuah Khan <shuahkh@osg.samsung.com>


Done.
diff mbox

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 67531f4..6a1ad58 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -1,22 +1,23 @@ 
 LIBDIR := ../../../lib
-BPFOBJ := $(LIBDIR)/bpf/bpf.o
+BPFDIR := $(LIBDIR)/bpf
 
-CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR) $(BPFOBJ)
+CFLAGS += -Wall -O2 -I../../../include/uapi -I$(LIBDIR)
+LDLIBS += -lcap
 
 TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map
 
 TEST_PROGS := test_kmod.sh
 
-all: $(TEST_GEN_PROGS)
+include ../lib.mk
+
+BPFOBJ := $(OUTPUT)/bpf.o
+
+$(TEST_GEN_PROGS): $(BPFOBJ)
 
-.PHONY: all clean force
+.PHONY: force
 
 # force a rebuild of BPFOBJ when its dependencies are updated
 force:
 
 $(BPFOBJ): force
-	$(MAKE) -C $(dir $(BPFOBJ))
-
-$(test_objs): $(BPFOBJ)
-
-include ../lib.mk
+	$(MAKE) -C $(BPFDIR) OUTPUT=$(OUTPUT)/