Re: [PATCH v1 2/3] selftests/nolibc: fix up O= option support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-08-03 22:45:52+0800, Zhangjin Wu wrote:
> To avoid pollute the source code tree and avoid mrproper for every
> architecture switch, the O= argument must be supported.
> 
> Both IMAGE and .config are from the building directory, let's use
> objtree instead of srctree for them.
> 
> If no O= option specified, means building kernel in source code tree,
> objtree should be srctree in such case.
> 
> Suggested-by: Willy Tarreau <w@xxxxxx>
> Link: https://lore.kernel.org/lkml/ZK0AB1OXH1s2xYsh@xxxxxx/
> Signed-off-by: Zhangjin Wu <falcon@xxxxxxxxxxx>
> ---
>  tools/testing/selftests/nolibc/Makefile | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile
> index 51fef5e6a152..af590aee063a 100644
> --- a/tools/testing/selftests/nolibc/Makefile
> +++ b/tools/testing/selftests/nolibc/Makefile
> @@ -9,6 +9,9 @@ ifeq ($(srctree),)
>  srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
>  endif
>  
> +# add objtree for O= argument, required by IMAGE and .config
> +objtree ?= $(srctree)

Isn't this already set by the included tools/scripts/Makefile.include?

Also I'm not entirely if O= works as intended currently.
When using O=foo in the $LINUX/tools/testing/selftests/nolibc directory
the build instead is happening in $LINUX/foo. But the Makefile first
validates that $LINUX/tools/testing/selftests/nolibc/foo exists.

It seems we need to pass $(COMMAND_O) to the recursive calls to $(MAKE),
too?

> +
>  ifeq ($(ARCH),)
>  include $(srctree)/scripts/subarch.include
>  ARCH = $(SUBARCH)
> @@ -217,12 +220,12 @@ kernel: initramfs
>  
>  # run the tests after building the kernel
>  run: kernel
> -	$(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out"
> +	$(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(objtree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out"
>  	$(Q)$(REPORT) $(CURDIR)/run.out
>  
>  # re-run the tests from an existing kernel
>  rerun:
> -	$(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(srctree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out"
> +	$(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(objtree)/$(IMAGE)" -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out"
>  	$(Q)$(REPORT) $(CURDIR)/run.out
>  
>  # report with existing test log
> -- 
> 2.25.1
> 



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux