linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Kselftest integration into Kernel CI - Part 1
@ 2020-03-04 22:13 Shuah Khan
  2020-03-04 22:13 ` [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir Shuah Khan
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Shuah Khan @ 2020-03-04 22:13 UTC (permalink / raw)
  To: shuah, keescook, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx
  Cc: Shuah Khan, khilman, mpe, linux-kselftest, linux-kernel, netdev, bpf

This patch series consists of first round of fixes to integrate
Kselftest into Kernel CI.

You can find full list of problems in my announcement I sent out
last week:

https://lkml.org/lkml/2020/2/27/2221

These fixes to android and seccomp tests address relocatable support.
However, they will still leave the source directory dirty.

android test does headers_install in source directory. This is an easier
problem to fix. seccomp on the other hand builds fixdep scripts under
scripts/basic and installs headers in the source directory. It is linked
to solving bpf relocatable build issue which I haven't given it a lot of
thought for now.

There is no dependency on source directory for run-time which is what
we want.

I will apply these kernelci topic branch for testing 
git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git

Shuah Khan (4):
  selftests: Fix kselftest O=objdir build from cluttering top level
    objdir
  selftests: Fix seccomp to support relocatable build (O=objdir)
  selftests: android: ion: Fix ionmap_test compile error
  selftests: android: Fix custom install from skipping test progs

 tools/testing/selftests/Makefile             |  4 ++--
 tools/testing/selftests/android/Makefile     |  2 +-
 tools/testing/selftests/android/ion/Makefile |  2 +-
 tools/testing/selftests/seccomp/Makefile     | 16 +++-------------
 4 files changed, 7 insertions(+), 17 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir
  2020-03-04 22:13 [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
@ 2020-03-04 22:13 ` Shuah Khan
  2020-03-11 22:58   ` Kevin Hilman
  2020-03-04 22:13 ` [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Shuah Khan @ 2020-03-04 22:13 UTC (permalink / raw)
  To: shuah; +Cc: Shuah Khan, khilman, mpe, linux-kselftest, linux-kernel

make kselftest-all O=objdir builds create generated objects in objdir.
This clutters the top level directory with kselftest objects. Fix it
to create sub-directory under objdir for kselftest objects.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/testing/selftests/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 6ec503912bea..cd77df3e6bb8 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -91,7 +91,7 @@ override LDFLAGS =
 override MAKEFLAGS =
 endif
 
-# Append kselftest to KBUILD_OUTPUT to avoid cluttering
+# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
 # KBUILD_OUTPUT with selftest objects and headers installed
 # by selftests Makefile or lib.mk.
 ifdef building_out_of_srctree
@@ -99,7 +99,7 @@ override LDFLAGS =
 endif
 
 ifneq ($(O),)
-	BUILD := $(O)
+	BUILD := $(O)/kselftest
 else
 	ifneq ($(KBUILD_OUTPUT),)
 		BUILD := $(KBUILD_OUTPUT)/kselftest
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
  2020-03-04 22:13 [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
  2020-03-04 22:13 ` [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir Shuah Khan
@ 2020-03-04 22:13 ` Shuah Khan
  2020-03-04 22:42   ` Kees Cook
  2020-03-04 22:13 ` [PATCH 3/4] selftests: android: ion: Fix ionmap_test compile error Shuah Khan
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Shuah Khan @ 2020-03-04 22:13 UTC (permalink / raw)
  To: shuah, keescook, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx
  Cc: Shuah Khan, khilman, mpe, linux-kselftest, linux-kernel, netdev, bpf

Fix seccomp relocatable builds. This is a simple fix to use the
right lib.mk variable TEST_GEN_PROGS for objects to leverage
lib.mk common framework for relocatable builds.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/testing/selftests/seccomp/Makefile | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
index 1760b3e39730..a8a9717fc1be 100644
--- a/tools/testing/selftests/seccomp/Makefile
+++ b/tools/testing/selftests/seccomp/Makefile
@@ -1,17 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
-all:
-
-include ../lib.mk
-
-.PHONY: all clean
-
-BINARIES := seccomp_bpf seccomp_benchmark
 CFLAGS += -Wl,-no-as-needed -Wall
+LDFLAGS += -lpthread
 
-seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
-	$(CC) $(CFLAGS) $(LDFLAGS) $< -lpthread -o $@
-
-TEST_PROGS += $(BINARIES)
-EXTRA_CLEAN := $(BINARIES)
+TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark
 
-all: $(BINARIES)
+include ../lib.mk
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] selftests: android: ion: Fix ionmap_test compile error
  2020-03-04 22:13 [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
  2020-03-04 22:13 ` [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir Shuah Khan
  2020-03-04 22:13 ` [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
@ 2020-03-04 22:13 ` Shuah Khan
  2020-03-04 22:13 ` [PATCH 4/4] selftests: android: Fix custom install from skipping test progs Shuah Khan
  2020-03-04 23:09 ` [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
  4 siblings, 0 replies; 14+ messages in thread
From: Shuah Khan @ 2020-03-04 22:13 UTC (permalink / raw)
  To: shuah, gregkh, tglx
  Cc: Shuah Khan, khilman, mpe, linux-kselftest, linux-kernel

ionmap_test compile rule is missing ipcsocket.c dependency. Add it to
fix the following compile errors:

..android/ion/ionutils.c:221: undefined reference to `sendtosocket'
..android/ion/ionutils.c:243: undefined reference to `receivefromsocket'

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/testing/selftests/android/ion/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/android/ion/Makefile b/tools/testing/selftests/android/ion/Makefile
index 0eb7ab626e1c..42b71f005332 100644
--- a/tools/testing/selftests/android/ion/Makefile
+++ b/tools/testing/selftests/android/ion/Makefile
@@ -17,4 +17,4 @@ include ../../lib.mk
 
 $(OUTPUT)/ionapp_export: ionapp_export.c ipcsocket.c ionutils.c
 $(OUTPUT)/ionapp_import: ionapp_import.c ipcsocket.c ionutils.c
-$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c
+$(OUTPUT)/ionmap_test: ionmap_test.c ionutils.c ipcsocket.c
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] selftests: android: Fix custom install from skipping test progs
  2020-03-04 22:13 [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
                   ` (2 preceding siblings ...)
  2020-03-04 22:13 ` [PATCH 3/4] selftests: android: ion: Fix ionmap_test compile error Shuah Khan
@ 2020-03-04 22:13 ` Shuah Khan
  2020-03-04 23:09 ` [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
  4 siblings, 0 replies; 14+ messages in thread
From: Shuah Khan @ 2020-03-04 22:13 UTC (permalink / raw)
  To: shuah, gregkh, tglx
  Cc: Shuah Khan, khilman, mpe, linux-kselftest, linux-kernel

Update custom install rule to install all generated test programs. This
fixes android/ion tests to be installed correctly.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/testing/selftests/android/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/android/Makefile b/tools/testing/selftests/android/Makefile
index 7c462714b418..9258306cafe9 100644
--- a/tools/testing/selftests/android/Makefile
+++ b/tools/testing/selftests/android/Makefile
@@ -21,7 +21,7 @@ all:
 
 override define INSTALL_RULE
 	mkdir -p $(INSTALL_PATH)
-	install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)
+install -t $(INSTALL_PATH) $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES)  $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES)
 
 	@for SUBDIR in $(SUBDIRS); do \
 		BUILD_TARGET=$(OUTPUT)/$$SUBDIR;	\
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
  2020-03-04 22:13 ` [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
@ 2020-03-04 22:42   ` Kees Cook
  2020-03-04 23:15     ` Shuah Khan
  0 siblings, 1 reply; 14+ messages in thread
From: Kees Cook @ 2020-03-04 22:42 UTC (permalink / raw)
  To: Shuah Khan
  Cc: shuah, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx,
	khilman, mpe, linux-kselftest, linux-kernel, netdev, bpf

On Wed, Mar 04, 2020 at 03:13:33PM -0700, Shuah Khan wrote:
> Fix seccomp relocatable builds. This is a simple fix to use the
> right lib.mk variable TEST_GEN_PROGS for objects to leverage
> lib.mk common framework for relocatable builds.
> 
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> ---
>  tools/testing/selftests/seccomp/Makefile | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
> index 1760b3e39730..a8a9717fc1be 100644
> --- a/tools/testing/selftests/seccomp/Makefile
> +++ b/tools/testing/selftests/seccomp/Makefile
> @@ -1,17 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
> -all:
> -
> -include ../lib.mk
> -
> -.PHONY: all clean
> -
> -BINARIES := seccomp_bpf seccomp_benchmark
>  CFLAGS += -Wl,-no-as-needed -Wall
> +LDFLAGS += -lpthread
>  
> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h

How is the ../kselftest_harness.h dependency detected in the resulting
build rules?

Otherwise, looks good.

-Kees

> -	$(CC) $(CFLAGS) $(LDFLAGS) $< -lpthread -o $@
> -
> -TEST_PROGS += $(BINARIES)
> -EXTRA_CLEAN := $(BINARIES)
> +TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark
>  
> -all: $(BINARIES)
> +include ../lib.mk
> -- 
> 2.20.1
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/4] Kselftest integration into Kernel CI - Part 1
  2020-03-04 22:13 [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
                   ` (3 preceding siblings ...)
  2020-03-04 22:13 ` [PATCH 4/4] selftests: android: Fix custom install from skipping test progs Shuah Khan
@ 2020-03-04 23:09 ` Shuah Khan
  4 siblings, 0 replies; 14+ messages in thread
From: Shuah Khan @ 2020-03-04 23:09 UTC (permalink / raw)
  To: shuah, keescook, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx
  Cc: khilman, mpe, linux-kselftest, linux-kernel, netdev, bpf,
	skh >> Shuah Khan

On 3/4/20 3:13 PM, Shuah Khan wrote:
> This patch series consists of first round of fixes to integrate
> Kselftest into Kernel CI.
> 
> You can find full list of problems in my announcement I sent out
> last week:
> 
> https://lkml.org/lkml/2020/2/27/2221

Here is the lore link:

https://lore.kernel.org/lkml/3b3dc707-7ae7-955b-69fe-b9abe9ae26c5@linuxfoundation.org/

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
  2020-03-04 22:42   ` Kees Cook
@ 2020-03-04 23:15     ` Shuah Khan
  2020-03-05  0:22       ` Michael Ellerman
  0 siblings, 1 reply; 14+ messages in thread
From: Shuah Khan @ 2020-03-04 23:15 UTC (permalink / raw)
  To: Kees Cook
  Cc: shuah, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx,
	khilman, mpe, linux-kselftest, linux-kernel, netdev, bpf,
	Shuah Khan

On 3/4/20 3:42 PM, Kees Cook wrote:
> On Wed, Mar 04, 2020 at 03:13:33PM -0700, Shuah Khan wrote:
>> Fix seccomp relocatable builds. This is a simple fix to use the
>> right lib.mk variable TEST_GEN_PROGS for objects to leverage
>> lib.mk common framework for relocatable builds.
>>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>> ---
>>   tools/testing/selftests/seccomp/Makefile | 16 +++-------------
>>   1 file changed, 3 insertions(+), 13 deletions(-)
>>
>> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
>> index 1760b3e39730..a8a9717fc1be 100644
>> --- a/tools/testing/selftests/seccomp/Makefile
>> +++ b/tools/testing/selftests/seccomp/Makefile
>> @@ -1,17 +1,7 @@
>>   # SPDX-License-Identifier: GPL-2.0
>> -all:
>> -
>> -include ../lib.mk
>> -
>> -.PHONY: all clean
>> -
>> -BINARIES := seccomp_bpf seccomp_benchmark
>>   CFLAGS += -Wl,-no-as-needed -Wall
>> +LDFLAGS += -lpthread
>>   
>> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
> 
> How is the ../kselftest_harness.h dependency detected in the resulting
> build rules?
> 
> Otherwise, looks good.

Didn't see any problems. I will look into adding the dependency.

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
  2020-03-04 23:15     ` Shuah Khan
@ 2020-03-05  0:22       ` Michael Ellerman
  2020-03-05  0:29         ` Shuah Khan
  0 siblings, 1 reply; 14+ messages in thread
From: Michael Ellerman @ 2020-03-05  0:22 UTC (permalink / raw)
  To: Shuah Khan, Kees Cook
  Cc: shuah, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx,
	khilman, linux-kselftest, linux-kernel, netdev, bpf, Shuah Khan

Shuah Khan <skhan@linuxfoundation.org> writes:
> On 3/4/20 3:42 PM, Kees Cook wrote:
>> On Wed, Mar 04, 2020 at 03:13:33PM -0700, Shuah Khan wrote:
>>> Fix seccomp relocatable builds. This is a simple fix to use the
>>> right lib.mk variable TEST_GEN_PROGS for objects to leverage
>>> lib.mk common framework for relocatable builds.
>>>
>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>>> ---
>>>   tools/testing/selftests/seccomp/Makefile | 16 +++-------------
>>>   1 file changed, 3 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
>>> index 1760b3e39730..a8a9717fc1be 100644
>>> --- a/tools/testing/selftests/seccomp/Makefile
>>> +++ b/tools/testing/selftests/seccomp/Makefile
>>> @@ -1,17 +1,7 @@
>>>   # SPDX-License-Identifier: GPL-2.0
>>> -all:
>>> -
>>> -include ../lib.mk
>>> -
>>> -.PHONY: all clean
>>> -
>>> -BINARIES := seccomp_bpf seccomp_benchmark
>>>   CFLAGS += -Wl,-no-as-needed -Wall
>>> +LDFLAGS += -lpthread
>>>   
>>> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
>> 
>> How is the ../kselftest_harness.h dependency detected in the resulting
>> build rules?
>> 
>> Otherwise, looks good.
>
> Didn't see any problems. I will look into adding the dependency.

Before:

  $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
  make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
          ARCH=powerpc -C ../../.. headers_install
    INSTALL /home/michael/build/adhoc/kselftest/usr/include
  gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
  gcc -Wl,-no-as-needed -Wall    seccomp_benchmark.c   -o seccomp_benchmark
  
  $ touch tools/testing/selftests/kselftest_harness.h
  
  $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
  make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
          ARCH=powerpc -C ../../.. headers_install
    INSTALL /home/michael/build/adhoc/kselftest/usr/include
  gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
  $

Note that touching the header causes it to rebuild seccomp_bpf.

With this patch applied:

  $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
  make -s --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
          ARCH=powerpc -C ../../.. headers_install
  gcc -Wl,-no-as-needed -Wall  -lpthread  seccomp_bpf.c  -o /home/michael/build/adhoc/kselftest/seccomp/seccomp_bpf
  gcc -Wl,-no-as-needed -Wall  -lpthread  seccomp_benchmark.c  -o /home/michael/build/adhoc/kselftest/seccomp/seccomp_benchmark
  
  $ touch tools/testing/selftests/kselftest_harness.h
  
  $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
  make -s --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
          ARCH=powerpc -C ../../.. headers_install
  make[1]: Nothing to be done for 'all'.
  $


So yeah it still needs:

seccomp_bpf: ../kselftest_harness.h


cheers

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir)
  2020-03-05  0:22       ` Michael Ellerman
@ 2020-03-05  0:29         ` Shuah Khan
  0 siblings, 0 replies; 14+ messages in thread
From: Shuah Khan @ 2020-03-05  0:29 UTC (permalink / raw)
  To: Michael Ellerman, Kees Cook
  Cc: shuah, luto, wad, daniel, kafai, yhs, andriin, gregkh, tglx,
	khilman, linux-kselftest, linux-kernel, netdev, bpf, Shuah Khan

On 3/4/20 5:22 PM, Michael Ellerman wrote:
> Shuah Khan <skhan@linuxfoundation.org> writes:
>> On 3/4/20 3:42 PM, Kees Cook wrote:
>>> On Wed, Mar 04, 2020 at 03:13:33PM -0700, Shuah Khan wrote:
>>>> Fix seccomp relocatable builds. This is a simple fix to use the
>>>> right lib.mk variable TEST_GEN_PROGS for objects to leverage
>>>> lib.mk common framework for relocatable builds.
>>>>
>>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>>>> ---
>>>>    tools/testing/selftests/seccomp/Makefile | 16 +++-------------
>>>>    1 file changed, 3 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/tools/testing/selftests/seccomp/Makefile b/tools/testing/selftests/seccomp/Makefile
>>>> index 1760b3e39730..a8a9717fc1be 100644
>>>> --- a/tools/testing/selftests/seccomp/Makefile
>>>> +++ b/tools/testing/selftests/seccomp/Makefile
>>>> @@ -1,17 +1,7 @@
>>>>    # SPDX-License-Identifier: GPL-2.0
>>>> -all:
>>>> -
>>>> -include ../lib.mk
>>>> -
>>>> -.PHONY: all clean
>>>> -
>>>> -BINARIES := seccomp_bpf seccomp_benchmark
>>>>    CFLAGS += -Wl,-no-as-needed -Wall
>>>> +LDFLAGS += -lpthread
>>>>    
>>>> -seccomp_bpf: seccomp_bpf.c ../kselftest_harness.h
>>>
>>> How is the ../kselftest_harness.h dependency detected in the resulting
>>> build rules?
>>>
>>> Otherwise, looks good.
>>
>> Didn't see any problems. I will look into adding the dependency.
> 
> Before:
> 
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>      INSTALL /home/michael/build/adhoc/kselftest/usr/include
>    gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
>    gcc -Wl,-no-as-needed -Wall    seccomp_benchmark.c   -o seccomp_benchmark
>    
>    $ touch tools/testing/selftests/kselftest_harness.h
>    
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>      INSTALL /home/michael/build/adhoc/kselftest/usr/include
>    gcc -Wl,-no-as-needed -Wall  seccomp_bpf.c -lpthread -o seccomp_bpf
>    $
> 
> Note that touching the header causes it to rebuild seccomp_bpf.
> 
> With this patch applied:
> 
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make -s --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>    gcc -Wl,-no-as-needed -Wall  -lpthread  seccomp_bpf.c  -o /home/michael/build/adhoc/kselftest/seccomp/seccomp_bpf
>    gcc -Wl,-no-as-needed -Wall  -lpthread  seccomp_benchmark.c  -o /home/michael/build/adhoc/kselftest/seccomp/seccomp_benchmark
>    
>    $ touch tools/testing/selftests/kselftest_harness.h
>    
>    $ make --no-print-directory -C tools/testing/selftests/ TARGETS=seccomp
>    make -s --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>            ARCH=powerpc -C ../../.. headers_install
>    make[1]: Nothing to be done for 'all'.
>    $
> 
> 

Thanks. I realized I overlooked header dependency case.

> So yeah it still needs:
> 
> seccomp_bpf: ../kselftest_harness.h
> 
> 
Yes v2 coming up. It also has to handle OUTPUT relocation.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir
  2020-03-04 22:13 ` [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir Shuah Khan
@ 2020-03-11 22:58   ` Kevin Hilman
  2020-03-11 23:31     ` Shuah Khan
  0 siblings, 1 reply; 14+ messages in thread
From: Kevin Hilman @ 2020-03-11 22:58 UTC (permalink / raw)
  To: Shuah Khan, shuah; +Cc: Shuah Khan, mpe, linux-kselftest, linux-kernel

Shuah Khan <skhan@linuxfoundation.org> writes:

> make kselftest-all O=objdir builds create generated objects in objdir.
> This clutters the top level directory with kselftest objects. Fix it
> to create sub-directory under objdir for kselftest objects.
>
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

Only somewhat related to this patch, another problem that wasn't in your
doci is that the current O= support doesn't support relative paths.

For example, using O=/tmp/build-arm64 works, but O=build-arm64 doesn't.
Try this:

$ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 defconfig
$ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 kselftest-all
make[1]: Entering directory '/work/kernel/linux/build-arm64'
make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
	ARCH=arm64 -C ../../.. headers_install
make[4]: ../scripts/Makefile.build: No such file or directory
make[4]: *** No rule to make target '../scripts/Makefile.build'.  Stop.
Makefile:500: recipe for target 'scripts_basic' failed
make[3]: *** [scripts_basic] Error 2
Makefile:151: recipe for target 'khdr' failed
make[2]: *** [khdr] Error 2
/work/kernel/linux/Makefile:1220: recipe for target 'kselftest-all' failed
make[1]: *** [kselftest-all] Error 2
make[1]: Leaving directory '/work/kernel/linux/build-arm64'
Makefile:179: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2  

Kevin

> ---
>  tools/testing/selftests/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 6ec503912bea..cd77df3e6bb8 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -91,7 +91,7 @@ override LDFLAGS =
>  override MAKEFLAGS =
>  endif
>  
> -# Append kselftest to KBUILD_OUTPUT to avoid cluttering
> +# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
>  # KBUILD_OUTPUT with selftest objects and headers installed
>  # by selftests Makefile or lib.mk.
>  ifdef building_out_of_srctree
> @@ -99,7 +99,7 @@ override LDFLAGS =
>  endif
>  
>  ifneq ($(O),)
> -	BUILD := $(O)
> +	BUILD := $(O)/kselftest
>  else
>  	ifneq ($(KBUILD_OUTPUT),)
>  		BUILD := $(KBUILD_OUTPUT)/kselftest
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir
  2020-03-11 22:58   ` Kevin Hilman
@ 2020-03-11 23:31     ` Shuah Khan
  2020-05-15  2:27       ` Randy Dunlap
  0 siblings, 1 reply; 14+ messages in thread
From: Shuah Khan @ 2020-03-11 23:31 UTC (permalink / raw)
  To: Kevin Hilman, shuah; +Cc: mpe, linux-kselftest, linux-kernel, Shuah Khan

On 3/11/20 4:58 PM, Kevin Hilman wrote:
> Shuah Khan <skhan@linuxfoundation.org> writes:
> 
>> make kselftest-all O=objdir builds create generated objects in objdir.
>> This clutters the top level directory with kselftest objects. Fix it
>> to create sub-directory under objdir for kselftest objects.
>>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> Only somewhat related to this patch, another problem that wasn't in your
> doci is that the current O= support doesn't support relative paths.
> 

Yes I am aware of it and it is in the document as something that will
be addressed later.

"Note: Relative paths don’t work - supporting relative paths breaks 
work-flows e.g:
powerpc. Explore fix. Compile work-flows. Not planning to support at the 
moment."

> For example, using O=/tmp/build-arm64 works, but O=build-arm64 doesn't.
> Try this:
> 
> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 defconfig
> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 kselftest-all
> make[1]: Entering directory '/work/kernel/linux/build-arm64'
> make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
> 	ARCH=arm64 -C ../../.. headers_install
> make[4]: ../scripts/Makefile.build: No such file or directory
> make[4]: *** No rule to make target '../scripts/Makefile.build'.  Stop.
> Makefile:500: recipe for target 'scripts_basic' failed
> make[3]: *** [scripts_basic] Error 2
> Makefile:151: recipe for target 'khdr' failed
> make[2]: *** [khdr] Error 2
> /work/kernel/linux/Makefile:1220: recipe for target 'kselftest-all' failed
> make[1]: *** [kselftest-all] Error 2
> make[1]: Leaving directory '/work/kernel/linux/build-arm64'
> Makefile:179: recipe for target 'sub-make' failed
> make: *** [sub-make] Error 2
> 

I am looking to address build and install issues first.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir
  2020-03-11 23:31     ` Shuah Khan
@ 2020-05-15  2:27       ` Randy Dunlap
  2020-05-15 14:15         ` Shuah Khan
  0 siblings, 1 reply; 14+ messages in thread
From: Randy Dunlap @ 2020-05-15  2:27 UTC (permalink / raw)
  To: Shuah Khan, Kevin Hilman, shuah; +Cc: mpe, linux-kselftest, linux-kernel

On 3/11/20 4:31 PM, Shuah Khan wrote:
> On 3/11/20 4:58 PM, Kevin Hilman wrote:
>> Shuah Khan <skhan@linuxfoundation.org> writes:
>>
>>> make kselftest-all O=objdir builds create generated objects in objdir.
>>> This clutters the top level directory with kselftest objects. Fix it
>>> to create sub-directory under objdir for kselftest objects.
>>>
>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>>
>> Only somewhat related to this patch, another problem that wasn't in your
>> doci is that the current O= support doesn't support relative paths.
>>
> 
> Yes I am aware of it and it is in the document as something that will
> be addressed later.
> 
> "Note: Relative paths don’t work - supporting relative paths breaks work-flows e.g:
> powerpc. Explore fix. Compile work-flows. Not planning to support at the moment."

Hi,
Sorry to be dense but where is this documented (as quoted above)?

Thanks.

>> For example, using O=/tmp/build-arm64 works, but O=build-arm64 doesn't.
>> Try this:
>>
>> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 defconfig
>> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 kselftest-all
>> make[1]: Entering directory '/work/kernel/linux/build-arm64'
>> make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>>     ARCH=arm64 -C ../../.. headers_install
>> make[4]: ../scripts/Makefile.build: No such file or directory
>> make[4]: *** No rule to make target '../scripts/Makefile.build'.  Stop.
>> Makefile:500: recipe for target 'scripts_basic' failed
>> make[3]: *** [scripts_basic] Error 2
>> Makefile:151: recipe for target 'khdr' failed
>> make[2]: *** [khdr] Error 2
>> /work/kernel/linux/Makefile:1220: recipe for target 'kselftest-all' failed
>> make[1]: *** [kselftest-all] Error 2
>> make[1]: Leaving directory '/work/kernel/linux/build-arm64'
>> Makefile:179: recipe for target 'sub-make' failed
>> make: *** [sub-make] Error 2
>>
> 
> I am looking to address build and install issues first.
> 
> thanks,
> -- Shuah


-- 
~Randy


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir
  2020-05-15  2:27       ` Randy Dunlap
@ 2020-05-15 14:15         ` Shuah Khan
  0 siblings, 0 replies; 14+ messages in thread
From: Shuah Khan @ 2020-05-15 14:15 UTC (permalink / raw)
  To: Randy Dunlap, Kevin Hilman, shuah
  Cc: mpe, linux-kselftest, linux-kernel, Shuah Khan

On 5/14/20 8:27 PM, Randy Dunlap wrote:
> On 3/11/20 4:31 PM, Shuah Khan wrote:
>> On 3/11/20 4:58 PM, Kevin Hilman wrote:
>>> Shuah Khan <skhan@linuxfoundation.org> writes:
>>>
>>>> make kselftest-all O=objdir builds create generated objects in objdir.
>>>> This clutters the top level directory with kselftest objects. Fix it
>>>> to create sub-directory under objdir for kselftest objects.
>>>>
>>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>>>
>>> Only somewhat related to this patch, another problem that wasn't in your
>>> doci is that the current O= support doesn't support relative paths.
>>>
>>
>> Yes I am aware of it and it is in the document as something that will
>> be addressed later.
>>
>> "Note: Relative paths don’t work - supporting relative paths breaks work-flows e.g:
>> powerpc. Explore fix. Compile work-flows. Not planning to support at the moment."
> 

I attempted to fix it once and had to revert the patch. This relative
problem needs to be fixed and being tracked as a bug.

>>
>> I am looking to address build and install issues first.
>>

As I said above, there were higher priority test build and install
failures in cross-build and native build use-cases when I made this
call to prioritize fixing them first. I fixed all the known issues.

As of Linux 5.7-rc5 all of the know issues related test build and
install failures have been fixed.

With tha done, it is time to work on the relative path fix. I have
my reverted patch to start with and get it to work with the
workflows so it doesn't break them.

I also have the following patch you gave me as reference for fixing
the relative path problem:

https://lore.kernel.org/lkml/158351957799.3363.15269768530697526765.stgit@devnote2/

In any case, based on my previous experience fixing this problem,
I plan to take the fix in rc1 to allow enough time to fix any
problems that show up. It will be fixed for sure.

Hope this helps addresses any concerns you may have on whether or
not this problem will be fixed.

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-05-15 14:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-04 22:13 [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan
2020-03-04 22:13 ` [PATCH 1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir Shuah Khan
2020-03-11 22:58   ` Kevin Hilman
2020-03-11 23:31     ` Shuah Khan
2020-05-15  2:27       ` Randy Dunlap
2020-05-15 14:15         ` Shuah Khan
2020-03-04 22:13 ` [PATCH 2/4] selftests: Fix seccomp to support relocatable build (O=objdir) Shuah Khan
2020-03-04 22:42   ` Kees Cook
2020-03-04 23:15     ` Shuah Khan
2020-03-05  0:22       ` Michael Ellerman
2020-03-05  0:29         ` Shuah Khan
2020-03-04 22:13 ` [PATCH 3/4] selftests: android: ion: Fix ionmap_test compile error Shuah Khan
2020-03-04 22:13 ` [PATCH 4/4] selftests: android: Fix custom install from skipping test progs Shuah Khan
2020-03-04 23:09 ` [PATCH 0/4] Kselftest integration into Kernel CI - Part 1 Shuah Khan

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).