bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [GIT PULL] Kselftest update for Linux 5.2-rc1
       [not found] <9b434125-44b6-0e83-4f70-d1fd28752407@linuxfoundation.org>
@ 2019-05-09 22:20 ` Alexei Starovoitov
  2019-05-09 22:40   ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2019-05-09 22:20 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Linus Torvalds, shuah, linux-kernel, netdev, bpf, daniel, davem

On Mon, May 06, 2019 at 10:56:56AM -0600, Shuah Khan wrote:
> Hi Linus,
> 
> Please pull the following Kselftest update for Linux 5.2-rc1
> 
> This Kselftest update for Linux 5.2-rc1 consists of
> 
> - fixes to seccomp test, and kselftest framework
> - cleanups to remove duplicate header defines
> - fixes to efivarfs "make clean" target
> - cgroup cleanup path
> - Moving the IMA kexec_load selftest to selftests/kexec work from
>   Mimi Johar and Petr Vorel
> - A framework to kselftest for writing kernel test modules addition
>   from Tobin C. Harding
> 
> diff is attached.
> 
> thanks,
> -- Shuah
> 
> 
> ----------------------------------------------------------------
> The following changes since commit 15ade5d2e7775667cf191cf2f94327a4889f8b9d:
> 
>   Linux 5.1-rc4 (2019-04-07 14:09:59 -1000)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
> tags/linux-kselftest-5.2-rc1
> 
> for you to fetch changes up to d917fb876f6eaeeea8a2b620d2a266ce26372f4d:
> 
>   selftests: build and run gpio when output directory is the src dir
> (2019-04-22 17:02:26 -0600)
> 
> ----------------------------------------------------------------
> linux-kselftest-5.2-rc1
> 
> This Kselftest update for Linux 5.2-rc1 consists of
> 
> - fixes to seccomp test, and kselftest framework
> - cleanups to remove duplicate header defines
> - fixes to efivarfs "make clean" target
> - cgroup cleanup path
> - Moving the IMA kexec_load selftest to selftests/kexec work from
>   Mimi Johar and Petr Vorel
> - A framework to kselftest for writing kernel test modules addition
>   from Tobin C. Harding
> 
> ----------------------------------------------------------------
> Kees Cook (3):
>       selftests/seccomp: Handle namespace failures gracefully
>       selftests/harness: Add 30 second timeout per test
>       selftests/ipc: Fix msgque compiler warnings
> 
> Mathieu Desnoyers (1):
>       rseq/selftests: Adapt number of threads to the number of detected cpus
> 
> Mimi Zohar (9):
>       selftests/kexec: move the IMA kexec_load selftest to selftests/kexec
>       selftests/kexec: cleanup the kexec selftest
>       selftests/kexec: define a set of common functions
>       selftests/kexec: define common logging functions
>       selftests/kexec: define "require_root_privileges"
>       selftests/kexec: kexec_file_load syscall test
>       selftests/kexec: check kexec_load and kexec_file_load are enabled
>       selftests/kexec: make kexec_load test independent of IMA being enabled
>       selftests/kexec: update get_secureboot_mode
> 
> Petr Vorel (1):
>       selftests/kexec: Add missing '=y' to config options
> 
> Po-Hsu Lin (1):
>       selftests/efivarfs: clean up test files from test_create*()
> 
> Roman Gushchin (1):
>       selftests: cgroup: fix cleanup path in test_memcg_subtree_control()
> 
> Sabyasachi Gupta (4):
>       selftest/x86/mpx-dig.c: Remove duplicate header
>       selftest/timers: Remove duplicate header
>       selftest/rseq: Remove duplicate header
>       selftest/gpio: Remove duplicate header
> 
> Shuah Khan (2):
>       selftests: fix headers_install circular dependency

Shuah,

the commit 8ce72dc32578 ("selftests: fix headers_install circular dependency")
broke our build/test workflow, since it added:
  ifneq ($(KBUILD_OUTPUT),)
          OUTPUT := $(KBUILD_OUTPUT)
  else

which means that all of selftests/bpf artifacts are now going into
main build directory cluttering it with all sorts of .o, generated files
and executables.
The end result is humans and scripts can no longer find tests.

For now I hacked it as:
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 5979fdc4f36c..caecec7aebde 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -6,12 +6,8 @@ ifeq (0,$(MAKELEVEL))
     ifneq ($(O),)
        OUTPUT := $(O)
     else
-       ifneq ($(KBUILD_OUTPUT),)
-               OUTPUT := $(KBUILD_OUTPUT)
-       else
-               OUTPUT := $(shell pwd)
-               DEFAULT_INSTALL_HDR_PATH := 1
-       endif
+       OUTPUT := $(shell pwd)
+       DEFAULT_INSTALL_HDR_PATH := 1
     endif
 endif

bpf developers are doing "cd tools/testing/selftests/bpf; make; ./test_verifier; ..."
while KBUILD_OUTPUT is also set.
I don't quite get this 'circular dependency' issue that your commit suppose to address
but please fix it differently, so bpf developer's workflow is restored and buildbots work again.
People and scripts depend on it.
It's even described in Documentation/bpf/bpf_devel_QA.rst

Thanks


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

* Re: [GIT PULL] Kselftest update for Linux 5.2-rc1
  2019-05-09 22:20 ` [GIT PULL] Kselftest update for Linux 5.2-rc1 Alexei Starovoitov
@ 2019-05-09 22:40   ` Shuah Khan
  2019-05-10  1:42     ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2019-05-09 22:40 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Linus Torvalds, shuah, linux-kernel, netdev, bpf, daniel, davem,
	Shuah Khan

On 5/9/19 4:20 PM, Alexei Starovoitov wrote:
> On Mon, May 06, 2019 at 10:56:56AM -0600, Shuah Khan wrote:
>> Hi Linus,
>>
>> Please pull the following Kselftest update for Linux 5.2-rc1
>>
>> This Kselftest update for Linux 5.2-rc1 consists of
>>
>> - fixes to seccomp test, and kselftest framework
>> - cleanups to remove duplicate header defines
>> - fixes to efivarfs "make clean" target
>> - cgroup cleanup path
>> - Moving the IMA kexec_load selftest to selftests/kexec work from
>>    Mimi Johar and Petr Vorel
>> - A framework to kselftest for writing kernel test modules addition
>>    from Tobin C. Harding
>>
>> diff is attached.
>>
>> thanks,
>> -- Shuah
>>
>>
>> ----------------------------------------------------------------
>> The following changes since commit 15ade5d2e7775667cf191cf2f94327a4889f8b9d:
>>
>>    Linux 5.1-rc4 (2019-04-07 14:09:59 -1000)
>>
>> are available in the Git repository at:
>>
>>    git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
>> tags/linux-kselftest-5.2-rc1
>>
>> for you to fetch changes up to d917fb876f6eaeeea8a2b620d2a266ce26372f4d:
>>
>>    selftests: build and run gpio when output directory is the src dir
>> (2019-04-22 17:02:26 -0600)
>>
>> ----------------------------------------------------------------
>> linux-kselftest-5.2-rc1
>>
>> This Kselftest update for Linux 5.2-rc1 consists of
>>
>> - fixes to seccomp test, and kselftest framework
>> - cleanups to remove duplicate header defines
>> - fixes to efivarfs "make clean" target
>> - cgroup cleanup path
>> - Moving the IMA kexec_load selftest to selftests/kexec work from
>>    Mimi Johar and Petr Vorel
>> - A framework to kselftest for writing kernel test modules addition
>>    from Tobin C. Harding
>>
>> ----------------------------------------------------------------
>> Kees Cook (3):
>>        selftests/seccomp: Handle namespace failures gracefully
>>        selftests/harness: Add 30 second timeout per test
>>        selftests/ipc: Fix msgque compiler warnings
>>
>> Mathieu Desnoyers (1):
>>        rseq/selftests: Adapt number of threads to the number of detected cpus
>>
>> Mimi Zohar (9):
>>        selftests/kexec: move the IMA kexec_load selftest to selftests/kexec
>>        selftests/kexec: cleanup the kexec selftest
>>        selftests/kexec: define a set of common functions
>>        selftests/kexec: define common logging functions
>>        selftests/kexec: define "require_root_privileges"
>>        selftests/kexec: kexec_file_load syscall test
>>        selftests/kexec: check kexec_load and kexec_file_load are enabled
>>        selftests/kexec: make kexec_load test independent of IMA being enabled
>>        selftests/kexec: update get_secureboot_mode
>>
>> Petr Vorel (1):
>>        selftests/kexec: Add missing '=y' to config options
>>
>> Po-Hsu Lin (1):
>>        selftests/efivarfs: clean up test files from test_create*()
>>
>> Roman Gushchin (1):
>>        selftests: cgroup: fix cleanup path in test_memcg_subtree_control()
>>
>> Sabyasachi Gupta (4):
>>        selftest/x86/mpx-dig.c: Remove duplicate header
>>        selftest/timers: Remove duplicate header
>>        selftest/rseq: Remove duplicate header
>>        selftest/gpio: Remove duplicate header
>>
>> Shuah Khan (2):
>>        selftests: fix headers_install circular dependency
> 
> Shuah,
> 
> the commit 8ce72dc32578 ("selftests: fix headers_install circular dependency")
> broke our build/test workflow, since it added:
>    ifneq ($(KBUILD_OUTPUT),)
>            OUTPUT := $(KBUILD_OUTPUT)
>    else
> 
> which means that all of selftests/bpf artifacts are now going into
> main build directory cluttering it with all sorts of .o, generated files
> and executables.
> The end result is humans and scripts can no longer find tests.
> 
> For now I hacked it as:
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 5979fdc4f36c..caecec7aebde 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -6,12 +6,8 @@ ifeq (0,$(MAKELEVEL))
>       ifneq ($(O),)
>          OUTPUT := $(O)
>       else
> -       ifneq ($(KBUILD_OUTPUT),)
> -               OUTPUT := $(KBUILD_OUTPUT)
> -       else
> -               OUTPUT := $(shell pwd)
> -               DEFAULT_INSTALL_HDR_PATH := 1
> -       endif
> +       OUTPUT := $(shell pwd)
> +       DEFAULT_INSTALL_HDR_PATH := 1
>       endif
>   endif
> 
> bpf developers are doing "cd tools/testing/selftests/bpf; make; ./test_verifier; ..."
> while KBUILD_OUTPUT is also set.
Sorry about that. I tested several use-cases, and missed this one. :(
This patch was in next for a while before I sent the pull request.

> I don't quite get this 'circular dependency' issue that your commit suppose to address
> but please fix it differently, so bpf developer's workflow is restored and buildbots work again.
> People and scripts depend on it.
> It's even described in Documentation/bpf/bpf_devel_QA.rst
> 

You won't see the circular dependency with your use-case. I will try
to get the fix in.

thanks,
-- Shuah




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

* Re: [GIT PULL] Kselftest update for Linux 5.2-rc1
  2019-05-09 22:40   ` Shuah Khan
@ 2019-05-10  1:42     ` Shuah Khan
  2019-05-10  2:17       ` Alexei Starovoitov
  0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2019-05-10  1:42 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Linus Torvalds, shuah, linux-kernel, netdev, bpf, daniel, davem,
	Shuah Khan

On 5/9/19 4:40 PM, Shuah Khan wrote:
> On 5/9/19 4:20 PM, Alexei Starovoitov wrote:
>> On Mon, May 06, 2019 at 10:56:56AM -0600, Shuah Khan wrote:
>>> Hi Linus,
>>>
>>> Please pull the following Kselftest update for Linux 5.2-rc1
>>>
>>> This Kselftest update for Linux 5.2-rc1 consists of
>>>
>>> - fixes to seccomp test, and kselftest framework
>>> - cleanups to remove duplicate header defines
>>> - fixes to efivarfs "make clean" target
>>> - cgroup cleanup path
>>> - Moving the IMA kexec_load selftest to selftests/kexec work from
>>>    Mimi Johar and Petr Vorel
>>> - A framework to kselftest for writing kernel test modules addition
>>>    from Tobin C. Harding
>>>
>>> diff is attached.
>>>
>>> thanks,
>>> -- Shuah
>>>
>>>
>>> ----------------------------------------------------------------
>>> The following changes since commit 
>>> 15ade5d2e7775667cf191cf2f94327a4889f8b9d:
>>>
>>>    Linux 5.1-rc4 (2019-04-07 14:09:59 -1000)
>>>
>>> are available in the Git repository at:
>>>
>>>    git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
>>> tags/linux-kselftest-5.2-rc1
>>>
>>> for you to fetch changes up to d917fb876f6eaeeea8a2b620d2a266ce26372f4d:
>>>
>>>    selftests: build and run gpio when output directory is the src dir
>>> (2019-04-22 17:02:26 -0600)
>>>
>>> ----------------------------------------------------------------
>>> linux-kselftest-5.2-rc1
>>>
>>> This Kselftest update for Linux 5.2-rc1 consists of
>>>
>>> - fixes to seccomp test, and kselftest framework
>>> - cleanups to remove duplicate header defines
>>> - fixes to efivarfs "make clean" target
>>> - cgroup cleanup path
>>> - Moving the IMA kexec_load selftest to selftests/kexec work from
>>>    Mimi Johar and Petr Vorel
>>> - A framework to kselftest for writing kernel test modules addition
>>>    from Tobin C. Harding
>>>
>>> ----------------------------------------------------------------
>>> Kees Cook (3):
>>>        selftests/seccomp: Handle namespace failures gracefully
>>>        selftests/harness: Add 30 second timeout per test
>>>        selftests/ipc: Fix msgque compiler warnings
>>>
>>> Mathieu Desnoyers (1):
>>>        rseq/selftests: Adapt number of threads to the number of 
>>> detected cpus
>>>
>>> Mimi Zohar (9):
>>>        selftests/kexec: move the IMA kexec_load selftest to 
>>> selftests/kexec
>>>        selftests/kexec: cleanup the kexec selftest
>>>        selftests/kexec: define a set of common functions
>>>        selftests/kexec: define common logging functions
>>>        selftests/kexec: define "require_root_privileges"
>>>        selftests/kexec: kexec_file_load syscall test
>>>        selftests/kexec: check kexec_load and kexec_file_load are enabled
>>>        selftests/kexec: make kexec_load test independent of IMA being 
>>> enabled
>>>        selftests/kexec: update get_secureboot_mode
>>>
>>> Petr Vorel (1):
>>>        selftests/kexec: Add missing '=y' to config options
>>>
>>> Po-Hsu Lin (1):
>>>        selftests/efivarfs: clean up test files from test_create*()
>>>
>>> Roman Gushchin (1):
>>>        selftests: cgroup: fix cleanup path in 
>>> test_memcg_subtree_control()
>>>
>>> Sabyasachi Gupta (4):
>>>        selftest/x86/mpx-dig.c: Remove duplicate header
>>>        selftest/timers: Remove duplicate header
>>>        selftest/rseq: Remove duplicate header
>>>        selftest/gpio: Remove duplicate header
>>>
>>> Shuah Khan (2):
>>>        selftests: fix headers_install circular dependency
>>
>> Shuah,
>>
>> the commit 8ce72dc32578 ("selftests: fix headers_install circular 
>> dependency")
>> broke our build/test workflow, since it added:
>>    ifneq ($(KBUILD_OUTPUT),)
>>            OUTPUT := $(KBUILD_OUTPUT)
>>    else
>>
>> which means that all of selftests/bpf artifacts are now going into
>> main build directory cluttering it with all sorts of .o, generated files
>> and executables.
>> The end result is humans and scripts can no longer find tests.

bpf build fails with the above commit. However, even without it, I am
seeing bpf objects going to tools/testing/selftests/bpf

I reverted the commit and ran your use-case:

export KBUILD_OUTPUT=/tmp/kselftest_bpf
cd tools/testing/selftests/bpf/
make
./test_verifier

I see bpf objects in tools/testing/selftests/bpf/ and I can run the
test.

What am I missing? The only way ./test_verifier would work is if
test_verifier is in tools/testing/selftests/bpf/

I am curious what you are actually seeing with this commit?

With the 8ce72dc32578

What I see is - if KBUILD_OUTPUT directory is missing, then the make
just fails and the following diff fixes that problem:

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 098dd0065fb1..074ce7d26a9d 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -13,6 +13,7 @@ ifeq (0,$(MAKELEVEL))
                 DEFAULT_INSTALL_HDR_PATH := 1
         endif
      endif
+$(shell mkdir -p $(OUTPUT))
  endif
  selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))


Now when I run

cd tools/testing/selftests/bpf/
make
./test_verifier

bpf objects end up in /tmp/kselftest_bpf

which is what should happen when KBUILD_OUPUT is set.

But now ./test_verifier won't work, because it isn't in the
cd tools/testing/selftests/bpf/

Could it be that with  commit 8ce72dc32578, bpf objects are ending
up in the KBUILD_OUPUT dir and ./test_verifier won't work because
your workflow is looking for it in tools/testing/selftests/bpf/?

If this is the case, then the workfolow will be to run the
test_verifier from KBUILD_OUPUT dir.

I am trying understand the problem so I can fix it. I know I need
the above diff.


thanks,
-- Shuah



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

* Re: [GIT PULL] Kselftest update for Linux 5.2-rc1
  2019-05-10  1:42     ` Shuah Khan
@ 2019-05-10  2:17       ` Alexei Starovoitov
  2019-05-11  2:53         ` Shuah Khan
  0 siblings, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2019-05-10  2:17 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Linus Torvalds, shuah, linux-kernel, netdev, bpf, daniel, davem

On Thu, May 09, 2019 at 07:42:09PM -0600, Shuah Khan wrote:
> On 5/9/19 4:40 PM, Shuah Khan wrote:
> > On 5/9/19 4:20 PM, Alexei Starovoitov wrote:
> > > On Mon, May 06, 2019 at 10:56:56AM -0600, Shuah Khan wrote:
> > > > Hi Linus,
> > > > 
> > > > Please pull the following Kselftest update for Linux 5.2-rc1
> > > > 
> > > > This Kselftest update for Linux 5.2-rc1 consists of
> > > > 
> > > > - fixes to seccomp test, and kselftest framework
> > > > - cleanups to remove duplicate header defines
> > > > - fixes to efivarfs "make clean" target
> > > > - cgroup cleanup path
> > > > - Moving the IMA kexec_load selftest to selftests/kexec work from
> > > >    Mimi Johar and Petr Vorel
> > > > - A framework to kselftest for writing kernel test modules addition
> > > >    from Tobin C. Harding
> > > > 
> > > > diff is attached.
> > > > 
> > > > thanks,
> > > > -- Shuah
> > > > 
> > > > 
> > > > ----------------------------------------------------------------
> > > > The following changes since commit
> > > > 15ade5d2e7775667cf191cf2f94327a4889f8b9d:
> > > > 
> > > >    Linux 5.1-rc4 (2019-04-07 14:09:59 -1000)
> > > > 
> > > > are available in the Git repository at:
> > > > 
> > > >    git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
> > > > tags/linux-kselftest-5.2-rc1
> > > > 
> > > > for you to fetch changes up to d917fb876f6eaeeea8a2b620d2a266ce26372f4d:
> > > > 
> > > >    selftests: build and run gpio when output directory is the src dir
> > > > (2019-04-22 17:02:26 -0600)
> > > > 
> > > > ----------------------------------------------------------------
> > > > linux-kselftest-5.2-rc1
> > > > 
> > > > This Kselftest update for Linux 5.2-rc1 consists of
> > > > 
> > > > - fixes to seccomp test, and kselftest framework
> > > > - cleanups to remove duplicate header defines
> > > > - fixes to efivarfs "make clean" target
> > > > - cgroup cleanup path
> > > > - Moving the IMA kexec_load selftest to selftests/kexec work from
> > > >    Mimi Johar and Petr Vorel
> > > > - A framework to kselftest for writing kernel test modules addition
> > > >    from Tobin C. Harding
> > > > 
> > > > ----------------------------------------------------------------
> > > > Kees Cook (3):
> > > >        selftests/seccomp: Handle namespace failures gracefully
> > > >        selftests/harness: Add 30 second timeout per test
> > > >        selftests/ipc: Fix msgque compiler warnings
> > > > 
> > > > Mathieu Desnoyers (1):
> > > >        rseq/selftests: Adapt number of threads to the number of
> > > > detected cpus
> > > > 
> > > > Mimi Zohar (9):
> > > >        selftests/kexec: move the IMA kexec_load selftest to
> > > > selftests/kexec
> > > >        selftests/kexec: cleanup the kexec selftest
> > > >        selftests/kexec: define a set of common functions
> > > >        selftests/kexec: define common logging functions
> > > >        selftests/kexec: define "require_root_privileges"
> > > >        selftests/kexec: kexec_file_load syscall test
> > > >        selftests/kexec: check kexec_load and kexec_file_load are enabled
> > > >        selftests/kexec: make kexec_load test independent of IMA
> > > > being enabled
> > > >        selftests/kexec: update get_secureboot_mode
> > > > 
> > > > Petr Vorel (1):
> > > >        selftests/kexec: Add missing '=y' to config options
> > > > 
> > > > Po-Hsu Lin (1):
> > > >        selftests/efivarfs: clean up test files from test_create*()
> > > > 
> > > > Roman Gushchin (1):
> > > >        selftests: cgroup: fix cleanup path in
> > > > test_memcg_subtree_control()
> > > > 
> > > > Sabyasachi Gupta (4):
> > > >        selftest/x86/mpx-dig.c: Remove duplicate header
> > > >        selftest/timers: Remove duplicate header
> > > >        selftest/rseq: Remove duplicate header
> > > >        selftest/gpio: Remove duplicate header
> > > > 
> > > > Shuah Khan (2):
> > > >        selftests: fix headers_install circular dependency
> > > 
> > > Shuah,
> > > 
> > > the commit 8ce72dc32578 ("selftests: fix headers_install circular
> > > dependency")
> > > broke our build/test workflow, since it added:
> > >    ifneq ($(KBUILD_OUTPUT),)
> > >            OUTPUT := $(KBUILD_OUTPUT)
> > >    else
> > > 
> > > which means that all of selftests/bpf artifacts are now going into
> > > main build directory cluttering it with all sorts of .o, generated files
> > > and executables.
> > > The end result is humans and scripts can no longer find tests.
> 
> bpf build fails with the above commit. However, even without it, I am
> seeing bpf objects going to tools/testing/selftests/bpf
> 
> I reverted the commit and ran your use-case:
> 
> export KBUILD_OUTPUT=/tmp/kselftest_bpf
> cd tools/testing/selftests/bpf/
> make
> ./test_verifier
> 
> I see bpf objects in tools/testing/selftests/bpf/ and I can run the
> test.
> 
> What am I missing? The only way ./test_verifier would work is if
> test_verifier is in tools/testing/selftests/bpf/

That's the point. All artifacts should be in tools/testing/selftests/bpf/
if 'make' was done there regardless of KBUILD_OUTPUT.

> I am curious what you are actually seeing with this commit?
> 
> With the 8ce72dc32578
> 
> What I see is - if KBUILD_OUTPUT directory is missing, then the make
> just fails and the following diff fixes that problem:

KBUILD_OUTPUT is a valid dir where kernel build goes.

> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 098dd0065fb1..074ce7d26a9d 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -13,6 +13,7 @@ ifeq (0,$(MAKELEVEL))
>                 DEFAULT_INSTALL_HDR_PATH := 1
>         endif
>      endif
> +$(shell mkdir -p $(OUTPUT))

makefile should not create the dir this automatically.

>  endif
>  selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
> 
> 
> Now when I run
> 
> cd tools/testing/selftests/bpf/
> make
> ./test_verifier
> 
> bpf objects end up in /tmp/kselftest_bpf
> 
> which is what should happen when KBUILD_OUPUT is set.

No. KBUILD_OUPUT must be ignored while building selftests/bpf.
Just like it's ignored when samples/bpf/ are build.
People do 'cd samples/bpf; make; run stuff'
and they do the same 'cd .../selftests/bpf; make; run'


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

* Re: [GIT PULL] Kselftest update for Linux 5.2-rc1
  2019-05-10  2:17       ` Alexei Starovoitov
@ 2019-05-11  2:53         ` Shuah Khan
  0 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2019-05-11  2:53 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: Linus Torvalds, shuah, linux-kernel, netdev, bpf, daniel, davem, skhan

On 5/9/19 8:17 PM, Alexei Starovoitov wrote:
> On Thu, May 09, 2019 at 07:42:09PM -0600, Shuah Khan wrote:
>> On 5/9/19 4:40 PM, Shuah Khan wrote:
>>> On 5/9/19 4:20 PM, Alexei Starovoitov wrote:
>>>> On Mon, May 06, 2019 at 10:56:56AM -0600, Shuah Khan wrote:
>>>>> Hi Linus,
>>>>>
>>>>> Please pull the following Kselftest update for Linux 5.2-rc1
>>>>>
>>>>> This Kselftest update for Linux 5.2-rc1 consists of
>>>>>
>>>>> - fixes to seccomp test, and kselftest framework
>>>>> - cleanups to remove duplicate header defines
>>>>> - fixes to efivarfs "make clean" target
>>>>> - cgroup cleanup path
>>>>> - Moving the IMA kexec_load selftest to selftests/kexec work from
>>>>>     Mimi Johar and Petr Vorel
>>>>> - A framework to kselftest for writing kernel test modules addition
>>>>>     from Tobin C. Harding
>>>>>
>>>>> diff is attached.
>>>>>
>>>>> thanks,
>>>>> -- Shuah
>>>>>
>>>>>
>>>>> ----------------------------------------------------------------
>>>>> The following changes since commit
>>>>> 15ade5d2e7775667cf191cf2f94327a4889f8b9d:
>>>>>
>>>>>     Linux 5.1-rc4 (2019-04-07 14:09:59 -1000)
>>>>>
>>>>> are available in the Git repository at:
>>>>>
>>>>>     git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
>>>>> tags/linux-kselftest-5.2-rc1
>>>>>
>>>>> for you to fetch changes up to d917fb876f6eaeeea8a2b620d2a266ce26372f4d:
>>>>>
>>>>>     selftests: build and run gpio when output directory is the src dir
>>>>> (2019-04-22 17:02:26 -0600)
>>>>>
>>>>> ----------------------------------------------------------------
>>>>> linux-kselftest-5.2-rc1
>>>>>
>>>>> This Kselftest update for Linux 5.2-rc1 consists of
>>>>>
>>>>> - fixes to seccomp test, and kselftest framework
>>>>> - cleanups to remove duplicate header defines
>>>>> - fixes to efivarfs "make clean" target
>>>>> - cgroup cleanup path
>>>>> - Moving the IMA kexec_load selftest to selftests/kexec work from
>>>>>     Mimi Johar and Petr Vorel
>>>>> - A framework to kselftest for writing kernel test modules addition
>>>>>     from Tobin C. Harding
>>>>>
>>>>> ----------------------------------------------------------------
>>>>> Kees Cook (3):
>>>>>         selftests/seccomp: Handle namespace failures gracefully
>>>>>         selftests/harness: Add 30 second timeout per test
>>>>>         selftests/ipc: Fix msgque compiler warnings
>>>>>
>>>>> Mathieu Desnoyers (1):
>>>>>         rseq/selftests: Adapt number of threads to the number of
>>>>> detected cpus
>>>>>
>>>>> Mimi Zohar (9):
>>>>>         selftests/kexec: move the IMA kexec_load selftest to
>>>>> selftests/kexec
>>>>>         selftests/kexec: cleanup the kexec selftest
>>>>>         selftests/kexec: define a set of common functions
>>>>>         selftests/kexec: define common logging functions
>>>>>         selftests/kexec: define "require_root_privileges"
>>>>>         selftests/kexec: kexec_file_load syscall test
>>>>>         selftests/kexec: check kexec_load and kexec_file_load are enabled
>>>>>         selftests/kexec: make kexec_load test independent of IMA
>>>>> being enabled
>>>>>         selftests/kexec: update get_secureboot_mode
>>>>>
>>>>> Petr Vorel (1):
>>>>>         selftests/kexec: Add missing '=y' to config options
>>>>>
>>>>> Po-Hsu Lin (1):
>>>>>         selftests/efivarfs: clean up test files from test_create*()
>>>>>
>>>>> Roman Gushchin (1):
>>>>>         selftests: cgroup: fix cleanup path in
>>>>> test_memcg_subtree_control()
>>>>>
>>>>> Sabyasachi Gupta (4):
>>>>>         selftest/x86/mpx-dig.c: Remove duplicate header
>>>>>         selftest/timers: Remove duplicate header
>>>>>         selftest/rseq: Remove duplicate header
>>>>>         selftest/gpio: Remove duplicate header
>>>>>
>>>>> Shuah Khan (2):
>>>>>         selftests: fix headers_install circular dependency
>>>>
>>>> Shuah,
>>>>
>>>> the commit 8ce72dc32578 ("selftests: fix headers_install circular
>>>> dependency")
>>>> broke our build/test workflow, since it added:
>>>>     ifneq ($(KBUILD_OUTPUT),)
>>>>             OUTPUT := $(KBUILD_OUTPUT)
>>>>     else
>>>>
>>>> which means that all of selftests/bpf artifacts are now going into
>>>> main build directory cluttering it with all sorts of .o, generated files
>>>> and executables.
>>>> The end result is humans and scripts can no longer find tests.
>>
>> bpf build fails with the above commit. However, even without it, I am
>> seeing bpf objects going to tools/testing/selftests/bpf
>>
>> I reverted the commit and ran your use-case:
>>
>> export KBUILD_OUTPUT=/tmp/kselftest_bpf
>> cd tools/testing/selftests/bpf/
>> make
>> ./test_verifier
>>
>> I see bpf objects in tools/testing/selftests/bpf/ and I can run the
>> test.
>>
>> What am I missing? The only way ./test_verifier would work is if
>> test_verifier is in tools/testing/selftests/bpf/
> 
> That's the point. All artifacts should be in tools/testing/selftests/bpf/
> if 'make' was done there regardless of KBUILD_OUTPUT.
> 

Alexei,

Thanks for reporting the problem. Fix is on the way. Please test and let
me know if it works for you. I verified bpf build/test workflow with
and without KBUILD_OUTPUT set.

thanks,
-- Shuah

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

end of thread, other threads:[~2019-05-11  2:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9b434125-44b6-0e83-4f70-d1fd28752407@linuxfoundation.org>
2019-05-09 22:20 ` [GIT PULL] Kselftest update for Linux 5.2-rc1 Alexei Starovoitov
2019-05-09 22:40   ` Shuah Khan
2019-05-10  1:42     ` Shuah Khan
2019-05-10  2:17       ` Alexei Starovoitov
2019-05-11  2:53         ` 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).