VERIFY_ERRNO() macro is added to perform error handling. It is used to print the return value if the syscall fails with an error code other than what is expected.
Signed-off-by: Chaitanya S Prakash chaitanyas.prakash@arm.com --- tools/testing/selftests/arm64/morello/mmap.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/arm64/morello/mmap.c b/tools/testing/selftests/arm64/morello/mmap.c index 18b0cc6b3549..b04c754369b6 100644 --- a/tools/testing/selftests/arm64/morello/mmap.c +++ b/tools/testing/selftests/arm64/morello/mmap.c @@ -19,6 +19,13 @@ #define PROBE_MODE_TOUCH 0x01 #define PROBE_MODE_VERIFY 0x02
+#define VERIFY_ERRNO(ret_val, expected_errno) \ + do { \ + if (ret_val != expected_errno) { \ + TH_LOG("Syscall failed with: %ld", (unsigned long)ret_val); \ + } \ + } while (0) + static struct initial_data reg_data;
static unsigned long pagesize;