Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590604 > unrolled thread

Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests

Started byShuah Khan <shuahkh@osg.samsung.com>
First post2017-03-01 21:00 +0100
Last post2017-03-02 15:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run  tests Shuah Khan <shuahkh@osg.samsung.com> - 2017-03-01 21:00 +0100
    Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests Michael Ellerman <mpe@ellerman.id.au> - 2017-03-02 08:00 +0100
      Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run  tests Shuah Khan <shuahkh@osg.samsung.com> - 2017-03-02 15:50 +0100

#1590604 — Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-03-01 21:00 +0100
SubjectRe: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests
Message-ID<tgizM-7J6-7@gated-at.bofh.it>
On 02/13/2017 07:09 PM, Michael Ellerman wrote:
> Michael Ellerman <mpe@ellerman.id.au> writes:
> 
>> In commit 88baa78d1f31 ("selftests: remove duplicated all and clean
>> target"), the "all" target was removed from individual Makefiles and
>> added to lib.mk.
>>
>> However the "all" target was added to lib.mk *after* the existing
>> "runtests" target. This means "runtests" becomes the first (default)
>> target for most of our Makefiles.
> ...
>>
>> Fix it by moving the "all" target to the start of lib.mk, making it the
>> default target.
>>
>> Fixes: 88baa78d1f31 ("selftests: remove duplicated all and clean target")
>> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> 
> Hi Shuah,
> 
> Can you please merge this series into linux-next?
> 
> The selftests are badly broken otherwise.
> 
> cheers
> 

Hi Bamovar,

Your original series badly broke the selftest build. I can no longer
build individual tests. For example:

cd breakpoints/
shuah@shuah-XPS-13-9350:/lkml/linux_4.11/tools/testing/selftests/breakpoints$ make
gcc     breakpoint_test.c  -o /breakpoint_test
/usr/bin/ld: cannot open output file /breakpoint_test: Permission denied
collect2: error: ld returned 1 exit status
../lib.mk:54: recipe for target '/breakpoint_test' failed
make: *** [/breakpoint_test] Error 1

commit a8ba798bc8ec663cf02e80b0dd770324de9bafd9
Author: bamvor.zhangjian@huawei.com <bamvor.zhangjian@huawei.com>
Date:   Tue Nov 29 19:55:52 2016 +0800

    selftests: enable O and KBUILD_OUTPUT

I believe the above patch is one of the suspects. Michael fixed
some of the problems in this patch and others he sent.

At the moment individual tests will not build.
tools/testing/selftests/x86$ make
Makefile:44: warning: overriding recipe for target 'clean'
../lib.mk:51: warning: ignoring old recipe for target 'clean'
gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
/usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied
collect2: error: ld returned 1 exit status
Makefile:50: recipe for target '/single_step_syscall_64' failed
make: *** [/single_step_syscall_64] Error 1


My guess is OUTPUT doesn't resolve in individual builds from the test directory.
We have to get this fixed for 4.11-rc1

Simply Reverting a8ba798bc8ec663cf02e80b0dd770324de9bafd9 doesn't work.
Michael's patches depend on this. So anyway, please let me know if you
can fix this quickly. I am going to be trying a few things today as well.

thanks,
-- Shuah

[toc] | [next] | [standalone]


#1590871 — Re: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-03-02 08:00 +0100
SubjectRe: [PATCH 1/5] selftests: Fix selftests build to just build, not run tests
Message-ID<tgsSu-6RL-3@gated-at.bofh.it>
In reply to#1590604
Shuah Khan <shuahkh@osg.samsung.com> writes:
> Hi Bamovar,
>
> Your original series badly broke the selftest build. I can no longer
> build individual tests. For example:
>
> cd breakpoints/
> shuah@shuah-XPS-13-9350:/lkml/linux_4.11/tools/testing/selftests/breakpoints$ make
> gcc     breakpoint_test.c  -o /breakpoint_test
> /usr/bin/ld: cannot open output file /breakpoint_test: Permission denied
> collect2: error: ld returned 1 exit status
> ../lib.mk:54: recipe for target '/breakpoint_test' failed
> make: *** [/breakpoint_test] Error 1

I also got a report of that just yesterday.

You can do:

$ cd tools/testing/selftests ; make TARGETS=breakpoints

But it's not ideal.

> commit a8ba798bc8ec663cf02e80b0dd770324de9bafd9
> Author: bamvor.zhangjian@huawei.com <bamvor.zhangjian@huawei.com>
> Date:   Tue Nov 29 19:55:52 2016 +0800
>
>     selftests: enable O and KBUILD_OUTPUT
>
> I believe the above patch is one of the suspects. Michael fixed
> some of the problems in this patch and others he sent.

It is that patch which caused it yes.

> At the moment individual tests will not build.
> tools/testing/selftests/x86$ make
> Makefile:44: warning: overriding recipe for target 'clean'
> ../lib.mk:51: warning: ignoring old recipe for target 'clean'
> gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
> /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied
> collect2: error: ld returned 1 exit status
> Makefile:50: recipe for target '/single_step_syscall_64' failed
> make: *** [/single_step_syscall_64] Error 1
>
>
> My guess is OUTPUT doesn't resolve in individual builds from the test directory.
> We have to get this fixed for 4.11-rc1

Yeah, OUTPUT is passed down from the top-level Makefile.

> Simply Reverting a8ba798bc8ec663cf02e80b0dd770324de9bafd9 doesn't work.
> Michael's patches depend on this. So anyway, please let me know if you
> can fix this quickly. I am going to be trying a few things today as well.

This seems to work, but needs some testing with and without OUTPUT set.

Basically if OUTPUT is not set, assume the current directory. It should
only take effect when someone builds from an individual directory,
because if you build from the top level OUTPUT is already set.


diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index ce96d80ad64f..9087fa949e82 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -2,6 +2,8 @@
 # Makefile can operate with or without the kbuild infrastructure.
 CC := $(CROSS_COMPILE)gcc
 
+OUTPUT ?= $(PWD)
+
 TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
 TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
 


cheers

[toc] | [prev] | [next] | [standalone]


#1591147

FromShuah Khan <shuahkh@osg.samsung.com>
Date2017-03-02 15:50 +0100
Message-ID<tgAdk-3As-25@gated-at.bofh.it>
In reply to#1590871
Hi Michael and Bamovar,

On 03/01/2017 11:43 PM, Michael Ellerman wrote:
> Shuah Khan <shuahkh@osg.samsung.com> writes:
>> Hi Bamovar,
>>
>> Your original series badly broke the selftest build. I can no longer
>> build individual tests. For example:
>>
>> cd breakpoints/
>> shuah@shuah-XPS-13-9350:/lkml/linux_4.11/tools/testing/selftests/breakpoints$ make
>> gcc     breakpoint_test.c  -o /breakpoint_test
>> /usr/bin/ld: cannot open output file /breakpoint_test: Permission denied
>> collect2: error: ld returned 1 exit status
>> ../lib.mk:54: recipe for target '/breakpoint_test' failed
>> make: *** [/breakpoint_test] Error 1
> 
> I also got a report of that just yesterday.
> 
> You can do:
> 
> $ cd tools/testing/selftests ; make TARGETS=breakpoints
> 
> But it's not ideal.
> 
>> commit a8ba798bc8ec663cf02e80b0dd770324de9bafd9
>> Author: bamvor.zhangjian@huawei.com <bamvor.zhangjian@huawei.com>
>> Date:   Tue Nov 29 19:55:52 2016 +0800
>>
>>     selftests: enable O and KBUILD_OUTPUT
>>
>> I believe the above patch is one of the suspects. Michael fixed
>> some of the problems in this patch and others he sent.
> 
> It is that patch which caused it yes.
> 
>> At the moment individual tests will not build.
>> tools/testing/selftests/x86$ make
>> Makefile:44: warning: overriding recipe for target 'clean'
>> ../lib.mk:51: warning: ignoring old recipe for target 'clean'
>> gcc -m64 -o /single_step_syscall_64 -O2 -g -std=gnu99 -pthread -Wall  single_step_syscall.c -lrt -ldl
>> /usr/bin/ld: cannot open output file /single_step_syscall_64: Permission denied
>> collect2: error: ld returned 1 exit status
>> Makefile:50: recipe for target '/single_step_syscall_64' failed
>> make: *** [/single_step_syscall_64] Error 1
>>
>>
>> My guess is OUTPUT doesn't resolve in individual builds from the test directory.
>> We have to get this fixed for 4.11-rc1
> 
> Yeah, OUTPUT is passed down from the top-level Makefile.
> 
>> Simply Reverting a8ba798bc8ec663cf02e80b0dd770324de9bafd9 doesn't work.
>> Michael's patches depend on this. So anyway, please let me know if you
>> can fix this quickly. I am going to be trying a few things today as well.
> 
> This seems to work, but needs some testing with and without OUTPUT set.
> 
> Basically if OUTPUT is not set, assume the current directory. It should
> only take effect when someone builds from an individual directory,
> because if you build from the top level OUTPUT is already set.
> 
> 
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index ce96d80ad64f..9087fa949e82 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -2,6 +2,8 @@
>  # Makefile can operate with or without the kbuild infrastructure.
>  CC := $(CROSS_COMPILE)gcc
>  
> +OUTPUT ?= $(PWD)
> +
>  TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
>  TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
>  
> 
> 
> cheers
> 

I sent a fix to lib.mk to set the OUTPUT. Please review. I can request
Linus to merge it in before 4.11-rc1 comes out.

thanks,
-- Shuah

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web