Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2580166ybt; Mon, 22 Jun 2020 01:54:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywf7Fs2FRRu/D4KV6EIvq09IMjmPZ0wZrFMyqb38Fs6KvUF9wOzhj2oqrLSiHZbcJLiQSU X-Received: by 2002:a17:907:4096:: with SMTP id nm6mr14881761ejb.4.1592816079587; Mon, 22 Jun 2020 01:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592816079; cv=none; d=google.com; s=arc-20160816; b=A4925XWg0bhxtCBf5CdVb9jl8lemTN0ybksEKEL+yymiQG9hu2NHy0gpsgVxpaJnab SGYwVp93ceEXfydhMWBN1H9z7+y7+axOK9F93AAu02MKZJ0cwaA0GliP8OOO7vGxgg5c WhUjwru85U0FpVWrkh+W9ltZ0i9IYGjF1rlxwu4KeF/jAEZNW0OesLfouPjD+rbX2CHe e/GaOz97JMo5yfiE8E0MeFNcwWRrDt1cD7Evc7d5V7O7ClXSIXm5KhRWNutAnoJ9ATKF 8wAcYxfUsIPjwoiIMPUSbY9rLJXCORdZ4i5DVaS4RxOolPmSrUtWYPP9wjDhoqZEfgwj iv1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5iSOzHwBaotY/UIRNioAEBuXDPVG7zu4qxXMNrK9fyc=; b=FP2YmuLWJLlrc9mm9PmXoMDPTqalb59IQxuvaX3jfCYEXmNNFBV400rMJ9zZ4ro2YM xUHsyPFk+vazbjeCBP15w1LiLaz/D79jf4Ovc7+Ojf+rutwpX3d6rLpCGsFjksHwBLVj 6IV3W6YlXoS3eKSn5g2GzQOW9J3BpPXW3Js9/vWcOrKC2jTzuACErwdEH/gqaBKnQMcX Q8Bhw1NzfB3YnddyJS8iGB6drBNefMO4NsT4hyik8/TeZ8P5gU5V+NIXg5IZ9rvkgfSB PVh05sSvbTY08EI/EvOAsEAiaiAYZhBi5ELq/K7L7ZsfJBpKINDHMwCunUdh5Pa7tDN/ uN8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g1brCWmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sb21si8518862ejb.385.2020.06.22.01.54.17; Mon, 22 Jun 2020 01:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g1brCWmw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727004AbgFVIvx (ORCPT + 99 others); Mon, 22 Jun 2020 04:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725952AbgFVIvx (ORCPT ); Mon, 22 Jun 2020 04:51:53 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754FAC061795 for ; Mon, 22 Jun 2020 01:51:52 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id n23so18317608ljh.7 for ; Mon, 22 Jun 2020 01:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5iSOzHwBaotY/UIRNioAEBuXDPVG7zu4qxXMNrK9fyc=; b=g1brCWmwJtbkSmFV9tqet1ryr9ApeCcCobA98O+cU+FVDj94qF4u9u0ipyjv7QP2qo 21prTrr4rLVKagZO1Ra+ay+gNxNr917nLzNVLjeCbu4H8rSqpfyjR3kLirlWPjVNhK+T 6QeOABhjPryupAkfoIxNCmCs1oKwrRJYxQQUcWvqw0So+1UGczY8TbVrX0AdRZxSHDUO UIR2+jQozywcAJJqc3Mlk6cLafjWJ1imBHjeftPy7Mr7Ml7HMaV+jqn/W2D4waHIkcom J1L6fq9amVsuNkhjxaOkV2BUbByvpCXBuzl8LU/7fNF4G3bmFcAly/3OtqShrxr7ehiG TyBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5iSOzHwBaotY/UIRNioAEBuXDPVG7zu4qxXMNrK9fyc=; b=siuZT0UxidXTeoo9El6DK/e+Qzsn/ShO8JUi4+amnWl7kTvyZ1odp2oGSrB8TArudJ v6QtQ9W1BHhXFevkvfm9lvGLQxENu8Sl7CxYB5FHkBcCNMRWh9zKx1La+Omx9LqJ8cwI uafOyV5KDsmLdsjWre8JiI6HmHZwupbcBRrvnLvHJAbVmlmk74RD3CJOGSEdI2UVcYpv u2Ff7+M88xZvb+Fvv5WS9Odm+a55XU1bfSIwCa6HFtRYyV15EzJYKUl/F6ZPZZ58lymx /8WhX3ras02/rlugcVgBYkDW1XFlwsB19QS9Wo0nbDj+CaSUGgkiUSZrne0anpGk9urv hmBA== X-Gm-Message-State: AOAM530jqEe7eNG0K6UKsWFu6fN206cSYEilpnBbhEXafV5L3iOhwmcZ y9ErayBfMlvkHMIC+4a56RdYG/IIN0/X4cH+j7zSkA== X-Received: by 2002:a05:651c:318:: with SMTP id a24mr7713808ljp.55.1592815910815; Mon, 22 Jun 2020 01:51:50 -0700 (PDT) MIME-Version: 1.0 References: <20200508065356.2493343-1-mpe@ellerman.id.au> In-Reply-To: <20200508065356.2493343-1-mpe@ellerman.id.au> From: Naresh Kamboju Date: Mon, 22 Jun 2020 14:21:38 +0530 Message-ID: Subject: Re: [PATCH 1/2] selftests/lkdtm: Don't clear dmesg when running tests To: Michael Ellerman , Joe Lawrence , "open list:KERNEL SELFTEST FRAMEWORK" , open list Cc: Kees Cook , Anders Roxell , =?UTF-8?B?RGFuaWVsIETDrWF6?= , Justin Cook , lkft-triage@lists.linaro.org, Miroslav Benes , Petr Mladek , Shuah Khan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 May 2020 at 12:23, Michael Ellerman wrote: > > It is Very Rude to clear dmesg in test scripts. That's because the > script may be part of a larger test run, and clearing dmesg > potentially destroys the output of other tests. > > We can avoid using dmesg -c by saving the content of dmesg before the > test, and then using diff to compare that to the dmesg afterward, > producing a log with just the added lines. > > Signed-off-by: Michael Ellerman > --- > tools/testing/selftests/lkdtm/run.sh | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/lkdtm/run.sh b/tools/testing/selftests/lkdtm/run.sh > index dadf819148a4..0b409e187c7b 100755 > --- a/tools/testing/selftests/lkdtm/run.sh > +++ b/tools/testing/selftests/lkdtm/run.sh > @@ -59,23 +59,25 @@ if [ -z "$expect" ]; then > expect="call trace:" > fi > > -# Clear out dmesg for output reporting > -dmesg -c >/dev/null > - > # Prepare log for report checking > -LOG=$(mktemp --tmpdir -t lkdtm-XXXXXX) > +LOG=$(mktemp --tmpdir -t lkdtm-log-XXXXXX) > +DMESG=$(mktemp --tmpdir -t lkdtm-dmesg-XXXXXX) > cleanup() { > - rm -f "$LOG" > + rm -f "$LOG" "$DMESG" > } > trap cleanup EXIT > > +# Save existing dmesg so we can detect new content below > +dmesg > "$DMESG" > + > # Most shells yell about signals and we're expecting the "cat" process > # to usually be killed by the kernel. So we have to run it in a sub-shell > # and silence errors. > ($SHELL -c 'cat <(echo '"$test"') >'"$TRIGGER" 2>/dev/null) || true > > # Record and dump the results > -dmesg -c >"$LOG" > +dmesg | diff --changed-group-format='%>' --unchanged-group-format='' "$DMESG" - > "$LOG" || true We are facing problems with the diff `=%>` part of the option. This report is from the OpenEmbedded environment. We have the same problem from livepatch_testcases. # selftests lkdtm BUG.sh lkdtm: BUG.sh_ # # diff unrecognized option '--changed-group-format=%>' unrecognized: option_'--changed-group-format=%>' # # BusyBox v1.27.2 (2020-03-30 164108 UTC) multi-call binary. v1.27.2: (2020-03-30_164108 # # : _ # # Usage diff [-abBdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2 diff: [-abBdiNqrTstw]_[-L # # BUG missing 'kernel BUG at' [FAIL] Full test output log, https://qa-reports.linaro.org/lkft/linux-next-oe/build/next-20200621/testrun/2850083/suite/kselftest/test/lkdtm_BUG.sh/log -- Linaro LKFT https://lkft.linaro.org