Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp7213pxb; Tue, 31 Aug 2021 13:45:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzX6jUxZs+TcC46KM+l3Zo685cWawtspSfV0W+g8iyXiZVxEYgduJn9HjPVXFMlSGIqcdpV X-Received: by 2002:a05:6e02:128b:: with SMTP id y11mr21164113ilq.104.1630442703918; Tue, 31 Aug 2021 13:45:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630442703; cv=none; d=google.com; s=arc-20160816; b=sbfHpuy0XqN4HhJjsrhVZp5mPFdayElwsUU1rNMWqqI9JyRSTcn/ky0FnQ6HxDW7vZ OOy+g6VLE1fV2me8K7aZbgJtUazKkVKbWOsDWQAgmtHGyjP0OTQhWdCPAUoa7EgoqHHj vqGAg01ucA8COmxkW8/kNzJqgg0vJm+1SxNEyj0A7T+0GIHUTbBNs6bWBQtQBdfyAQ+9 5MWpTEkWrWquqxi4XtgA/sAhs9+9InQTIotSXIQsLf8j18BGJsfeQ8gKrmiBGA1nn010 eIigLlI/Ej4iwAJZ8oHMrGBZwiY4+GfPikhcSo4EB1HrhY86ao06vxf0V4pw3+5Rhe/E P0kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mopPPWDUZRS/w1wlTyFoXTy78YTkhMUpVlxA4c+KbU4=; b=tqwvljzZCTxjjeXe9uV51J1HSew8gdAOFAG5Sao2sQbpLE0b7N5wyI/M6gnIueQNMk Ozf1PnzSwWR+4DsS5K7KIw3w0tB+VTW+iKtKGEa17l7z1hxs+u2qyHkG229kdflB5Okw HD9JoqirbFs+j4YwP8CYn/DwIyN10FhfHe+GbQUlXcdtW9hNjiXyS97i/bZmu5AkiMt6 bki5dIoFfDkblPCfEGO/u3al8K/wadphv8pD9T3BCv9iY/MoIfOsZ1WEgCldBsGnuRBl SO0FTHbKVZc/BhNhIn62JwHlkzy+Y3bcVMFYma0vh0vD4YsTMXZm1XbE6bducumWJaLg O5mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="QSAnXt/l"; 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 x6si13233355ilv.93.2021.08.31.13.44.05; Tue, 31 Aug 2021 13:45:03 -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="QSAnXt/l"; 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 S241119AbhHaUnn (ORCPT + 99 others); Tue, 31 Aug 2021 16:43:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241038AbhHaUnm (ORCPT ); Tue, 31 Aug 2021 16:43:42 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B824C061760 for ; Tue, 31 Aug 2021 13:42:47 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id n4so161552plh.9 for ; Tue, 31 Aug 2021 13:42:47 -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=mopPPWDUZRS/w1wlTyFoXTy78YTkhMUpVlxA4c+KbU4=; b=QSAnXt/l+YXwS35Zb7EeTO80O4bG84fSptNL6F97mRyXbnnXvSIBvTrt8uFiDWH24J si4rtmnaiMjSKP2gJo/ZBMHXNhmipGJK0+2jLIcfkYu8O7ExE3zPnNHMSaG0Dhhn/ccA 6e7QHppOo4trMtzqO8B6Io4cqR35gh2fsm1g0014k1UdK3uhwXmPKQkeGQFUNmkPF4eP xvbldCtC/+uSUv8M+1DhE0TwJUjPr37EWBbMSWpqG5chh5zok9DW19n2om4pk3Mn2bt1 DmTPE9Zbtt4xGi8I/e2JpNAVUbKGc1mOg3HhjrxJsHHM3f9t6GpNh6smhFVHozS3R7AB 6zJA== 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=mopPPWDUZRS/w1wlTyFoXTy78YTkhMUpVlxA4c+KbU4=; b=Lm4NKcZhPR9PuGg2tN+ELhuIEuhLks7bgmxLcsw/vbKcZ805aBCPiSAT3y/hXqmCQD PmIz/nx+TvrAFyw7AYU7HTYDb/NpPV61lXDeL6AS+cCannEAaK0ON6o1mReEwgNlBp2x xcEFXQqNiWLoi1aYKvfFNBSrVBywfHrhg5JtMdzOeksnhspYaIm8A0uSvp3q9ODxb9Gx mhhvQ4HzpHGmdCrxtvGXry5Mgozs033nDgTSWaBhrMC2RxeEVEI2jTT3qeLUCRE3JtpB YiQyEUsilNvSLpcjed1tPHGp/5KxcEuOOGRbLHCpJBo3sLEPF7jM7iY+zze/kF4PArzl vX7g== X-Gm-Message-State: AOAM531rPSbIdQA0Y81qdoAz5Po7KDPFUJ9t0EWNsYftCFaNEFjOdcXx 2MhSnkGf95pKvoBg5k4NOv36wpUWl+L8QYNGBFad4Q== X-Received: by 2002:a17:90a:1904:: with SMTP id 4mr7522137pjg.217.1630442566184; Tue, 31 Aug 2021 13:42:46 -0700 (PDT) MIME-Version: 1.0 References: <20210831171926.3832806-1-dlatypov@google.com> In-Reply-To: <20210831171926.3832806-1-dlatypov@google.com> From: Brendan Higgins Date: Tue, 31 Aug 2021 13:42:35 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] kunit: drop assumption in kunit-log-test about current suite To: Daniel Latypov Cc: davidgow@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2021 at 10:19 AM Daniel Latypov wrote: > > This test assumes that the declared kunit_suite object is the exact one > which is being executed, which KUnit will not guarantee [1]. > > Specifically, `suite->log` is not initialized until a suite object is > executed. So if KUnit makes a copy of the suite and runs that instead, > this test dereferences an invalid pointer and (hopefully) segfaults. > > N.B. since we no longer assume this, we can no longer verify that > `suite->log` is *not* allocated during normal execution. > > An alternative to this patch that would allow us to test that would > require exposing an API for the current test to get its current suite. > Exposing that for one internal kunit test seems like overkill, and > grants users more footguns (e.g. reusing a test case in multiple suites > and changing behavior based on the suite name, dynamically modifying the > setup/cleanup funcs, storing/reading stuff out of the suite->log, etc.). > > [1] In a subsequent patch, KUnit will allow running subsets of test > cases within a suite by making a copy of the suite w/ the filtered test > list. But there are other reasons KUnit might execute a copy, e.g. if it > ever wants to support parallel execution of different suites, recovering > from errors and restarting suites > > Signed-off-by: Daniel Latypov Reviewed-by: Brendan Higgins