summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/lib/io.c
AgeCommit message (Collapse)Author
2026-09-29KVM: selftests: Move test_read() into elf.c and delete lib/io.cGokul K
lib/io.c has outlived its purpose. test_read() has exactly one caller, lib/elf.c; test_write() has none at all; and test_seq_read() is a declaration in test_util.h with no definition anywhere in the tree. Both surviving helpers open with TEST_ASSERT(count >= 0, "Unexpected count, count: %li", count); which can never fire, because @count is a size_t. Building with -Wextra points this out: lib/io.c:51:27: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits] lib/io.c:128:27: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits] The comment above each assertion is worse than the assertion itself: it cites the read(2) and write(2) manpages to claim that a count of zero is allowed, but a zero count lands in "case 0" and fails the test outright. The helper has never accepted what the comment promises. Move test_read() into elf.c as a static elf_read(), named for what it does rather than reading as "test the read() syscall", and assert that @count is non-zero, which is what the code has always required and what every caller already passes. Drop the commentary describing retry behaviour that the code makes obvious. Nothing is then left in lib/io.c, so remove the file along with test_write() and the stale test_seq_read() declaration. No functional change intended. Suggested-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/all/aqxNbR9u5F1sqB3p@google.com Signed-off-by: Gokul K <gokul02k@gmail.com> Link: https://patch.msgid.link/20260918054420.338842-1-gokul02k@gmail.com Signed-off-by: Sean Christopherson <seanjc@google.com>
2020-03-16selftests: kvm: Uses TEST_FAIL in tests/utilitiesWainer dos Santos Moschetta
Changed all tests and utilities to use TEST_FAIL macro instead of TEST_ASSERT(false,...). Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 482Thomas Gleixner
Based on 1 normalized pattern(s): this work is licensed under the terms of the gnu gpl version 2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 48 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Enrico Weigelt <info@metux.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081204.624030236@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-04kvm: selftests: add sync_regs_testPaolo Bonzini
This includes the infrastructure to map the test into the guest and run code from the test program inside a VM. Signed-off-by: Ken Hofsass <hofsass@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>