Message ID | 20201127102100.11721-6-patrick.delaunay@st.com |
---|---|
State | Accepted |
Commit | bf80edb91a9b7d61621c1413c15495348f8f0fcc |
Delegated to: | Tom Rini |
Headers | show |
Series | log: don't build the trace buffer when log is not ready | expand |
Hi Patrick, On Fri, 27 Nov 2020 at 03:21, Patrick Delaunay <patrick.delaunay@st.com> wrote: > > Allow to record the console output before before U-Boot > has a console ready. > > This patch allows to test the console output in sandbox test > based on console record. > > It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY > are 2 independent flags. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > --- > > Changes in v2: > - Record all messages in console, even when dropped (NEW) > > common/console.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/common/console.c b/common/console.c > index 70579af042..c3d552bb3e 100644 > --- a/common/console.c > +++ b/common/console.c > @@ -519,6 +519,10 @@ void putc(const char c) > { > if (!gd) > return; > +#ifdef CONFIG_CONSOLE_RECORD Can we use CONFIG_IS_ENABLED() here and avoid the #ifdef? We might need to add some inline functions for the case where console_out is not available. See global_data.h for some examples. > + if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) > + membuff_putbyte((struct membuff *)&gd->console_out, c); > +#endif > #ifdef CONFIG_SANDBOX > /* sandbox can send characters to stdout before it has a console */ > if (!(gd->flags & GD_FLG_SERIAL_READY)) { > @@ -533,10 +537,6 @@ void putc(const char c) > return; > } > #endif > -#ifdef CONFIG_CONSOLE_RECORD > - if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) > - membuff_putbyte((struct membuff *)&gd->console_out, c); > -#endif > #ifdef CONFIG_SILENT_CONSOLE > if (gd->flags & GD_FLG_SILENT) { > if (!(gd->flags & GD_FLG_DEVINIT)) > @@ -567,6 +567,10 @@ void puts(const char *s) > { > if (!gd) > return; > +#ifdef CONFIG_CONSOLE_RECORD > + if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) > + membuff_put((struct membuff *)&gd->console_out, s, strlen(s)); > +#endif > #ifdef CONFIG_SANDBOX > /* sandbox can send characters to stdout before it has a console */ > if (!(gd->flags & GD_FLG_SERIAL_READY)) { > @@ -584,10 +588,6 @@ void puts(const char *s) > return; > } > #endif > -#ifdef CONFIG_CONSOLE_RECORD > - if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) > - membuff_put((struct membuff *)&gd->console_out, s, strlen(s)); > -#endif > #ifdef CONFIG_SILENT_CONSOLE > if (gd->flags & GD_FLG_SILENT) { > if (!(gd->flags & GD_FLG_DEVINIT)) > -- > 2.17.1 > Regards, Simon
Hi Simon, > From: Uboot-stm32 <uboot-stm32-bounces@st-md-mailman.stormreply.com> On > Behalf Of Simon Glass > > Hi Patrick, > > On Fri, 27 Nov 2020 at 03:21, Patrick Delaunay <patrick.delaunay@st.com> > wrote: > > > > Allow to record the console output before before U-Boot has a console > > ready. > > > > This patch allows to test the console output in sandbox test based on > > console record. > > > > It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY are 2 > > independent flags. > > > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > > --- > > > > Changes in v2: > > - Record all messages in console, even when dropped (NEW) > > > > common/console.c | 16 ++++++++-------- > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > diff --git a/common/console.c b/common/console.c index > > 70579af042..c3d552bb3e 100644 > > --- a/common/console.c > > +++ b/common/console.c > > @@ -519,6 +519,10 @@ void putc(const char c) { > > if (!gd) > > return; > > +#ifdef CONFIG_CONSOLE_RECORD > > Can we use CONFIG_IS_ENABLED() here and avoid the #ifdef? We might need to > add some inline functions for the case where console_out is not available. See > global_data.h for some examples. ... > > Regards, > Simon I see this warning when I push this patchset but I preferred sent the path as it, to easy the review as I just move existing line. But in parallel I prepare a other patchset to remove all (or almost all) the #if def CONFIG in console.c I don't sent it yet as I am still solving some compilation issues, but it is solved now.... https://gitlab.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/5431 So I will sent it I few days, after a last review / test. Patrick
On Wed, 2 Dec 2020 at 03:55, Patrick DELAUNAY <patrick.delaunay@st.com> wrote: > > Hi Simon, > > > From: Uboot-stm32 <uboot-stm32-bounces@st-md-mailman.stormreply.com> On > > Behalf Of Simon Glass > > > > Hi Patrick, > > > > On Fri, 27 Nov 2020 at 03:21, Patrick Delaunay <patrick.delaunay@st.com> > > wrote: > > > > > > Allow to record the console output before before U-Boot has a console > > > ready. > > > > > > This patch allows to test the console output in sandbox test based on > > > console record. > > > > > > It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY are 2 > > > independent flags. > > > > > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > > > --- > > > > > > Changes in v2: > > > - Record all messages in console, even when dropped (NEW) > > > > > > common/console.c | 16 ++++++++-------- > > > 1 file changed, 8 insertions(+), 8 deletions(-) > > > > > > diff --git a/common/console.c b/common/console.c index > > > 70579af042..c3d552bb3e 100644 > > > --- a/common/console.c > > > +++ b/common/console.c > > > @@ -519,6 +519,10 @@ void putc(const char c) { > > > if (!gd) > > > return; > > > +#ifdef CONFIG_CONSOLE_RECORD > > > > Can we use CONFIG_IS_ENABLED() here and avoid the #ifdef? We might need to > > add some inline functions for the case where console_out is not available. See > > global_data.h for some examples. > ... > > > > Regards, > > Simon > > I see this warning when I push this patchset but I preferred sent the path as it, > to easy the review as I just move existing line. > > But in parallel I prepare a other patchset to remove all (or almost all) the #if def CONFIG in console.c > > I don't sent it yet as I am still solving some compilation issues, but it is solved now.... > > https://gitlab.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/5431 > > So I will sent it I few days, after a last review / test. OK thanks. Reviewed-by: Simon Glass <sjg@chromium.org>
On Fri, Nov 27, 2020 at 11:20:57AM +0100, Patrick Delaunay wrote: > Allow to record the console output before before U-Boot > has a console ready. > > This patch allows to test the console output in sandbox test > based on console record. > > It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY > are 2 independent flags. > > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> > Reviewed-by: Simon Glass <sjg@chromium.org> Applied to u-boot/master, thanks!
diff --git a/common/console.c b/common/console.c index 70579af042..c3d552bb3e 100644 --- a/common/console.c +++ b/common/console.c @@ -519,6 +519,10 @@ void putc(const char c) { if (!gd) return; +#ifdef CONFIG_CONSOLE_RECORD + if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) + membuff_putbyte((struct membuff *)&gd->console_out, c); +#endif #ifdef CONFIG_SANDBOX /* sandbox can send characters to stdout before it has a console */ if (!(gd->flags & GD_FLG_SERIAL_READY)) { @@ -533,10 +537,6 @@ void putc(const char c) return; } #endif -#ifdef CONFIG_CONSOLE_RECORD - if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) - membuff_putbyte((struct membuff *)&gd->console_out, c); -#endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) { if (!(gd->flags & GD_FLG_DEVINIT)) @@ -567,6 +567,10 @@ void puts(const char *s) { if (!gd) return; +#ifdef CONFIG_CONSOLE_RECORD + if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) + membuff_put((struct membuff *)&gd->console_out, s, strlen(s)); +#endif #ifdef CONFIG_SANDBOX /* sandbox can send characters to stdout before it has a console */ if (!(gd->flags & GD_FLG_SERIAL_READY)) { @@ -584,10 +588,6 @@ void puts(const char *s) return; } #endif -#ifdef CONFIG_CONSOLE_RECORD - if ((gd->flags & GD_FLG_RECORD) && gd->console_out.start) - membuff_put((struct membuff *)&gd->console_out, s, strlen(s)); -#endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) { if (!(gd->flags & GD_FLG_DEVINIT))
Allow to record the console output before before U-Boot has a console ready. This patch allows to test the console output in sandbox test based on console record. It is possible because GD_FLG_RECORD and GD_FLG_SERIAL_READY are 2 independent flags. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> --- Changes in v2: - Record all messages in console, even when dropped (NEW) common/console.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)