All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cristian Marussi <cristian.marussi@arm.com>
To: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: shuah@kernel.org, Cristian Marussi <cristian.marussi@arm.com>,
	Aleksa Sarai <cyphar@cyphar.com>
Subject: [PATCH 3/5] selftests: openat2: Print also errno in failure messages
Date: Wed, 26 Jan 2022 10:27:21 +0000	[thread overview]
Message-ID: <20220126102723.23300-4-cristian.marussi@arm.com> (raw)
In-Reply-To: <20220126102723.23300-1-cristian.marussi@arm.com>

In E_func() macro, on error, print also errno in order to aid debugging.

Cc: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 tools/testing/selftests/openat2/helpers.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/openat2/helpers.h b/tools/testing/selftests/openat2/helpers.h
index a6ea27344db2..ad5d0ba5b6ce 100644
--- a/tools/testing/selftests/openat2/helpers.h
+++ b/tools/testing/selftests/openat2/helpers.h
@@ -62,11 +62,12 @@ bool needs_openat2(const struct open_how *how);
 					(similar to chroot(2)). */
 #endif /* RESOLVE_IN_ROOT */
 
-#define E_func(func, ...)						\
-	do {								\
-		if (func(__VA_ARGS__) < 0)				\
-			ksft_exit_fail_msg("%s:%d %s failed\n", \
-					   __FILE__, __LINE__, #func);\
+#define E_func(func, ...)						      \
+	do {								      \
+		errno = 0;						      \
+		if (func(__VA_ARGS__) < 0)				      \
+			ksft_exit_fail_msg("%s:%d %s failed - errno:%d\n",    \
+					   __FILE__, __LINE__, #func, errno); \
 	} while (0)
 
 #define E_asprintf(...)		E_func(asprintf,	__VA_ARGS__)
-- 
2.17.1


  parent reply	other threads:[~2022-01-26 10:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 10:27 [PATCH 0/5] Miscellaneous trivial fixes Cristian Marussi
2022-01-26 10:27 ` [PATCH 1/5] selftests: skip mincore.check_file_mmap when fs lacks needed support Cristian Marussi
2022-01-27 23:23   ` Shuah Khan
2022-01-26 10:27 ` [PATCH 2/5] kselftest: Fix vdso_test_time to pass on skips Cristian Marussi
2022-01-26 12:22   ` Vincenzo Frascino
2022-01-26 12:34     ` Cristian Marussi
2022-01-26 15:26       ` Vincenzo Frascino
2022-01-26 12:26   ` [PATCH] kselftest: Fix vdso_test_abi return status Vincenzo Frascino
2022-01-27 23:18     ` Shuah Khan
2022-01-28 11:09       ` Vincenzo Frascino
2022-01-27 23:02   ` [PATCH 2/5] kselftest: Fix vdso_test_time to pass on skips Shuah Khan
2022-01-26 10:27 ` Cristian Marussi [this message]
2022-01-27 23:11   ` [PATCH 3/5] selftests: openat2: Print also errno in failure messages Shuah Khan
2022-01-26 10:27 ` [PATCH 4/5] selftests: openat2: Add missing dependency in Makefile Cristian Marussi
2022-01-27 23:12   ` Shuah Khan
2022-01-26 10:27 ` [PATCH 5/5] selftests: openat2: Skip testcases that fail with EOPNOTSUPP Cristian Marussi
2022-01-27 23:13   ` Shuah Khan
2022-01-27 23:05 ` [PATCH 0/5] Miscellaneous trivial fixes Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220126102723.23300-4-cristian.marussi@arm.com \
    --to=cristian.marussi@arm.com \
    --cc=cyphar@cyphar.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.