Message ID | 1537285878-27148-1-git-send-email-penghao122@sina.com.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kvm-unit-tests: unlock before calling return | expand |
On 09/18/2018 08:51 AM, Peng Hao wrote: > From: Peng Hao <peng.hao2@zte.com.cn> > > Signed-off-by: Peng Hao <peng.hao2@zte.com.cn> > --- > lib/report.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/lib/report.c b/lib/report.c > index 5da27ab..ca9b4fd 100644 > --- a/lib/report.c > +++ b/lib/report.c > @@ -66,8 +66,10 @@ void report_prefix_pop(void) > > spin_lock(&lock); > > - if (!*prefixes) > + if (!*prefixes) { > + spin_unlock(&lock); > return; > + } > > for (p = prefixes, q = strstr(p, PREFIX_DELIMITER) + 2; > *q; > @@ -142,6 +144,7 @@ void report_info(const char *msg_fmt, ...) > > int report_summary(void) > { > + int ret; > spin_lock(&lock); > > printf("SUMMARY: %d tests", tests); > @@ -153,14 +156,16 @@ int report_summary(void) > printf(", %d skipped", skipped); > printf("\n"); > > - if (tests == skipped) > + if (tests == skipped) { > + spin_unlock(&lock); > /* Blame AUTOTOOLS for using 77 for skipped test and QEMU for > * mangling error codes in a way that gets 77 if we ... */ > return 77 >> 1; > + } > > - return failures > 0 ? 1 : 0; > - > + ret = failures > 0 ? 1 : 0; > spin_unlock(&lock); > + return ret; > } > > void report_abort(const char *msg_fmt, ...) Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
On 18/09/2018 23:03, Krish Sadhukhan wrote:
> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Queued, thanks.
Paolo
diff --git a/lib/report.c b/lib/report.c index 5da27ab..ca9b4fd 100644 --- a/lib/report.c +++ b/lib/report.c @@ -66,8 +66,10 @@ void report_prefix_pop(void) spin_lock(&lock); - if (!*prefixes) + if (!*prefixes) { + spin_unlock(&lock); return; + } for (p = prefixes, q = strstr(p, PREFIX_DELIMITER) + 2; *q; @@ -142,6 +144,7 @@ void report_info(const char *msg_fmt, ...) int report_summary(void) { + int ret; spin_lock(&lock); printf("SUMMARY: %d tests", tests); @@ -153,14 +156,16 @@ int report_summary(void) printf(", %d skipped", skipped); printf("\n"); - if (tests == skipped) + if (tests == skipped) { + spin_unlock(&lock); /* Blame AUTOTOOLS for using 77 for skipped test and QEMU for * mangling error codes in a way that gets 77 if we ... */ return 77 >> 1; + } - return failures > 0 ? 1 : 0; - + ret = failures > 0 ? 1 : 0; spin_unlock(&lock); + return ret; } void report_abort(const char *msg_fmt, ...)