Auger Eric <eric.auger@xxxxxxxxxx> writes: > Hi Vitaly, > > On 1/20/20 11:53 AM, Vitaly Kuznetsov wrote: >> Eric Auger <eric.auger@xxxxxxxxxx> writes: >> ... >>> + >>> +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. > > But if the consensus is to keep each tests separate, I will do. > No, I wasn't asking for that, it's just that the 'tests' array looks like we're going to add more and more here (like we do in kvm-unit-tests). If it's not the case you can probably simplify the code by executing these three checks consequently without defining any 'sub-test' stuctures (like we do for other selftests). But I don't have a strong opinion on this so we can keep things the way they are. -- Vitaly