* [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found
@ 2020-11-19 9:08 Patrick Delaunay
2020-11-19 9:08 ` [PATCH 2/3] test: correct the test prefix in ut cmd_mem Patrick Delaunay
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Patrick Delaunay @ 2020-11-19 9:08 UTC (permalink / raw)
To: u-boot
Raise an error when test is not found, for example with manual test
with bad test name, as following, doesn't raise an error
=> ut lib bad
Failures: 0
After the patch:
=> ut lib bad
lib test bad not found
Failures: 1
This patch allows also to detect tests which don't respect the expected
format with "prefix" used in cmd_ut_category and defined in ut_subtest
(./test/py/conftest.py). When I execute "make qcheck" this patch detects
2 issues, corrected by the 2 next patches.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
test/cmd_ut.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index 8f0bc688a2..6a752e6456 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -20,6 +20,7 @@ int cmd_ut_category(const char *name, const char *prefix,
struct unit_test_state uts = { .fail_count = 0 };
struct unit_test *test;
int prefix_len = prefix ? strlen(prefix) : 0;
+ int nb_tests = 0;
if (argc == 1)
printf("Running %d %s tests\n", n_ents, name);
@@ -47,6 +48,12 @@ int cmd_ut_category(const char *name, const char *prefix,
uts.start = mallinfo();
test->func(&uts);
+ nb_tests++;
+ }
+
+ if (argc > 1 && nb_tests == 0) {
+ printf("%s test %s not found\n", name, argv[1]);
+ uts.fail_count = 1;
}
printf("Failures: %d\n", uts.fail_count);
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] test: correct the test prefix in ut cmd_mem
2020-11-19 9:08 [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Patrick Delaunay
@ 2020-11-19 9:08 ` Patrick Delaunay
2020-11-21 23:07 ` Simon Glass
2021-01-18 13:00 ` Tom Rini
2020-11-19 9:08 ` [PATCH 3/3] test: correct the test prefix in ut str Patrick Delaunay
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Patrick Delaunay @ 2020-11-19 9:08 UTC (permalink / raw)
To: u-boot
Align the prefix used in cmd_ut_category function and name of tests
for ut mem.
This patch solves the issues detected by "make qcheck" after previous
patch.
Fixes: 550a9e7902ce ("cmd: Update the memory-search command")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
test/cmd/mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/cmd/mem.c b/test/cmd/mem.c
index fa6770e8c0..fbaa8a4b3c 100644
--- a/test/cmd/mem.c
+++ b/test/cmd/mem.c
@@ -15,6 +15,6 @@ int do_ut_mem(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
struct unit_test *tests = ll_entry_start(struct unit_test, mem_test);
const int n_ents = ll_entry_count(struct unit_test, mem_test);
- return cmd_ut_category("cmd_mem", "cmd_mem_", tests, n_ents, argc,
+ return cmd_ut_category("cmd_mem", "mem_test_", tests, n_ents, argc,
argv);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] test: correct the test prefix in ut str
2020-11-19 9:08 [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Patrick Delaunay
2020-11-19 9:08 ` [PATCH 2/3] test: correct the test prefix in ut cmd_mem Patrick Delaunay
@ 2020-11-19 9:08 ` Patrick Delaunay
2020-11-21 23:07 ` Simon Glass
2021-01-18 13:00 ` Tom Rini
2020-11-21 23:07 ` [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Simon Glass
2021-01-16 17:11 ` Tom Rini
3 siblings, 2 replies; 9+ messages in thread
From: Patrick Delaunay @ 2020-11-19 9:08 UTC (permalink / raw)
To: u-boot
Align the prefix used in cmd_ut_category function and name of tests
for ut str.
This patch solves the issues detected by "make qcheck" after previous
patch.
Fixes: fdc79a6b125d ("lib: Add a function to convert a string to upper case")
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
test/str_ut.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/str_ut.c b/test/str_ut.c
index ef1205dbbd..cd5045516d 100644
--- a/test/str_ut.c
+++ b/test/str_ut.c
@@ -19,7 +19,7 @@ static const char str3[] = "0xbI'm sorry you're alive.";
/* Declare a new str test */
#define STR_TEST(_name, _flags) UNIT_TEST(_name, _flags, str_test)
-static int str_test_upper(struct unit_test_state *uts)
+static int str_upper(struct unit_test_state *uts)
{
char out[TEST_STR_SIZE];
@@ -55,7 +55,7 @@ static int str_test_upper(struct unit_test_state *uts)
return 0;
}
-STR_TEST(str_test_upper, 0);
+STR_TEST(str_upper, 0);
static int run_strtoul(struct unit_test_state *uts, const char *str, int base,
ulong expect_val, int expect_endp_offset, bool upper)
--
2.17.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found
2020-11-19 9:08 [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Patrick Delaunay
2020-11-19 9:08 ` [PATCH 2/3] test: correct the test prefix in ut cmd_mem Patrick Delaunay
2020-11-19 9:08 ` [PATCH 3/3] test: correct the test prefix in ut str Patrick Delaunay
@ 2020-11-21 23:07 ` Simon Glass
2021-01-16 17:11 ` Tom Rini
3 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2020-11-21 23:07 UTC (permalink / raw)
To: u-boot
On Thu, 19 Nov 2020 at 03:09, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> Raise an error when test is not found, for example with manual test
> with bad test name, as following, doesn't raise an error
>
> => ut lib bad
> Failures: 0
>
> After the patch:
>
> => ut lib bad
> lib test bad not found
> Failures: 1
>
> This patch allows also to detect tests which don't respect the expected
> format with "prefix" used in cmd_ut_category and defined in ut_subtest
> (./test/py/conftest.py). When I execute "make qcheck" this patch detects
> 2 issues, corrected by the 2 next patches.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
> test/cmd_ut.c | 7 +++++++
> 1 file changed, 7 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] test: correct the test prefix in ut cmd_mem
2020-11-19 9:08 ` [PATCH 2/3] test: correct the test prefix in ut cmd_mem Patrick Delaunay
@ 2020-11-21 23:07 ` Simon Glass
2021-01-18 13:00 ` Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2020-11-21 23:07 UTC (permalink / raw)
To: u-boot
On Thu, 19 Nov 2020 at 03:09, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> Align the prefix used in cmd_ut_category function and name of tests
> for ut mem.
> This patch solves the issues detected by "make qcheck" after previous
> patch.
>
> Fixes: 550a9e7902ce ("cmd: Update the memory-search command")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
> test/cmd/mem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] test: correct the test prefix in ut str
2020-11-19 9:08 ` [PATCH 3/3] test: correct the test prefix in ut str Patrick Delaunay
@ 2020-11-21 23:07 ` Simon Glass
2021-01-18 13:00 ` Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2020-11-21 23:07 UTC (permalink / raw)
To: u-boot
On Thu, 19 Nov 2020 at 03:09, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> Align the prefix used in cmd_ut_category function and name of tests
> for ut str.
> This patch solves the issues detected by "make qcheck" after previous
> patch.
>
> Fixes: fdc79a6b125d ("lib: Add a function to convert a string to upper case")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
> test/str_ut.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found
2020-11-19 9:08 [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Patrick Delaunay
` (2 preceding siblings ...)
2020-11-21 23:07 ` [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Simon Glass
@ 2021-01-16 17:11 ` Tom Rini
3 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-01-16 17:11 UTC (permalink / raw)
To: u-boot
On Thu, Nov 19, 2020 at 10:08:41AM +0100, Patrick Delaunay wrote:
> Raise an error when test is not found, for example with manual test
> with bad test name, as following, doesn't raise an error
>
> => ut lib bad
> Failures: 0
>
> After the patch:
>
> => ut lib bad
> lib test bad not found
> Failures: 1
>
> This patch allows also to detect tests which don't respect the expected
> format with "prefix" used in cmd_ut_category and defined in ut_subtest
> (./test/py/conftest.py). When I execute "make qcheck" this patch detects
> 2 issues, corrected by the 2 next patches.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
This is a great idea, which I cannot apply right now as it shows the
setexpr tests aren't right. So, I'll try and look in to that if
someone else doesn't get there first.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210116/306dd571/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] test: correct the test prefix in ut cmd_mem
2020-11-19 9:08 ` [PATCH 2/3] test: correct the test prefix in ut cmd_mem Patrick Delaunay
2020-11-21 23:07 ` Simon Glass
@ 2021-01-18 13:00 ` Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-01-18 13:00 UTC (permalink / raw)
To: u-boot
On Thu, Nov 19, 2020 at 10:08:42AM +0100, Patrick Delaunay wrote:
> Align the prefix used in cmd_ut_category function and name of tests
> for ut mem.
> This patch solves the issues detected by "make qcheck" after previous
> patch.
>
> Fixes: 550a9e7902ce ("cmd: Update the memory-search command")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.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: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210118/0cca1dc6/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] test: correct the test prefix in ut str
2020-11-19 9:08 ` [PATCH 3/3] test: correct the test prefix in ut str Patrick Delaunay
2020-11-21 23:07 ` Simon Glass
@ 2021-01-18 13:00 ` Tom Rini
1 sibling, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-01-18 13:00 UTC (permalink / raw)
To: u-boot
On Thu, Nov 19, 2020 at 10:08:43AM +0100, Patrick Delaunay wrote:
> Align the prefix used in cmd_ut_category function and name of tests
> for ut str.
> This patch solves the issues detected by "make qcheck" after previous
> patch.
>
> Fixes: fdc79a6b125d ("lib: Add a function to convert a string to upper case")
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.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: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210118/a1ee593f/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-01-18 13:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 9:08 [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Patrick Delaunay
2020-11-19 9:08 ` [PATCH 2/3] test: correct the test prefix in ut cmd_mem Patrick Delaunay
2020-11-21 23:07 ` Simon Glass
2021-01-18 13:00 ` Tom Rini
2020-11-19 9:08 ` [PATCH 3/3] test: correct the test prefix in ut str Patrick Delaunay
2020-11-21 23:07 ` Simon Glass
2021-01-18 13:00 ` Tom Rini
2020-11-21 23:07 ` [PATCH 1/3] test: cmd_ut_category: raise a error when the test is not found Simon Glass
2021-01-16 17:11 ` 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.