* [PATCH] selftests: Makefile: create OUTPUT dir
@ 2024-09-16 7:56 Anders Roxell
2024-09-19 15:51 ` Shuah Khan
0 siblings, 1 reply; 6+ messages in thread
From: Anders Roxell @ 2024-09-16 7:56 UTC (permalink / raw)
To: shuah; +Cc: willemb, kuba, linux-kselftest, linux-kernel, Anders Roxell
When cross building kselftest out-of-tree the following issue can be
seen:
[...]
make[4]: Entering directory
'/src/kernel/linux/tools/testing/selftests/net/lib'
CC csum
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld:
cannot open output file /tmp/build/kselftest/net/lib/csum: No such
file or directory
collect2: error: ld returned 1 exit status
[...]
Create the output build directory before building the targets, solves
this issue with building 'net/lib/csum'.
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
tools/testing/selftests/Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index b38199965f99..05c143bcff6a 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -261,6 +261,7 @@ ifdef INSTALL_PATH
@ret=1; \
for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
+ mkdir -p $$BUILD_TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \
INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \
SRC_PATH=$(shell readlink -e $$(pwd)) \
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: Makefile: create OUTPUT dir
2024-09-16 7:56 [PATCH] selftests: Makefile: create OUTPUT dir Anders Roxell
@ 2024-09-19 15:51 ` Shuah Khan
2024-09-20 10:38 ` Jakub Kicinski
0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-09-19 15:51 UTC (permalink / raw)
To: Anders Roxell, shuah
Cc: willemb, kuba, linux-kselftest, linux-kernel, Shuah Khan
On 9/16/24 01:56, Anders Roxell wrote:
> When cross building kselftest out-of-tree the following issue can be
> seen:
>
> [...]
> make[4]: Entering directory
> '/src/kernel/linux/tools/testing/selftests/net/lib'
> CC csum
> /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld:
> cannot open output file /tmp/build/kselftest/net/lib/csum: No such
> file or directory
> collect2: error: ld returned 1 exit status
> [...]
>
> Create the output build directory before building the targets, solves
> this issue with building 'net/lib/csum'.
>
> Suggested-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
> tools/testing/selftests/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index b38199965f99..05c143bcff6a 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -261,6 +261,7 @@ ifdef INSTALL_PATH
> @ret=1; \
> for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
> BUILD_TARGET=$$BUILD/$$TARGET; \
> + mkdir -p $$BUILD_TARGET; \
> $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \
> INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \
> SRC_PATH=$(shell readlink -e $$(pwd)) \
Doesn't the "all" target mkdir work for this case? Why do we need another mkdir here?
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: Makefile: create OUTPUT dir
2024-09-19 15:51 ` Shuah Khan
@ 2024-09-20 10:38 ` Jakub Kicinski
2024-09-25 17:26 ` Shuah Khan
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2024-09-20 10:38 UTC (permalink / raw)
To: Shuah Khan; +Cc: Anders Roxell, shuah, willemb, linux-kselftest, linux-kernel
On Thu, 19 Sep 2024 09:51:47 -0600 Shuah Khan wrote:
> > @@ -261,6 +261,7 @@ ifdef INSTALL_PATH
> > @ret=1; \
> > for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
> > BUILD_TARGET=$$BUILD/$$TARGET; \
> > + mkdir -p $$BUILD_TARGET; \
> > $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \
> > INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \
> > SRC_PATH=$(shell readlink -e $$(pwd)) \
>
> Doesn't the "all" target mkdir work for this case? Why do we need another mkdir here?
I was wondering about that, too. Looks like the code from the all
target is copy/pasted in the install target except the mkdir line.
Best fix would be to make the dependency work, I don't understand
why it doesn't already, tho.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: Makefile: create OUTPUT dir
2024-09-20 10:38 ` Jakub Kicinski
@ 2024-09-25 17:26 ` Shuah Khan
2024-10-02 6:15 ` Anders Roxell
0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-09-25 17:26 UTC (permalink / raw)
To: Jakub Kicinski, Anders Roxell
Cc: shuah, willemb, linux-kselftest, linux-kernel, Shuah Khan
On 9/20/24 04:38, Jakub Kicinski wrote:
> On Thu, 19 Sep 2024 09:51:47 -0600 Shuah Khan wrote:
>>> @@ -261,6 +261,7 @@ ifdef INSTALL_PATH
>>> @ret=1; \
>>> for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
>>> BUILD_TARGET=$$BUILD/$$TARGET; \
>>> + mkdir -p $$BUILD_TARGET; \
>>> $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \
>>> INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \
>>> SRC_PATH=$(shell readlink -e $$(pwd)) \
>>
>> Doesn't the "all" target mkdir work for this case? Why do we need another mkdir here?
>
> I was wondering about that, too. Looks like the code from the all
> target is copy/pasted in the install target except the mkdir line.
> Best fix would be to make the dependency work, I don't understand
> why it doesn't already, tho.
I think this could be the issue:
net main Makefile doesn't have handling for subdirs. It looks
like the way this is handled is by adding an entry to the main
Makefile:
TARGETS += net/af_unix
TARGETS += net/forwarding
TARGETS += net/hsr
TARGETS += net/mptcp
TARGETS += net/openvswitch
TARGETS += net/tcp_ao
TARGETS += net/netfilter
So the solution would be similar adding net/lib to the main
Makefile.
Anders, can you try the above and see if it works.
Another issue - lib/Makefile
TEST_GEN_FILES += csum needs to be TEST_GEN_FILES = csum
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: Makefile: create OUTPUT dir
2024-09-25 17:26 ` Shuah Khan
@ 2024-10-02 6:15 ` Anders Roxell
2024-10-04 0:01 ` Shuah Khan
0 siblings, 1 reply; 6+ messages in thread
From: Anders Roxell @ 2024-10-02 6:15 UTC (permalink / raw)
To: Shuah Khan; +Cc: Jakub Kicinski, shuah, willemb, linux-kselftest, linux-kernel
On Wed, 25 Sept 2024 at 19:26, Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> On 9/20/24 04:38, Jakub Kicinski wrote:
> > On Thu, 19 Sep 2024 09:51:47 -0600 Shuah Khan wrote:
> >>> @@ -261,6 +261,7 @@ ifdef INSTALL_PATH
> >>> @ret=1; \
> >>> for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
> >>> BUILD_TARGET=$$BUILD/$$TARGET; \
> >>> + mkdir -p $$BUILD_TARGET; \
> >>> $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \
> >>> INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \
> >>> SRC_PATH=$(shell readlink -e $$(pwd)) \
> >>
> >> Doesn't the "all" target mkdir work for this case? Why do we need another mkdir here?
> >
> > I was wondering about that, too. Looks like the code from the all
> > target is copy/pasted in the install target except the mkdir line.
> > Best fix would be to make the dependency work, I don't understand
> > why it doesn't already, tho.
>
> I think this could be the issue:
>
> net main Makefile doesn't have handling for subdirs. It looks
> like the way this is handled is by adding an entry to the main
> Makefile:
>
> TARGETS += net/af_unix
> TARGETS += net/forwarding
> TARGETS += net/hsr
> TARGETS += net/mptcp
> TARGETS += net/openvswitch
> TARGETS += net/tcp_ao
> TARGETS += net/netfilter
>
> So the solution would be similar adding net/lib to the main
> Makefile.
>
> Anders, can you try the above and see if it works.
Sadly that didn't help.
>
> Another issue - lib/Makefile
> TEST_GEN_FILES += csum needs to be TEST_GEN_FILES = csum
>
> thanks,
> -- Shuah
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selftests: Makefile: create OUTPUT dir
2024-10-02 6:15 ` Anders Roxell
@ 2024-10-04 0:01 ` Shuah Khan
0 siblings, 0 replies; 6+ messages in thread
From: Shuah Khan @ 2024-10-04 0:01 UTC (permalink / raw)
To: Anders Roxell
Cc: Jakub Kicinski, shuah, willemb, linux-kselftest, linux-kernel,
Shuah Khan
On 10/2/24 00:15, Anders Roxell wrote:
> On Wed, 25 Sept 2024 at 19:26, Shuah Khan <skhan@linuxfoundation.org> wrote:
>>
>> On 9/20/24 04:38, Jakub Kicinski wrote:
>>> On Thu, 19 Sep 2024 09:51:47 -0600 Shuah Khan wrote:
>>>>> @@ -261,6 +261,7 @@ ifdef INSTALL_PATH
>>>>> @ret=1; \
>>>>> for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \
>>>>> BUILD_TARGET=$$BUILD/$$TARGET; \
>>>>> + mkdir -p $$BUILD_TARGET; \
>>>>> $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \
>>>>> INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \
>>>>> SRC_PATH=$(shell readlink -e $$(pwd)) \
>>>>
>>>> Doesn't the "all" target mkdir work for this case? Why do we need another mkdir here?
>>>
>>> I was wondering about that, too. Looks like the code from the all
>>> target is copy/pasted in the install target except the mkdir line.
>>> Best fix would be to make the dependency work, I don't understand
>>> why it doesn't already, tho.
>>
>> I think this could be the issue:
>>
>> net main Makefile doesn't have handling for subdirs. It looks
>> like the way this is handled is by adding an entry to the main
>> Makefile:
>>
>> TARGETS += net/af_unix
>> TARGETS += net/forwarding
>> TARGETS += net/hsr
>> TARGETS += net/mptcp
>> TARGETS += net/openvswitch
>> TARGETS += net/tcp_ao
>> TARGETS += net/netfilter
>>
>> So the solution would be similar adding net/lib to the main
>> Makefile.
>>
>> Anders, can you try the above and see if it works.
>
> Sadly that didn't help.
>
Okay. I tried the following:
make kselftest-all TARGETS=net/lib O=/tmp
I see /tmp/kselftest/net/lib/csum
Can you give me the exact command you are running?
The following from selftests/Makefile should take care of this.
# Networking tests want the net/lib target, include it automatically
ifneq ($(filter net drivers/net drivers/net/hw,$(TARGETS)),)
ifeq ($(filter net/lib,$(TARGETS)),)
INSTALL_DEP_TARGETS := net/lib
endif
endif
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-10-04 0:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 7:56 [PATCH] selftests: Makefile: create OUTPUT dir Anders Roxell
2024-09-19 15:51 ` Shuah Khan
2024-09-20 10:38 ` Jakub Kicinski
2024-09-25 17:26 ` Shuah Khan
2024-10-02 6:15 ` Anders Roxell
2024-10-04 0:01 ` 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).