* [U-Boot] [PATCH] test: Add ut_assertnull macro
@ 2018-06-21 14:47 Ramon Fried
2018-07-07 11:46 ` Ramon Fried
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ramon Fried @ 2018-06-21 14:47 UTC (permalink / raw)
To: u-boot
Add ut_assertnull macro to include/test/ut.h
For testing of functions that returns NULL on errors.
Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
---
include/test/ut.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/test/ut.h b/include/test/ut.h
index 59b23a25a4..fce75fd12a 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -90,6 +90,18 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line,
} \
}
+/* Assert that a pointer is NULL */
+#define ut_assertnull(expr) { \
+ const void *val = (expr); \
+ \
+ if (val != NULL) { \
+ ut_failf(uts, __FILE__, __LINE__, __func__, \
+ #expr " != NULL", \
+ "Expected NULL, got %p", val); \
+ return CMD_RET_FAILURE; \
+ } \
+}
+
/* Assert that a pointer is not NULL */
#define ut_assertnonnull(expr) { \
const void *val = (expr); \
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] test: Add ut_assertnull macro
2018-06-21 14:47 [U-Boot] [PATCH] test: Add ut_assertnull macro Ramon Fried
@ 2018-07-07 11:46 ` Ramon Fried
2018-07-10 20:49 ` Simon Glass
2018-07-20 12:34 ` [U-Boot] " Tom Rini
2 siblings, 0 replies; 5+ messages in thread
From: Ramon Fried @ 2018-07-07 11:46 UTC (permalink / raw)
To: u-boot
Hi Simon.
Would love to get this reviewed. can you assist ?
Thanks.
Ramon.
On Fri, Jun 22, 2018 at 12:47 AM Ramon Fried <ramon.fried@gmail.com> wrote:
>
> Add ut_assertnull macro to include/test/ut.h
> For testing of functions that returns NULL on errors.
>
> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
> ---
> include/test/ut.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/include/test/ut.h b/include/test/ut.h
> index 59b23a25a4..fce75fd12a 100644
> --- a/include/test/ut.h
> +++ b/include/test/ut.h
> @@ -90,6 +90,18 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line,
> } \
> }
>
> +/* Assert that a pointer is NULL */
> +#define ut_assertnull(expr) { \
> + const void *val = (expr); \
> + \
> + if (val != NULL) { \
> + ut_failf(uts, __FILE__, __LINE__, __func__, \
> + #expr " != NULL", \
> + "Expected NULL, got %p", val); \
> + return CMD_RET_FAILURE; \
> + } \
> +}
> +
> /* Assert that a pointer is not NULL */
> #define ut_assertnonnull(expr) { \
> const void *val = (expr); \
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] test: Add ut_assertnull macro
2018-06-21 14:47 [U-Boot] [PATCH] test: Add ut_assertnull macro Ramon Fried
2018-07-07 11:46 ` Ramon Fried
@ 2018-07-10 20:49 ` Simon Glass
2018-07-11 5:44 ` Ramon Fried
2018-07-20 12:34 ` [U-Boot] " Tom Rini
2 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2018-07-10 20:49 UTC (permalink / raw)
To: u-boot
On 21 June 2018 at 08:47, Ramon Fried <ramon.fried@gmail.com> wrote:
> Add ut_assertnull macro to include/test/ut.h
> For testing of functions that returns NULL on errors.
>
> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
> ---
> include/test/ut.h | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [PATCH] test: Add ut_assertnull macro
2018-07-10 20:49 ` Simon Glass
@ 2018-07-11 5:44 ` Ramon Fried
0 siblings, 0 replies; 5+ messages in thread
From: Ramon Fried @ 2018-07-11 5:44 UTC (permalink / raw)
To: u-boot
On July 10, 2018 11:49:31 PM GMT+03:00, Simon Glass <sjg@chromium.org> wrote:
>On 21 June 2018 at 08:47, Ramon Fried <ramon.fried@gmail.com> wrote:
>> Add ut_assertnull macro to include/test/ut.h
>> For testing of functions that returns NULL on errors.
>>
>> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
>> ---
>> include/test/ut.h | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>
>Reviewed-by: Simon Glass <sjg@chromium.org>
Thanks!
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] test: Add ut_assertnull macro
2018-06-21 14:47 [U-Boot] [PATCH] test: Add ut_assertnull macro Ramon Fried
2018-07-07 11:46 ` Ramon Fried
2018-07-10 20:49 ` Simon Glass
@ 2018-07-20 12:34 ` Tom Rini
2 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2018-07-20 12:34 UTC (permalink / raw)
To: u-boot
On Thu, Jun 21, 2018 at 05:47:16PM +0300, Ramon Fried wrote:
> Add ut_assertnull macro to include/test/ut.h
> For testing of functions that returns NULL on errors.
>
> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180720/9e5ed9fb/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-20 12:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-21 14:47 [U-Boot] [PATCH] test: Add ut_assertnull macro Ramon Fried
2018-07-07 11:46 ` Ramon Fried
2018-07-10 20:49 ` Simon Glass
2018-07-11 5:44 ` Ramon Fried
2018-07-20 12:34 ` [U-Boot] " Tom Rini
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.