[LTP] [PATCH 2/2] kvm: Allow running multiple iterations of a test
Martin Doucha
mdoucha@suse.cz
Fri May 6 16:21:25 CEST 2022
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
This fixes running the test with "-i N" for N>1. It's a lazy fix but
the alternative would be saving the initial CPU state in up to 3 separate
buffers and then restoring it after each test run. And the number of buffers
differs on different archs. And ARM64 has an extra ioctl() instead...
I also wonder whether I should implement LTP library function to free
individual guarded buffers because I don't like calling tst_free_all()
directly.
testcases/kernel/kvm/lib_host.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/kvm/lib_host.c b/testcases/kernel/kvm/lib_host.c
index b8994f34e..2782e68b0 100644
--- a/testcases/kernel/kvm/lib_host.c
+++ b/testcases/kernel/kvm/lib_host.c
@@ -269,16 +269,20 @@ void tst_kvm_destroy_instance(struct tst_kvm_instance *inst)
SAFE_CLOSE(inst->vcpu_fd);
SAFE_CLOSE(inst->vm_fd);
+ memset(inst->ram, 0, sizeof(inst->ram));
}
void tst_kvm_setup(void)
{
- tst_kvm_create_instance(&test_vm, DEFAULT_RAM_SIZE);
+
}
void tst_kvm_run(void)
{
+ tst_kvm_create_instance(&test_vm, DEFAULT_RAM_SIZE);
tst_kvm_run_instance(&test_vm);
+ tst_kvm_destroy_instance(&test_vm);
+ tst_free_all();
}
void tst_kvm_cleanup(void)
--
2.36.0
More information about the ltp
mailing list