mbox series

[v2,0/6] Fix errors when try to build kvm selftests on specified output

Message ID 20200325140133.103236-1-xiaoyao.li@intel.com (mailing list archive)
Headers show
Series Fix errors when try to build kvm selftests on specified output | expand

Message

Xiaoyao Li March 25, 2020, 2:01 p.m. UTC
I attempted to build KVM selftests on a specified dir, unfortunately
neither	"make O=/path/to/mydir TARGETS=kvm" in tools/testing/selftests, nor
"make OUTPUT=/path/to/mydir" in tools/testing/selftests/kvm work.

This series aims to fix them.

Patch 1 fixes the issue that output directory is not exist.

Patch 2 and 3 are the preparation for kvm to get the right path of
installed linux headers.

Patch 4 and 6 prepare the INSTALL_HDR_PATH to tell sub TARGET where the
linux headers are installed.

Patch 5 fixes the issue that with OUTPUT specified, it still make the
linux tree dirty.

I only test the sub TARGET of kvm.
In theory, it won't break other TARGET of selftests.

Changes in v2:
 - fix the no directory issue in lib.mk
 - make kvm fixes seperate patch
 - Add the patch to fix linux src tree not clean issue

v1:
https://lore.kernel.org/kvm/20200315093425.33600-1-xiaoyao.li@intel.com/

Xiaoyao Li (6):
  selftests: Create directory when OUTPUT specified
  selftests: kvm: Include lib.mk earlier
  selftests: kvm: Use the default linux header path only when
    INSTALL_HDR_PATH not defined
  selftests: Create variable INSTALL_HDR_PATH if need to install linux
    headers to $(OUTPUT)/usr
  selftests: Generate build output of linux headers to
    $(OUTPUT)/linux-header-build
  selftests: export INSTALL_HDR_PATH if using "O" to specify output dir

 tools/testing/selftests/Makefile     |  6 +++++-
 tools/testing/selftests/kvm/Makefile |  9 +++++----
 tools/testing/selftests/lib.mk       | 19 ++++++++++++++++++-
 3 files changed, 28 insertions(+), 6 deletions(-)

Comments

Shuah March 25, 2020, 4:12 p.m. UTC | #1
On 3/25/20 8:01 AM, Xiaoyao Li wrote:
> I attempted to build KVM selftests on a specified dir, unfortunately
> neither	"make O=/path/to/mydir TARGETS=kvm" in tools/testing/selftests, nor
> "make OUTPUT=/path/to/mydir" in tools/testing/selftests/kvm work.
> 

Please elaborate on the problems you are seeing. I would like you
to describe in detail the problems you are seeing and how you are
fixing them in this patch series.

The problem you are fixing here is subdir structure not being
supported for relocatable builds and the Makefile not being
able to locate headers files. These are issues, however, these
need to be fixed in the kvm Makefile.

Please look at arm64, android, futex tests as examples. lib.mk
and main selftests Makefile allow for overrides for make targets.
When a test has sub-dir structure and libraries, it is easier to
handle these in the individual Makefile.

Please fix the problems you are seeing in kvm Makefile.

 >I only test the sub TARGET of kvm.
 >In theory, it won't break other TARGET of selftests.

When you change lib.mk which is a common infrastructure, theory
doesn't help. Statements like this make me very reluctant to
accept patches. :)

This is one reason why I asked Paolo to drop these patches.

thanks,
-- Shuah
Xiaoyao Li March 26, 2020, 12:45 a.m. UTC | #2
On 3/26/2020 12:12 AM, shuah wrote:
> On 3/25/20 8:01 AM, Xiaoyao Li wrote:
>> I attempted to build KVM selftests on a specified dir, unfortunately
>> neither    "make O=/path/to/mydir TARGETS=kvm" in 
>> tools/testing/selftests, nor
>> "make OUTPUT=/path/to/mydir" in tools/testing/selftests/kvm work.
>>
> 
> Please elaborate on the problems you are seeing. I would like you
> to describe in detail the problems you are seeing and how you are
> fixing them in this patch series.
> 
> The problem you are fixing here is subdir structure not being
> supported for relocatable builds and the Makefile not being
> able to locate headers files. These are issues, however, these
> need to be fixed in the kvm Makefile
Maybe I should have sent it as RFC.

OK, then I'll just resend patch 1 in v1 to fix the subdir not created 
issue for relocatable build, in kvm Makefile. Obviously lib.mk doesn't 
create it, and you don't allow me to touch lib.mk

About headers issue, since I'm not familiar with Makefile, I don't want 
to waste any more time on it and I decide to drop them.

I can add a "make mrproper" in my script to do the cleanup as a workaround.

And never make kvm selftests in parent dir with
	make O=/somewhere TARGETS=kvm
to workaround the header not found issue.

> Please look at arm64, android, futex tests as examples. lib.mk
> and main selftests Makefile allow for overrides for make targets.
> When a test has sub-dir structure and libraries, it is easier to
> handle these in the individual Makefile.
> 
> Please fix the problems you are seeing in kvm Makefile.
> 
>  >I only test the sub TARGET of kvm.
>  >In theory, it won't break other TARGET of selftests.
> 
> When you change lib.mk which is a common infrastructure, theory
> doesn't help. Statements like this make me very reluctant to
> accept patches. :)
> 
> This is one reason why I asked Paolo to drop these patches.
> 
> thanks,
> -- Shuah