Re: [PATCH 16/29] selftests/mm: UFFDIO_API test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30.03.23 18:07, Peter Xu wrote:
Add one simple test for UFFDIO_API.  With that, I also added a bunch of
small but handy helpers along the way.

Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
---
  tools/testing/selftests/mm/uffd-unit-tests.c | 111 ++++++++++++++++++-
  tools/testing/selftests/mm/vm_util.c         |  10 ++
  2 files changed, 120 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index 6857388783be..dfb44ffad5f5 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -9,9 +9,118 @@
#ifdef __NR_userfaultfd +struct {
+	unsigned int pass, skip, fail, total;
+} uffd_test_acct;
+
+static void uffd_test_report(void)
+{
+	printf("Userfaults unit tests: pass=%u, skip=%u, fail=%u (total=%u)\n",
+	       uffd_test_acct.pass,
+	       uffd_test_acct.skip,
+	       uffd_test_acct.fail,
+	       uffd_test_acct.total);
+}
+
+static void uffd_test_pass(void)
+{
+	printf("done\n");
+	uffd_test_acct.pass++;
+}
+
+#define  uffd_test_start(...)  do {		\
+		printf(__VA_ARGS__);		\
+		printf("... ");			\
+		uffd_test_acct.total++;		\
+	} while (0)
+
+#define  uffd_test_fail(...)  do {		\
+		printf("failed [reason: ");	\
+		printf(__VA_ARGS__);		\
+		printf("]\n");			\
+		uffd_test_acct.fail++;		\
+	} while (0)
+
+#define  uffd_test_skip(...)  do {		\
+		printf("skipped [reason: ");	\
+		printf(__VA_ARGS__);		\
+		printf("]\n");			\
+		uffd_test_acct.skip++;		\
+	} while (0)
+


There is ksft_print_msg, ksft_test_result, ksft_test_result_fail, ... do we maybe want to convert properly to ksft while already at it?

--
Thanks,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux