I attempted to build KVM selftests on a specified dir, unfortunately neither "make O=~/mydir TARGETS=kvm" in tools/testing/selftests, nor "make OUTPUT=~/mydir" in tools/testing/selftests/kvm work.
This series aims to make both work.
Xiaoyao Li (2): kvm: selftests: Fix no directory error when OUTPUT specified selftests: export INSTALL_HDR_PATH if using "O" to specify output dir
tools/testing/selftests/Makefile | 6 +++++- tools/testing/selftests/kvm/Makefile | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-)
When build kvm selftests to an specified directory with
make OUTPUT=~/kvm-selftests
it encouters following error:
/usr/bin/ld: cannot open output file /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test: No such file or directory collect2: error: ld returned 1 exit status make: *** [../lib.mk:141: /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test] Error 1
Signed-off-by: Xiaoyao Li xiaoyao.li@intel.com --- tools/testing/selftests/kvm/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index d91c53b726e6..86797e0242d4 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -66,6 +66,7 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option) # After inclusion, $(OUTPUT) is defined and # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ include ../lib.mk +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
STATIC_LIBS := $(OUTPUT)/libkvm.a LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM))
On 3/15/20 3:34 AM, Xiaoyao Li wrote:
When build kvm selftests to an specified directory with
make OUTPUT=~/kvm-selftests
it encouters following error:
btw lib.mk can't handle relative paths yet. The problems you are seeing are related to that as well. This relative path issue should be fixed in lib.mk and not in individual tests.
/usr/bin/ld: cannot open output file /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test: No such file or directory collect2: error: ld returned 1 exit status make: *** [../lib.mk:141: /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test] Error 1
Signed-off-by: Xiaoyao Li xiaoyao.li@intel.com
tools/testing/selftests/kvm/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index d91c53b726e6..86797e0242d4 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -66,6 +66,7 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option) # After inclusion, $(OUTPUT) is defined and # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ include ../lib.mk +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
lib.mk would have created the directory.
thanks, -- Shuah
On 3/23/2020 11:40 PM, shuah wrote:
On 3/15/20 3:34 AM, Xiaoyao Li wrote:
When build kvm selftests to an specified directory with
make OUTPUT=~/kvm-selftests
it encouters following error:
btw lib.mk can't handle relative paths yet. The problems you are seeing are related to that as well.
I tried with absolute path as well. It didn't work.
This relative path issue should be fixed in lib.mk and not in individual tests.
OK. I'll try to fix it in lib.mk
/usr/bin/ld: cannot open output file /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test: No such file or directory collect2: error: ld returned 1 exit status make: *** [../lib.mk:141: /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test] Error 1
Signed-off-by: Xiaoyao Li xiaoyao.li@intel.com
tools/testing/selftests/kvm/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index d91c53b726e6..86797e0242d4 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -66,6 +66,7 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option) # After inclusion, $(OUTPUT) is defined and # $(TEST_GEN_PROGS) starts with $(OUTPUT)/ include ../lib.mk +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
lib.mk would have created the directory.
thanks, -- Shuah
When build kvm selftests in tools/testing/selftests directory with
make O=~/kselftests TARGETS=kvm
it fails building some kvm test binaries due to lack of header files, e.g.,
x86_64/vmx_set_nested_state_test.c: In function ‘set_default_vmx_state’: x86_64/vmx_set_nested_state_test.c:85:7: error: ‘struct kvm_nested_state’ has no member named ‘hdr’ state->hdr.vmx.vmxon_pa = 0x1000;
kvm's Makefile unconditionally thinks kernel headers are installed in the "kernel-src/usr" with "INSTALL_HDR_PATH = $(top_srcdir)/usr". However, with "O" is specified, it also takes effect on "make headers_install", that causes no header files generated in "kernel-src/usr".
Export INSTALL_HDR_PATH when "O" is specified, so that kvm get the right kernel headers by checking if INSTALL_HDR_PATH is defined.
Signed-off-by: Xiaoyao Li xiaoyao.li@intel.com --- tools/testing/selftests/Makefile | 6 +++++- tools/testing/selftests/kvm/Makefile | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 6ec503912bea..5fd72d955e24 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -116,6 +116,10 @@ ARCH ?= $(SUBARCH) export KSFT_KHDR_INSTALL_DONE := 1 export BUILD
+ifneq (1,$(DEFAULT_INSTALL_HDR_PATH)) +export INSTALL_HDR_PATH := $(BUILD)/usr +endif + # build and run gpio when output directory is the src dir. # gpio has dependency on tools/gpio and builds tools/gpio # objects in the src directory in all cases making the src @@ -148,7 +152,7 @@ khdr: ifeq (1,$(DEFAULT_INSTALL_HDR_PATH)) $(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install else - $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \ + $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$(INSTALL_HDR_PATH) \ ARCH=$(ARCH) -C $(top_srcdir) headers_install endif
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 86797e0242d4..c14d23c978d5 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -44,7 +44,7 @@ TEST_GEN_PROGS_s390x += kvm_create_max_vcpus TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(UNAME_M)) LIBKVM += $(LIBKVM_$(UNAME_M))
-INSTALL_HDR_PATH = $(top_srcdir)/usr +INSTALL_HDR_PATH ?= $(top_srcdir)/usr LINUX_HDR_PATH = $(INSTALL_HDR_PATH)/include/ LINUX_TOOL_INCLUDE = $(top_srcdir)/tools/include LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include
On 15/03/20 10:34, Xiaoyao Li wrote:
I attempted to build KVM selftests on a specified dir, unfortunately neither "make O=~/mydir TARGETS=kvm" in tools/testing/selftests, nor "make OUTPUT=~/mydir" in tools/testing/selftests/kvm work.
This series aims to make both work.
Xiaoyao Li (2): kvm: selftests: Fix no directory error when OUTPUT specified selftests: export INSTALL_HDR_PATH if using "O" to specify output dir
tools/testing/selftests/Makefile | 6 +++++- tools/testing/selftests/kvm/Makefile | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-)
Queued, thanks.
Paolo
On 3/18/20 7:13 AM, Paolo Bonzini wrote:
On 15/03/20 10:34, Xiaoyao Li wrote:
I attempted to build KVM selftests on a specified dir, unfortunately neither "make O=~/mydir TARGETS=kvm" in tools/testing/selftests, nor "make OUTPUT=~/mydir" in tools/testing/selftests/kvm work.
This series aims to make both work.
Xiaoyao Li (2): kvm: selftests: Fix no directory error when OUTPUT specified selftests: export INSTALL_HDR_PATH if using "O" to specify output dir
tools/testing/selftests/Makefile | 6 +++++- tools/testing/selftests/kvm/Makefile | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-)
Queued, thanks.
Paolo
Sorry for the delay. I would like to see these two to go through kselftest tree. These involve frame work changes and will cause problems if they aren't integrated in kselftest next branch.
thanks, -- Shuah
On 3/18/20 7:13 AM, Paolo Bonzini wrote:
On 15/03/20 10:34, Xiaoyao Li wrote:
I attempted to build KVM selftests on a specified dir, unfortunately neither "make O=~/mydir TARGETS=kvm" in tools/testing/selftests, nor "make OUTPUT=~/mydir" in tools/testing/selftests/kvm work.
This series aims to make both work.
Xiaoyao Li (2): kvm: selftests: Fix no directory error when OUTPUT specified
This definitely isn't thr right fix for this issue.
selftests: export INSTALL_HDR_PATH if using "O" to specify output dir
Might be okay, but hard to find problems with the limited testing done just on the kvm test.
tools/testing/selftests/Makefile | 6 +++++- tools/testing/selftests/kvm/Makefile | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-)
Queued, thanks.
Paolo
Can you please drop these for your queue. I would like to make sure they work with other patches queued in kselftest next and would like these go through kselftest tree.
It will be easier to find regressions when tested with other patches to framework as opposed to limited testing on just the kvm test.
thanks, -- Shuah
On 23/03/20 16:44, shuah wrote:
On 3/18/20 7:13 AM, Paolo Bonzini wrote:
On 15/03/20 10:34, Xiaoyao Li wrote:
I attempted to build KVM selftests on a specified dir, unfortunately neither "make O=~/mydir TARGETS=kvm" in tools/testing/selftests, nor "make OUTPUT=~/mydir" in tools/testing/selftests/kvm work.
This series aims to make both work.
Xiaoyao Li (2): kvm: selftests: Fix no directory error when OUTPUT specified
This definitely isn't thr right fix for this issue.
selftests: export INSTALL_HDR_PATH if using "O" to specify output dir
Might be okay, but hard to find problems with the limited testing done just on the kvm test.
tools/testing/selftests/Makefile | 6 +++++- tools/testing/selftests/kvm/Makefile | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-)
Queued, thanks.
Paolo
Can you please drop these for your queue. I would like to make sure they work with other patches queued in kselftest next and would like these go through kselftest tree.
It will be easier to find regressions when tested with other patches to framework as opposed to limited testing on just the kvm test.
Sure, thanks.
Paolo
linux-kselftest-mirror@lists.linaro.org