On 31/01/2018 03:56, Andrew Jones wrote: >>> (Also, doesn't compile here due to missing #include <asm/msr-index.h> >>> and I didn't look further.) >> >> My apologies. Please try "KERNEL=<kernel-srcdir> make" >> >> The gtests code needs the actual KVM/kernel headers for the API/ABI >> details. I should have added a check for $KERNEL before building >> gtests. If you have a different recommendation for referencing the >> kernel sources from the kvm-unit-test directory, let me know. >> > > We've been copying the kernel files we need (see lib/linux/), or even > just cherry-picking the defines we need from linux headers and dropping > them into their respective kvm-unit-tests' lib/$ARCH/asm/ headers. Is > there some reason you've opted not to do that? > > On a historical note, kvm-unit-tests used to look in kernel sources for > headers, but we decided it would be more useful for the test suite to > remove the dependency. That was pre 'make standalone' though. We could > start a discussion about how much we need kvm-unit-tests to _build_ > without the dependency now, as one can always build standalone tests > on a build machine and then easily copy them to test machines. There are two things to consider in this. The first thing is separating the kvm-unit-tests "mini guest" tests from the API tests that Ken is adding. For the "mini guest" tests, having no Linux dependency is a feature. While we occasionally copy some code because we're lazy, the code is completely freestanding and not necessarily related to KVM actually. It could even be compiled on Windows or OS X if somebody cared. API tests instead are Linux- and KVM-specific. The second thing is separating UAPI vs. kernel development headers for API tests. Here, the API tests certainly can use the installed UAPI headers from /usr/include/linux (we _can_ copy them, but don't necessarily _have to_), but they shouldn't use the kernel development headers because those are reserved to kernel modules. Paolo