linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kselftest: failed to build with -C tool/testing/selftests when KBUILD_OUTPUT is set
@ 2019-11-12 16:33 Cristian Marussi
  2019-11-27  3:54 ` Michael Ellerman
  0 siblings, 1 reply; 14+ messages in thread
From: Cristian Marussi @ 2019-11-12 16:33 UTC (permalink / raw)
  To: Tim.Bird, shuah, linux-kselftest


Hi

while testing on linux-next

I see that, when KBUILD_OUTPUT is set in the env, running something like (using TARGETS=exec as a random subsystem here...)

$ make TARGETS=exec INSTALL_PATH=/nfs/LTP-official-debian-aarch64-rootfs/opt/KSFT_next kselftest-install

works fine as usual, WHILE the alternative invocation (still documented in Documentation/dev-tools/kselftest.rst)

make -C tools/testing/selftests/ TARGETS=exec INSTALL_PATH=/nfs/LTP-official-debian-aarch64-rootfs/opt/KSFT_next install

fails miserably with:
...
...
 REMOVE  usr/include/rdma/cxgb3-abi.h usr/include/rdma/nes-abi.h
  HDRINST usr/include/asm/kvm.h
  INSTALL /kselftest/usr/include
mkdir: cannot create directory ‘/kselftest’: Permission denied
/home/crimar01/ARM/dev/src/pdsw/linux/Makefile:1187: recipe for target 'headers_install' failed
make[2]: *** [headers_install] Error 1


This is fixed by unsetting KBUILD_OUTPUT OR reverting: 

303e6218ecec (ksft/fixes) selftests: Fix O= and KBUILD_OUTPUT handling for relative paths

since bypassing top makefile with -C, the definition of abs-objtree used by the above patch
is no more available.

As a side effect when KBUILD_OUTPUT is set, this breaks also the usage kselftest_install.sh.

 $ ./kselftest_install.sh /home/crimar01/ARM/dev/nfs/LTP-official-debian-aarch64-rootfs/opt/KSFT_full_next
./kselftest_install.sh: Installing in specified location - /home/crimar01/ARM/dev/nfs/LTP-official-debian-aarch64-rootfs/opt/KSFT_full_next ...
make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
	ARCH=arm64 -C ../../.. headers_install
make[1]: Entering directory '/home/crimar01/ARM/dev/src/pdsw/linux'
make[2]: Entering directory '/home/crimar01/ARM/dev/src/pdsw/out_linux'
  INSTALL /kselftest/usr/include
mkdir: cannot create directory ‘/kselftest’: Permission denied
/home/crimar01/ARM/dev/src/pdsw/linux/Makefile:1187: recipe for target 'headers_install' failed
make[2]: *** [headers_install] Error 1
make[2]: Leaving directory '/home/crimar01/ARM/dev/src/pdsw/out_linux'
Makefile:179: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/home/crimar01/ARM/dev/src/pdsw/linux'
Makefile:142: recipe for target 'khdr' failed
make: *** [khdr] Error 2


A possible fix would be (but duplicates in fact the main Makefile logic)


diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 319e094c3212..491d8b3ef1c7 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -88,6 +88,15 @@ ifdef building_out_of_srctree
 override LDFLAGS =
 endif
 
+ifeq ($(abs_objtree),)
+ifneq ($(KBUILD_OUTPUT),)
+abs_objtree := $(shell cd $(KBUILD_OUTPUT) && pwd)
+abs_objtree := $(realpath $(abs_objtree))
+else
+abs_objtree := $(shell pwd)
+endif
+endif #ifeq ($(abs_objtree),)
+
 ifneq ($(O),)
        BUILD := $(abs_objtree)
 else


Any thoughts ? ... or am I missing something ?

(I think I'm starting to see this in latest CI linaro kselftest while they cross-compile for arm64)

Thanks

Cristian

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

end of thread, other threads:[~2019-11-28 23:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 16:33 kselftest: failed to build with -C tool/testing/selftests when KBUILD_OUTPUT is set Cristian Marussi
2019-11-27  3:54 ` Michael Ellerman
2019-11-27 10:54   ` Cristian Marussi
2019-11-27 16:04     ` shuah
2019-11-27 16:23       ` Cristian Marussi
2019-11-27 16:42         ` shuah
2019-11-27 16:53           ` Cristian Marussi
2019-11-27 17:32             ` shuah
2019-11-27 17:57               ` Tim.Bird
2019-11-27 18:16                 ` shuah
2019-11-27 18:48                   ` Cristian Marussi
2019-11-28  4:17                 ` Michael Ellerman
2019-11-28  4:20           ` Michael Ellerman
2019-11-28 23:33             ` shuah

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