All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] tst_test_macros: Add test_macros06 tests
@ 2021-08-30  7:35 zhanglianjie
  2021-08-30  9:55 ` Li Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: zhanglianjie @ 2021-08-30  7:35 UTC (permalink / raw)
  To: ltp

Test the TST_EXP_VAL and TST_EXP_VAL_SILENT macros.

Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>

diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
index a0bad78c1..cf467b5a0 100644
--- a/lib/newlib_tests/.gitignore
+++ b/lib/newlib_tests/.gitignore
@@ -42,6 +42,7 @@ test_macros02
 test_macros03
 test_macros04
 test_macros05
+test_macros06
 tst_fuzzy_sync01
 tst_fuzzy_sync02
 tst_fuzzy_sync03
diff --git a/lib/newlib_tests/test_macros06.c b/lib/newlib_tests/test_macros06.c
new file mode 100644
index 000000000..626f233d2
--- /dev/null
+++ b/lib/newlib_tests/test_macros06.c
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2021 zhanglianjie <zhanglianjie@uniontech.com>
+ */
+
+/*
+ * Test TST_EXP_VAL and TST_EXP_VAL_SILENT macro.
+ */
+
+#include "tst_test.h"
+
+static int fail_val(void)
+{
+	errno = EINVAL;
+	return 42;
+}
+
+static int pass_val(void)
+{
+	return 42;
+}
+
+static void do_test(void)
+{
+	tst_res(TINFO, "Testing TST_EXP_VAL macro");
+	TST_EXP_VAL(fail_val(), 40, "fail_val()");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TST_EXP_VAL(pass_val(), 42, "fail_val()");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+
+	tst_res(TINFO, "Testing TST_EXP_PID_SILENT macro");
+	TST_EXP_VAL_SILENT(fail_val(), 40, "fail_val()");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+	TST_EXP_VAL_SILENT(pass_val(), 42, "%s", "pass_val()");
+	tst_res(TINFO, "TST_PASS = %i", TST_PASS);
+}
+
+static struct tst_test test = {
+	.test_all = do_test,
+};
--
2.20.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] tst_test_macros: Add test_macros06 tests
  2021-08-30  7:35 [LTP] [PATCH] tst_test_macros: Add test_macros06 tests zhanglianjie
@ 2021-08-30  9:55 ` Li Wang
  2021-08-30 12:15 ` Li Wang
  2021-08-30 14:18 ` Cyril Hrubis
  2 siblings, 0 replies; 6+ messages in thread
From: Li Wang @ 2021-08-30  9:55 UTC (permalink / raw)
  To: ltp

On Mon, Aug 30, 2021 at 3:36 PM zhanglianjie <zhanglianjie@uniontech.com>
wrote:

> Test the TST_EXP_VAL and TST_EXP_VAL_SILENT macros.
>
> Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>
>
 Reviewed-by: Li Wang <liwang@redhat.com>


>
> diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
> index a0bad78c1..cf467b5a0 100644
> --- a/lib/newlib_tests/.gitignore
> +++ b/lib/newlib_tests/.gitignore
> @@ -42,6 +42,7 @@ test_macros02
>  test_macros03
>  test_macros04
>  test_macros05
> +test_macros06
>  tst_fuzzy_sync01
>  tst_fuzzy_sync02
>  tst_fuzzy_sync03
> diff --git a/lib/newlib_tests/test_macros06.c
> b/lib/newlib_tests/test_macros06.c
> new file mode 100644
> index 000000000..626f233d2
> --- /dev/null
> +++ b/lib/newlib_tests/test_macros06.c
> @@ -0,0 +1,40 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2021 zhanglianjie <zhanglianjie@uniontech.com>
> + */
> +
> +/*
> + * Test TST_EXP_VAL and TST_EXP_VAL_SILENT macro.
> + */
> +
> +#include "tst_test.h"
> +
> +static int fail_val(void)
> +{
> +       errno = EINVAL;
> +       return 42;
> +}
> +
> +static int pass_val(void)
> +{
> +       return 42;
> +}
> +
> +static void do_test(void)
> +{
> +       tst_res(TINFO, "Testing TST_EXP_VAL macro");
> +       TST_EXP_VAL(fail_val(), 40, "fail_val()");
> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +       TST_EXP_VAL(pass_val(), 42, "fail_val()");
> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +
> +       tst_res(TINFO, "Testing TST_EXP_PID_SILENT macro");
> +       TST_EXP_VAL_SILENT(fail_val(), 40, "fail_val()");
> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +       TST_EXP_VAL_SILENT(pass_val(), 42, "%s", "pass_val()");
> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +}
> +
> +static struct tst_test test = {
> +       .test_all = do_test,
> +};
> --
> 2.20.1
>
>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210830/92d213ab/attachment-0001.htm>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] tst_test_macros: Add test_macros06 tests
  2021-08-30  7:35 [LTP] [PATCH] tst_test_macros: Add test_macros06 tests zhanglianjie
  2021-08-30  9:55 ` Li Wang
@ 2021-08-30 12:15 ` Li Wang
  2021-08-31  1:36   ` zhanglianjie
  2021-08-30 14:18 ` Cyril Hrubis
  2 siblings, 1 reply; 6+ messages in thread
From: Li Wang @ 2021-08-30 12:15 UTC (permalink / raw)
  To: ltp

On Mon, Aug 30, 2021 at 3:36 PM zhanglianjie <zhanglianjie@uniontech.com>
wrote:

> Test the TST_EXP_VAL and TST_EXP_VAL_SILENT macros.
>
> Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>
>
> diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
> index a0bad78c1..cf467b5a0 100644
> --- a/lib/newlib_tests/.gitignore
> +++ b/lib/newlib_tests/.gitignore
> @@ -42,6 +42,7 @@ test_macros02
>  test_macros03
>  test_macros04
>  test_macros05
> +test_macros06
>  tst_fuzzy_sync01
>  tst_fuzzy_sync02
>  tst_fuzzy_sync03
> diff --git a/lib/newlib_tests/test_macros06.c
> b/lib/newlib_tests/test_macros06.c
> new file mode 100644
> index 000000000..626f233d2
> --- /dev/null
> +++ b/lib/newlib_tests/test_macros06.c
> @@ -0,0 +1,40 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2021 zhanglianjie <zhanglianjie@uniontech.com>
> + */
> +
> +/*
> + * Test TST_EXP_VAL and TST_EXP_VAL_SILENT macro.
> + */
> +
> +#include "tst_test.h"
> +
> +static int fail_val(void)
> +{
> +       errno = EINVAL;
> +       return 42;
> +}
> +
> +static int pass_val(void)
> +{
> +       return 42;
> +}
> +
> +static void do_test(void)
> +{
> +       tst_res(TINFO, "Testing TST_EXP_VAL macro");
> +       TST_EXP_VAL(fail_val(), 40, "fail_val()");
> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +       TST_EXP_VAL(pass_val(), 42, "fail_val()");
>

Err, the last function name should be corrected to "pass_val()" or
delete it like test_macros05.

Someone who merges this can help fix it.



> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +
> +       tst_res(TINFO, "Testing TST_EXP_PID_SILENT macro");
> +       TST_EXP_VAL_SILENT(fail_val(), 40, "fail_val()");
> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +       TST_EXP_VAL_SILENT(pass_val(), 42, "%s", "pass_val()");
> +       tst_res(TINFO, "TST_PASS = %i", TST_PASS);
> +}
> +
> +static struct tst_test test = {
> +       .test_all = do_test,
> +};
> --
> 2.20.1
>
>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
>
>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210830/86b6330b/attachment.htm>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] tst_test_macros: Add test_macros06 tests
  2021-08-30  7:35 [LTP] [PATCH] tst_test_macros: Add test_macros06 tests zhanglianjie
  2021-08-30  9:55 ` Li Wang
  2021-08-30 12:15 ` Li Wang
@ 2021-08-30 14:18 ` Cyril Hrubis
  2021-08-31  1:34   ` zhanglianjie
  2 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2021-08-30 14:18 UTC (permalink / raw)
  To: ltp

Hi!
Can we please add the macro expansion test to the test_macros05 as well?

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] tst_test_macros: Add test_macros06 tests
  2021-08-30 14:18 ` Cyril Hrubis
@ 2021-08-31  1:34   ` zhanglianjie
  0 siblings, 0 replies; 6+ messages in thread
From: zhanglianjie @ 2021-08-31  1:34 UTC (permalink / raw)
  To: ltp

Hi,
Yes, I will submit the patch, thank you.

On 2021-08-30 22:18, Cyril Hrubis wrote:
> Hi!
> Can we please add the macro expansion test to the test_macros05 as well?
> 

-- 
Regards,
Zhang Lianjie



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] [PATCH] tst_test_macros: Add test_macros06 tests
  2021-08-30 12:15 ` Li Wang
@ 2021-08-31  1:36   ` zhanglianjie
  0 siblings, 0 replies; 6+ messages in thread
From: zhanglianjie @ 2021-08-31  1:36 UTC (permalink / raw)
  To: ltp

Hi,
I will fix it, thanks for your review.

On 2021-08-30 20:15, Li Wang wrote:
> 
> 
> On Mon, Aug 30, 2021 at 3:36 PM zhanglianjie <zhanglianjie@uniontech.com 
> <mailto:zhanglianjie@uniontech.com>> wrote:
> 
>     Test the TST_EXP_VAL and TST_EXP_VAL_SILENT macros.
> 
>     Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com
>     <mailto:zhanglianjie@uniontech.com>>
> 
>     diff --git a/lib/newlib_tests/.gitignore b/lib/newlib_tests/.gitignore
>     index a0bad78c1..cf467b5a0 100644
>     --- a/lib/newlib_tests/.gitignore
>     +++ b/lib/newlib_tests/.gitignore
>     @@ -42,6 +42,7 @@ test_macros02
>      ?test_macros03
>      ?test_macros04
>      ?test_macros05
>     +test_macros06
>      ?tst_fuzzy_sync01
>      ?tst_fuzzy_sync02
>      ?tst_fuzzy_sync03
>     diff --git a/lib/newlib_tests/test_macros06.c
>     b/lib/newlib_tests/test_macros06.c
>     new file mode 100644
>     index 000000000..626f233d2
>     --- /dev/null
>     +++ b/lib/newlib_tests/test_macros06.c
>     @@ -0,0 +1,40 @@
>     +// SPDX-License-Identifier: GPL-2.0-or-later
>     +/*
>     + * Copyright (c) 2021 zhanglianjie <zhanglianjie@uniontech.com
>     <mailto:zhanglianjie@uniontech.com>>
>     + */
>     +
>     +/*
>     + * Test TST_EXP_VAL and TST_EXP_VAL_SILENT macro.
>     + */
>     +
>     +#include "tst_test.h"
>     +
>     +static int fail_val(void)
>     +{
>     +? ? ? ?errno = EINVAL;
>     +? ? ? ?return 42;
>     +}
>     +
>     +static int pass_val(void)
>     +{
>     +? ? ? ?return 42;
>     +}
>     +
>     +static void do_test(void)
>     +{
>     +? ? ? ?tst_res(TINFO, "Testing TST_EXP_VAL macro");
>     +? ? ? ?TST_EXP_VAL(fail_val(), 40, "fail_val()");
>     +? ? ? ?tst_res(TINFO, "TST_PASS = %i", TST_PASS);
>     +? ? ? ?TST_EXP_VAL(pass_val(), 42, "fail_val()");
> 
> 
> Err, the last function name should be corrected to "pass_val()" or
> delete it like test_macros05.
> 
> Someone who merges this can help fix it.
> 
>     +? ? ? ?tst_res(TINFO, "TST_PASS = %i", TST_PASS);
>     +
>     +? ? ? ?tst_res(TINFO, "Testing TST_EXP_PID_SILENT macro");
>     +? ? ? ?TST_EXP_VAL_SILENT(fail_val(), 40, "fail_val()");
>     +? ? ? ?tst_res(TINFO, "TST_PASS = %i", TST_PASS);
>     +? ? ? ?TST_EXP_VAL_SILENT(pass_val(), 42, "%s", "pass_val()");
>     +? ? ? ?tst_res(TINFO, "TST_PASS = %i", TST_PASS);
>     +}
>     +
>     +static struct tst_test test = {
>     +? ? ? ?.test_all = do_test,
>     +};
>     --
>     2.20.1
> 
> 
> 
> 
>     -- 
>     Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> 
> 
> -- 
> Regards,
> Li Wang

-- 
Regards,
Zhang Lianjie



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-31  1:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30  7:35 [LTP] [PATCH] tst_test_macros: Add test_macros06 tests zhanglianjie
2021-08-30  9:55 ` Li Wang
2021-08-30 12:15 ` Li Wang
2021-08-31  1:36   ` zhanglianjie
2021-08-30 14:18 ` Cyril Hrubis
2021-08-31  1:34   ` zhanglianjie

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.