Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp27613ybt; Tue, 23 Jun 2020 14:22:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8dMf8G7nMrJ81mu5ZmVLFC7wNN2sG6+JdClI0SN8kz165G6RsgKitANZiehjsp4ZzThFQ X-Received: by 2002:aa7:c314:: with SMTP id l20mr8635126edq.150.1592947351522; Tue, 23 Jun 2020 14:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592947351; cv=none; d=google.com; s=arc-20160816; b=bpwtf7/stnzqfT7q993mQjs9KY9TIk486TdMx5PhSai6reHjQYOCFmDlXCujY5L9jd rU1u2cUCkrSDditX203xOiwGUXR/kIkNPdRrlX5n/Kbt2a7RsLvuwHl6a4TWNOMm2ktH VuOH4Q0xu+AL5Do1WqcLtYNBD3X7ICyFru3fY56mXq6DBIYsDarJYoVLd9v6ZnttPf0Q OyvhXPInGvEjd0OSA0Nj5usB3sxaWSkLrWJW9NXwvpRBPdGz+HKaZsw69uxREy1K7bR7 9ECWBQ4wdi4r9/4L/BjKkCkRyPJkCPH2t5EPM2nQfmDae6XUhCTHp7ud2KEsEOFTybxs gX0Q== 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=mJWzvNZU1DMsijzcM8pSgSd+l6gBq4CZTTDgQGADwPk=; b=ynEWNbiPZFKmPUfq5jzR6tGNr0MJCHnv/h9NhEavDkj84rEGbnDv+zvL4mIO+oVFJT XRWWSKw2gJ95BAuw/lTJ2gd+nAzTPbjFZANdDD6uwyzBBaGhgUKmU+lUUcNpWkjJ120J aGlhPZ3g/y/0ZXSi9HRf1qso3xCt3EXb6TkgfbKRSKVZjEjxskZ3soxLlRVVXq9dMnFY qhCcaeIHgvwEJ4UQGCw9VjeqX0GbC6zd9XNDt3SrdjvOile4HmpF9Kyg095s6gIOcT6Z OPqw3kXlCxI+kcwDfZQt0bPUpp3Qx8jk9v1fOaPG9ZRVIEquInlahcQs84X3nMCeO7Dc YB6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=d3UM5mS3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by12si2105504edb.99.2020.06.23.14.22.08; Tue, 23 Jun 2020 14:22:31 -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=@google.com header.s=20161025 header.b=d3UM5mS3; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393453AbgFWVS6 (ORCPT + 99 others); Tue, 23 Jun 2020 17:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393445AbgFWVSt (ORCPT ); Tue, 23 Jun 2020 17:18:49 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2C57C061755 for ; Tue, 23 Jun 2020 14:18:49 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id x11so9674809plo.7 for ; Tue, 23 Jun 2020 14:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mJWzvNZU1DMsijzcM8pSgSd+l6gBq4CZTTDgQGADwPk=; b=d3UM5mS3Lwn1zCoUYBgL4MOdtaGDbpZ45FPQQmIiPWsUMcrblQ5pb3qHERiGLD+POo npuxt5fXnoKsGH+DKJAJ+ul8Y6EIbNJlyhdRsgqhAJJVelU3+pcBdfBAZbEE0IALc384 HvWlGLE8Lxqn759AEnWNmPzbSamSO0pLN7FZSwLXeXqyRZnZlzI1T+dLxqjN669bHpfc 4PUyBqpVX/KHW0QckUDmH8mwi2foQLWmoCOCWIHp9tf3Vad3W1LL3blo7BhXrgl1U32a ZjXCghkz45tieXrFU8exdMXC0j/7LeiqFZ1w/Xc8XlOUWq/TprLg9rEQAMqc44FXv3Xc rFQQ== 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=mJWzvNZU1DMsijzcM8pSgSd+l6gBq4CZTTDgQGADwPk=; b=ED+ce+h2FL1cBUY4SAMFta5qdZcNx9QPC4RNCP+/ADSnkQjkMWJKWVdJv+T8Vi8csG h0rQBbhB+txVRg1C+OETm21UUMrp6M/I9xWnbDV6owuYM7V7SkIh8+oLFW1dq/yyCjBU MiV2HObC9WDUBkBPmO6VSV+LqJeo8gbgYU1aikd8MXQcV/FLcvuni8M3uG7BM6gHTXyi 2JfIaidu4GbDtGCjZt3H5qWK0u8nnly5djtQDKnPkILSWATeQe8U51tbV7vrM0YESk1B piPTyqJFk7xlpexb1FsWxKtovffPuoHaruvdVORtBGe+1+FgwyiK/6xNkiKzRTcpJWDM NAfw== X-Gm-Message-State: AOAM5338XhEkP6O0ri0m/d0lmvTQ9Lo76qcA1e7zMa65vTqrszsGcyGN ykOvX/rlZC1z3EQobDlMWh/pDeSP4RTZNLPajzzqoA== X-Received: by 2002:a17:902:32d:: with SMTP id 42mr15721221pld.297.1592947128738; Tue, 23 Jun 2020 14:18:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Brendan Higgins Date: Tue, 23 Jun 2020 14:18:37 -0700 Message-ID: Subject: Re: RFC: KTAP documentation - expected messages To: David Gow , Dmitry Vyukov Cc: Frank Rowand , "Bird, Tim" , "shuah@kernel.org" , "linux-kselftest@vger.kernel.org" , Kees Cook , Paolo Bonzini , "linux-kernel@vger.kernel.org" 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 Mon, Jun 22, 2020 at 7:47 PM David Gow wrote: > > On Mon, Jun 22, 2020 at 6:45 AM Frank Rowand wrote: > > > > Tim Bird started a thread [1] proposing that he document the selftest result > > format used by Linux kernel tests. > > > > [1] https://lore.kernel.org/r/CY4PR13MB1175B804E31E502221BC8163FD830@CY4PR13MB1175.namprd13.prod.outlook.com > > > > The issue of messages generated by the kernel being tested (that are not > > messages directly created by the tests, but are instead triggered as a > > side effect of the test) came up. In this thread, I will call these > > messages "expected messages". Instead of sidetracking that thread with > > a proposal to handle expected messages, I am starting this new thread. > > Thanks for doing this: I think there are quite a few tests which could > benefit from something like this. > > I think there were actually two separate questions: what do we do with > unexpected messages (most of which I expect are useless, but some of > which may end up being related to an unexpected test failure), and how > to have tests "expect" a particular message to appear. I'll stick to > talking about the latter for this thread, but even there there's two > possible interpretations of "expected messages" we probably want to > explicitly distinguish between: a message which must be present for > the test to pass (which I think best fits the "expected message" > name), and a message which the test is likely to produce, but which > shouldn't alter the result (an "ignored message"). I don't see much > use for the latter at present, but if we wanted to do more things with > messages and had some otherwise very verbose tests, it could > potentially be useful. +Dmitry Vyukov, I think you were interested in this for KASAN before we went with the signalling approach. Any thoughts? > The other thing I'd note here is that this proposal seems to be doing > all of the actual message filtering in userspace, which makes a lot of > sense for kselftest tests, but does mean that the kernel can't know if > the test has passed or failed. There's definitely a tradeoff between > trying to put too much needless string parsing in the kernel and > having to have a userland tool determine the test results. The > proposed KCSAN test suite[1] is using tracepoints to do this in the > kernel. It's not the cleanest thing, but there's no reason KUnit or > similar couldn't implement a nicer API around it. > > [1]: https://lkml.org/lkml/2020/6/22/1506 > > > I implemented an API for expected messages that are triggered by tests > > in the Devicetree unittest code, with the expectation that the specific > > details may change when the Devicetree unittest code adapts the KUnit > > API. It seems appropriate to incorporate the concept of expected > > messages in Tim's documentation instead of waiting to address the > > subject when the Devicetree unittest code adapts the KUnit API, since > > Tim's document may become the kernel selftest standard. > > Is having a nice way to handle expected messages the only thing > holding up porting this to KUnit? > > > Instead of creating a very long email containing multiple objects, > > I will reply to this email with a separate reply for each of: > > > > The "expected messages" API implemention and use can be from > > drivers/of/unittest.c in the mainline kernel. > > > > of_unittest_expect - A proof of concept perl program to filter console > > output containing expected messages output > > > > of_unittest_expect is also available by cloning > > https://github.com/frowand/dt_tools.git > > > > An example raw console output with timestamps and expect messages. > > > > An example of console output processed by filter program > > of_unittest_expect to be more human readable. The expected > > messages are not removed, but are flagged. > > > > An example of console output processed by filter program > > of_unittest_expect to be more human readable. The expected > > messages are removed instead of being flagged. > > Cheers, > -- David