KVM: selftests: Add a selftest for guest prints and formatted asserts
authorAaron Lewis <aaronlewis@google.com>
Mon, 31 Jul 2023 20:30:26 +0000 (13:30 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 2 Aug 2023 21:42:52 +0000 (14:42 -0700)
commit5d1d46f9d56fb567718175cb0cb7a084d444a9d4
tree4847978f1565b5fc77287b327bf259377d0a0dff
parentedb5b700f9f8a21e57aef14cf795fb958cc38628
KVM: selftests: Add a selftest for guest prints and formatted asserts

Add a test to exercise the various features in KVM selftest's local
snprintf() and compare them to LIBC's snprintf() to ensure they behave
the same.

This is not an exhaustive test.  KVM's local snprintf() does not
implement all the features LIBC does, e.g. KVM's local snprintf() does
not support floats or doubles, so testing for those features were
excluded.

Testing was added for the features that are expected to work to
support a minimal version of printf() in the guest.

Signed-off-by: Aaron Lewis <aaronlewis@google.com>
[sean: use UCALL_EXIT_REASON, enable for all architectures]
Link: https://lore.kernel.org/r/20230731203026.1192091-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/guest_print_test.c [new file with mode: 0644]