Re: [PATCH] selftests: KVM: AMD Nested SVM test infrastructure

From: Paolo Bonzini
Date: Tue Jan 21 2020 - 07:17:21 EST


On 21/01/20 12:12, Auger Eric wrote:
>>> +
>>> +static struct test tests[] = {
>>> + /* name, supported, custom setup, l2 code, exit code, custom check, finished */
>>> + {"vmmcall", NULL, NULL, l2_vmcall, SVM_EXIT_VMMCALL},
>>> + {"vmrun", NULL, NULL, l2_vmrun, SVM_EXIT_VMRUN},
>>> + {"CR3 read intercept", NULL, prepare_cr3_intercept, l2_cr3_read, SVM_EXIT_READ_CR3},
>>> +};
>> selftests are usualy not that well structured :-) E.g. we don't have
>> sub-tests and a way to specify which one to run so there is a single
>> flow when everything is being executed. I'd suggest to keep things as
>> simple as possibe (especially in the basic 'svm' test).
> In this case the differences between the tests is very tiny. One line on
> L2 and one line on L1 to check the exit status. I wondered whether it
> deserves to have separate test files for that. I did not intend to run
> the subtests separately nor to add many more subtests but rather saw all
> of them as a single basic test. More complex tests would be definitively
> separate.

I would just leave this deeper kind of test to kvm-unit-tests and keep
selftests for API tests. So this would mean basically only keep (and
inline) the vmmcall test.

Paolo