From patchwork Tue Oct 31 08:29:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 10033723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B3814600C5 for ; Tue, 31 Oct 2017 08:29:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0016289B6 for ; Tue, 31 Oct 2017 08:29:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9367D289CB; Tue, 31 Oct 2017 08:29:57 +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=-6.9 required=2.0 tests=BAYES_00,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 0D897289B6 for ; Tue, 31 Oct 2017 08:29:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752769AbdJaI34 (ORCPT ); Tue, 31 Oct 2017 04:29:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34010 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751746AbdJaI3z (ORCPT ); Tue, 31 Oct 2017 04:29:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1DAFE2CE965; Tue, 31 Oct 2017 08:29:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1DAFE2CE965 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=eguan@redhat.com Received: from localhost (dhcp-12-147.nay.redhat.com [10.66.12.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 929C65D6A9; Tue, 31 Oct 2017 08:29:54 +0000 (UTC) From: Eryu Guan To: fstests@vger.kernel.org Cc: Fengguang Wu , Eryu Guan Subject: [PATCH] common/rc: insert a line to dmesg on intentional WARNINGs Date: Tue, 31 Oct 2017 16:29:20 +0800 Message-Id: <20171031082920.31182-1-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 31 Oct 2017 08:29:55 +0000 (UTC) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We already filtered out intentional WARNINGs from dmesg in _check_dmesg(), but 3rd party dmesg parsers, e.g. LKP 0day test robot, don't know that it's not a test failure in such cases. So per Fengguang's request, insert a message to dmesg to indicate that the WARNINGs in this test are intentional, external dmesg parsers could take proper actions based on this message. Signed-off-by: Eryu Guan --- common/rc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/common/rc b/common/rc index e2a8229f08bc..80fb47c74028 100644 --- a/common/rc +++ b/common/rc @@ -3295,12 +3295,21 @@ _check_dmesg() # default filter is a simple cat command, caller could provide a # customized filter and pass the name through the first argument, to # filter out intentional WARNINGs or Oopses - filter=${1:-cat} + local filter=${1:-cat} + local changed=false # search the dmesg log of last run of $seqnum for possible failures # use sed \cregexpc address type, since $seqnum contains "/" dmesg | tac | sed -ne "0,\#run fstests $seqnum at $date_time#p" | \ - tac | $filter >$seqres.dmesg + tac >$seqres.dmesg.orig + + # check if $filter filtered out intentional warnings + cat $seqres.dmesg.orig | $filter > $seqres.dmesg + if ! diff $seqres.dmesg.orig $seqres.dmesg >/dev/null 2>&1; then + changed=true + fi + rm -f $seqres.dmesg.orig + egrep -q -e "kernel BUG at" \ -e "WARNING:" \ -e "BUG:" \ @@ -3311,13 +3320,20 @@ _check_dmesg() -e "INFO: possible circular locking dependency detected" \ -e "general protection fault:" \ $seqres.dmesg + if [ $? -eq 0 ]; then _dump_err "_check_dmesg: something found in dmesg (see $seqres.dmesg)" return 1 - else - rm -f $seqres.dmesg - return 0 fi + + # test passed dmesg check, then insert a PLEASE IGNORE message to dmesg + # if $changed is true, to let 3rd party dmesg parser, e.g. 0day test + # robot, know that it's not a test failure + if $changed; then + echo "fstests $seqnum: INTENTIONAL WARNINGS, PLEASE IGNORE" > /dev/kmsg + fi + rm -f $seqres.dmesg + return 0 } # don't check dmesg log after test