On 20/05/21 00:14, Axel Rasmussen wrote:
On Wed, May 19, 2021 at 2:45 PM Ben Gardon bgardon@google.com wrote:
On Wed, May 19, 2021 at 1:03 PM Axel Rasmussen axelrasmussen@google.com wrote:
A small cleanup. Our caller writes:
r = setup_demand_paging(...); if (r < 0) exit(-r);
Since we're just going to exit anyway, instead of returning an error we can just re-use TEST_ASSERT. This makes the caller simpler, as well as the function itself - no need to write our branches, etc.
Signed-off-by: Axel Rasmussen axelrasmussen@google.com
.../selftests/kvm/demand_paging_test.c | 51 +++++++------------ 1 file changed, 19 insertions(+), 32 deletions(-)
diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c index 9398ba6ef023..601a1df24dd2 100644 --- a/tools/testing/selftests/kvm/demand_paging_test.c +++ b/tools/testing/selftests/kvm/demand_paging_test.c @@ -9,6 +9,8 @@
#define _GNU_SOURCE /* for pipe2 */
+#include <inttypes.h> +#include <stdint.h>
Why do the includes need to change in this commit? Is it for the PRIu64 below?
Right, I didn't actually try compiling without these, but inttypes.h defines PRIu64 and stdint.h defines uint64_t. In general I tend to prefer including things like this because we're using their definitions directly, even if we might be picking them up transiently some other way.
inttypes.h is defined to include stdint.h (stdint.h is mostly useful in freestanding environments and is usually provided by the C compiler, while inttypes.h is provided by libc).
Paolo