From patchwork Tue Dec 18 09:26:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 10735265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3ADA6C2 for ; Tue, 18 Dec 2018 09:29:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4AF829AAE for ; Tue, 18 Dec 2018 09:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8F5A29B59; Tue, 18 Dec 2018 09:29:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5153529AAE for ; Tue, 18 Dec 2018 09:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726672AbeLRJ3g (ORCPT ); Tue, 18 Dec 2018 04:29:36 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:48248 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbeLRJ3d (ORCPT ); Tue, 18 Dec 2018 04:29:33 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBI9Sa5d145357 for ; Tue, 18 Dec 2018 04:29:32 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2pev5j695b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Dec 2018 04:29:32 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Dec 2018 09:29:30 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 18 Dec 2018 09:29:28 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBI9TRiQ56623112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 18 Dec 2018 09:29:27 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 53D644203F; Tue, 18 Dec 2018 09:29:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22CAA42041; Tue, 18 Dec 2018 09:29:27 +0000 (GMT) Received: from s38lp20.lnxne.boe (unknown [9.152.224.44]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 18 Dec 2018 09:29:27 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, david@redhat.com, thuth@redhat.com Subject: [kvm-unit-tests RFC v3 13/13] lib/report: Add stamps to reports Date: Tue, 18 Dec 2018 10:26:57 +0100 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181218092657.46466-1-frankja@linux.ibm.com> References: <20181218092657.46466-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18121809-0028-0000-0000-0000032C1B15 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121809-0029-0000-0000-000023E87611 Message-Id: <20181218092657.46466-14-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-18_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812180085 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Lets add a function to get stamps for our reports. It'll help with finding the test case that was causing problems in dumps. Signed-off-by: Janosch Frank --- I know this should be a common discussion and it will be later. But first I want to get a few opinions here, especially about how to wire that up. Using ifdefs? Enabling via argv? My current plan for s390 is to register a wrapper of time_get_ns() that prints "[%ld]" as the stamp prefix. As other archs might have other values or might want to include the cpu# I kept it as generic as possible. --- lib/libcflat.h | 1 + lib/report.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index 7529958..4d462f8 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -98,6 +98,7 @@ extern int vsnprintf(char *buf, int size, const char *fmt, va_list va) extern int vprintf(const char *fmt, va_list va) __attribute__((format(printf, 1, 0))); +extern void report_register_stamp(char * (*func)(void)); void report_prefix_pushf(const char *prefix_fmt, ...) __attribute__((format(printf, 1, 2))); extern void report_prefix_push(const char *prefix); diff --git a/lib/report.c b/lib/report.c index ca9b4fd..586db63 100644 --- a/lib/report.c +++ b/lib/report.c @@ -16,9 +16,17 @@ static unsigned int tests, failures, xfailures, skipped; static char prefixes[256]; static struct spinlock lock; +static char * (*stamp_func)(void); #define PREFIX_DELIMITER ": " +void report_register_stamp(char * (*func)(void)) +{ + spin_lock(&lock); + stamp_func = func; + spin_unlock(&lock); +} + void report_pass(void) { spin_lock(&lock); @@ -90,6 +98,8 @@ static void va_report(const char *msg_fmt, spin_lock(&lock); tests++; + if (stamp_func) + printf("%s ", stamp_func()); printf("%s: ", prefix); puts(prefixes); vprintf(msg_fmt, va);