* [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature
@ 2016-11-22 14:21 Andrew Jones
2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 1/2] report: add lock to report_abort Andrew Jones
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Andrew Jones @ 2016-11-22 14:21 UTC (permalink / raw)
To: kvm; +Cc: rkrcmar, thuth
Andrew Jones (2):
report: add lock to report_abort
report: introduce report_info
lib/libcflat.h | 1 +
lib/report.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread* [kvm-unit-tests PATCH v2 1/2] report: add lock to report_abort 2016-11-22 14:21 [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature Andrew Jones @ 2016-11-22 14:21 ` Andrew Jones 2016-11-22 14:48 ` Thomas Huth 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 2/2] report: introduce report_info Andrew Jones 2016-11-22 15:24 ` [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature Radim Krčmář 2 siblings, 1 reply; 6+ messages in thread From: Andrew Jones @ 2016-11-22 14:21 UTC (permalink / raw) To: kvm; +Cc: rkrcmar, thuth Signed-off-by: Andrew Jones <drjones@redhat.com> --- lib/report.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/report.c b/lib/report.c index 4cd75534f978..2a8b6df1368d 100644 --- a/lib/report.c +++ b/lib/report.c @@ -118,12 +118,14 @@ void report_abort(const char *msg_fmt, ...) { va_list va; + spin_lock(&lock); puts("ABORT: "); puts(prefixes); va_start(va, msg_fmt); vprintf(msg_fmt, va); va_end(va); puts("\n"); + spin_unlock(&lock); report_summary(); abort(); } -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests PATCH v2 1/2] report: add lock to report_abort 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 1/2] report: add lock to report_abort Andrew Jones @ 2016-11-22 14:48 ` Thomas Huth 0 siblings, 0 replies; 6+ messages in thread From: Thomas Huth @ 2016-11-22 14:48 UTC (permalink / raw) To: Andrew Jones, kvm; +Cc: rkrcmar On 22.11.2016 15:21, Andrew Jones wrote: > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > lib/report.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/report.c b/lib/report.c > index 4cd75534f978..2a8b6df1368d 100644 > --- a/lib/report.c > +++ b/lib/report.c > @@ -118,12 +118,14 @@ void report_abort(const char *msg_fmt, ...) > { > va_list va; > > + spin_lock(&lock); > puts("ABORT: "); > puts(prefixes); > va_start(va, msg_fmt); > vprintf(msg_fmt, va); > va_end(va); > puts("\n"); > + spin_unlock(&lock); > report_summary(); > abort(); > } > Reviewed-by: Thomas Huth <thuth@redhat.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* [kvm-unit-tests PATCH v2 2/2] report: introduce report_info 2016-11-22 14:21 [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature Andrew Jones 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 1/2] report: add lock to report_abort Andrew Jones @ 2016-11-22 14:21 ` Andrew Jones 2016-11-22 14:50 ` Thomas Huth 2016-11-22 15:24 ` [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature Radim Krčmář 2 siblings, 1 reply; 6+ messages in thread From: Andrew Jones @ 2016-11-22 14:21 UTC (permalink / raw) To: kvm; +Cc: rkrcmar, thuth Test writers sometimes want to output informational messages, but they don't want to use printf because they want the prefixes as well. Rather than creating "fake" tests that always pass, with report(fmt, true, ...), provide report_info(fmt, ...). This generates 'INFO: prefixes...: message' Signed-off-by: Andrew Jones <drjones@redhat.com> --- lib/libcflat.h | 1 + lib/report.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index 72b1bf9668ef..c622198677c1 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -82,6 +82,7 @@ extern void report(const char *msg_fmt, bool pass, ...); extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...); extern void report_abort(const char *msg_fmt, ...); extern void report_skip(const char *msg_fmt, ...); +extern void report_info(const char *msg_fmt, ...); extern int report_summary(void); extern void dump_stack(void); diff --git a/lib/report.c b/lib/report.c index 2a8b6df1368d..fc0ef494f412 100644 --- a/lib/report.c +++ b/lib/report.c @@ -91,6 +91,20 @@ void report_skip(const char *msg_fmt, ...) va_end(va); } +void report_info(const char *msg_fmt, ...) +{ + va_list va; + + spin_lock(&lock); + puts("INFO: "); + puts(prefixes); + va_start(va, msg_fmt); + vprintf(msg_fmt, va); + va_end(va); + puts("\n"); + spin_unlock(&lock); +} + int report_summary(void) { spin_lock(&lock); -- 2.7.4 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests PATCH v2 2/2] report: introduce report_info 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 2/2] report: introduce report_info Andrew Jones @ 2016-11-22 14:50 ` Thomas Huth 0 siblings, 0 replies; 6+ messages in thread From: Thomas Huth @ 2016-11-22 14:50 UTC (permalink / raw) To: Andrew Jones, kvm; +Cc: rkrcmar On 22.11.2016 15:21, Andrew Jones wrote: > Test writers sometimes want to output informational messages, but > they don't want to use printf because they want the prefixes as > well. Rather than creating "fake" tests that always pass, with > report(fmt, true, ...), provide report_info(fmt, ...). This > generates 'INFO: prefixes...: message' > > Signed-off-by: Andrew Jones <drjones@redhat.com> > --- > lib/libcflat.h | 1 + > lib/report.c | 14 ++++++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/lib/libcflat.h b/lib/libcflat.h > index 72b1bf9668ef..c622198677c1 100644 > --- a/lib/libcflat.h > +++ b/lib/libcflat.h > @@ -82,6 +82,7 @@ extern void report(const char *msg_fmt, bool pass, ...); > extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...); > extern void report_abort(const char *msg_fmt, ...); > extern void report_skip(const char *msg_fmt, ...); > +extern void report_info(const char *msg_fmt, ...); > extern int report_summary(void); > > extern void dump_stack(void); > diff --git a/lib/report.c b/lib/report.c > index 2a8b6df1368d..fc0ef494f412 100644 > --- a/lib/report.c > +++ b/lib/report.c > @@ -91,6 +91,20 @@ void report_skip(const char *msg_fmt, ...) > va_end(va); > } > > +void report_info(const char *msg_fmt, ...) > +{ > + va_list va; > + > + spin_lock(&lock); > + puts("INFO: "); > + puts(prefixes); > + va_start(va, msg_fmt); > + vprintf(msg_fmt, va); > + va_end(va); > + puts("\n"); > + spin_unlock(&lock); > +} > + > int report_summary(void) > { > spin_lock(&lock); > Reviewed-by: Thomas Huth <thuth@redhat.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature 2016-11-22 14:21 [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature Andrew Jones 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 1/2] report: add lock to report_abort Andrew Jones 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 2/2] report: introduce report_info Andrew Jones @ 2016-11-22 15:24 ` Radim Krčmář 2 siblings, 0 replies; 6+ messages in thread From: Radim Krčmář @ 2016-11-22 15:24 UTC (permalink / raw) To: Andrew Jones; +Cc: kvm, thuth 2016-11-22 15:21+0100, Andrew Jones: > Andrew Jones (2): > report: add lock to report_abort > report: introduce report_info Applied, thanks. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-22 15:24 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-11-22 14:21 [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature Andrew Jones 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 1/2] report: add lock to report_abort Andrew Jones 2016-11-22 14:48 ` Thomas Huth 2016-11-22 14:21 ` [kvm-unit-tests PATCH v2 2/2] report: introduce report_info Andrew Jones 2016-11-22 14:50 ` Thomas Huth 2016-11-22 15:24 ` [kvm-unit-tests PATCH v2 0/2] report: one fix, one feature Radim Krčmář
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox