diff options
author | Andrew Jones <drjones@redhat.com> | 2020-03-13 16:56:44 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-03-16 17:59:07 +0100 |
commit | 94c4b76b88d40f9062dc32ff2fff551ae1791c1e (patch) | |
tree | 74487c65682932b2d52df3e1ec5de6684d1a01d8 /tools/testing/selftests/kvm/lib/test_util.c | |
parent | beca54702dc694970dd9727dde59cf5f56c4dbd8 (diff) | |
download | linux-94c4b76b88d40f9062dc32ff2fff551ae1791c1e.tar.bz2 |
KVM: selftests: Introduce steal-time test
The steal-time test confirms what is reported to the guest as stolen
time is consistent with the run_delay reported for the VCPU thread
on the host. Both x86_64 and AArch64 have the concept of steal/stolen
time so this test is introduced for both architectures.
While adding the test we ensure .gitignore has all tests listed
(it was missing s390x/resets) and that the Makefile has all tests
listed in alphabetical order (not really necessary, but it almost
was already...). We also extend the common API with a new num-guest-
pages call and a new timespec call.
Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/test_util.c')
-rw-r--r-- | tools/testing/selftests/kvm/lib/test_util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/lib/test_util.c b/tools/testing/selftests/kvm/lib/test_util.c index 26fb3d73dc74..ee12c4b9ae05 100644 --- a/tools/testing/selftests/kvm/lib/test_util.c +++ b/tools/testing/selftests/kvm/lib/test_util.c @@ -71,6 +71,21 @@ struct timespec timespec_diff(struct timespec start, struct timespec end) return temp; } +struct timespec timespec_add_ns(struct timespec ts, int64_t ns) +{ + struct timespec res; + + res.tv_sec = ts.tv_sec; + res.tv_nsec = ts.tv_nsec + ns; + + if (res.tv_nsec > 1000000000UL) { + res.tv_sec += 1; + res.tv_nsec -= 1000000000UL; + } + + return res; +} + void print_skip(const char *fmt, ...) { va_list ap; |