Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp6090887ybl; Tue, 27 Aug 2019 14:19:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiX8DCh2JE/qK/qnSG4ZQuNBRsTngigECCA9CSHcZBtZMREKfxXOsl7ltwgJxy2l4CBsEH X-Received: by 2002:a17:902:5c3:: with SMTP id f61mr931002plf.98.1566940754214; Tue, 27 Aug 2019 14:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566940754; cv=none; d=google.com; s=arc-20160816; b=BV+8ZkQiUVYwBnpnXj02Nl7LDYzqupLDAV/k33hDdHbdmcId+ZYRaZT5HZka49iIwN 0lE7Blh6PgNN62mqliAc2/NmL52msWgfJyrpE6ktHAb7KYw6Kb6qja4uNSqroM7l9nMr /w3o5FLJ+ius0017ZhLXoo4yZPYxyIgZ6fjX8BVfFz0u7hzNoPVlXT+ioFXXAmIiPbb7 rrifGZhjNCor7OO0dUF+VyXvxR+R2/rbYDHMfQpedWK9ymt5t6GBKgXwXeR5A0b5/Qsq A6FbwaB6FXweQLKrbk0p7DfcL4JI6ajxt0eG2tG8WpQBpllAfQCLmRzBUwDiFcvN4IQG +D4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=KmsPpVCg+4sPneX49615VeEkJ/NqHJEk1K5Ly0WFCLY=; b=d6M5jhc+8MH9ihGRP5eMfNlKAVfqYcwCHG4vO1KaR1RqEW89E9fF6aLqQ9hg+txwSV EX3JMj2UeJvnoS5Hq4xgsDLdIFn9AHomPeUnsOtA/JuLGDlS5qJFb5RtcDuYjMMFwtSJ fQbrBtRzmC9trf8fskb7nekh7hvhuIVVER8xunnaFKs1YgD8UDMeQtQz9vaoJtEDgJVc W9MFthkXSjg9vMB25PsFv5jzLKNag5MvSrVo+wQ7sxKS4y/uBZ3RhNU6CsXytYBTaDgB M7whbHYDv8HwfELZsqwH3yc9YG5lkCSYsFc+Mh12m5E2UG8ZyxxwA9eeXjHdfU7Qs3ZI sJaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IAgAkU2n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91si193701pld.200.2019.08.27.14.18.57; Tue, 27 Aug 2019 14:19:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IAgAkU2n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730739AbfH0VQS (ORCPT + 99 others); Tue, 27 Aug 2019 17:16:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:41072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbfH0VQR (ORCPT ); Tue, 27 Aug 2019 17:16:17 -0400 Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 17F052077B; Tue, 27 Aug 2019 21:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566940576; bh=u30Uz09Wx2ggUD73DFEm5M/io8JmvBjC1sc4Al1XFHQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=IAgAkU2nr5hXEHlEhoptezUoZexB8Usy+XlQ9/QA/yLIyVcuZoLA+roUi38RfFU/0 mMxHWf8D+IsNFj56WNGfCFmuniMm8jEvTI/VCfyH/k/eKBQv6HTIEVmEIYiBl9Wy1s hIAjsrdq8c0wPdj9++BGGhi0zQwDOZEVgKvAZymc= Subject: Re: [PATCH v1] kunit: fix failure to build without printk To: Randy Dunlap , Brendan Higgins Cc: kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, frowand.list@gmail.com, sboyd@kernel.org, Stephen Rothwell , shuah References: <20190827174932.44177-1-brendanhiggins@google.com> <5b626f60-8472-a97e-378e-755160e5d948@infradead.org> From: shuah Message-ID: <15c04ce1-020f-a286-07fe-c1b883c44b1b@kernel.org> Date: Tue, 27 Aug 2019 15:16:15 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <5b626f60-8472-a97e-378e-755160e5d948@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/27/19 2:53 PM, Randy Dunlap wrote: > On 8/27/19 1:21 PM, shuah wrote: >> On 8/27/19 11:49 AM, Brendan Higgins wrote: >>> Previously KUnit assumed that printk would always be present, which is >>> not a valid assumption to make. Fix that by ifdefing out functions which >>> directly depend on printk core functions similar to what dev_printk >>> does. >>> >>> Reported-by: Randy Dunlap >>> Link: https://lore.kernel.org/linux-kselftest/0352fae9-564f-4a97-715a-fabe016259df@kernel.org/T/#t >>> Cc: Stephen Rothwell >>> Signed-off-by: Brendan Higgins >>> --- >>>   include/kunit/test.h |  7 +++++++ >>>   kunit/test.c         | 41 ++++++++++++++++++++++++----------------- >>>   2 files changed, 31 insertions(+), 17 deletions(-) >>> >>> diff --git a/include/kunit/test.h b/include/kunit/test.h >>> index 8b7eb03d4971..339af5f95c4a 100644 >>> --- a/include/kunit/test.h >>> +++ b/include/kunit/test.h >>> @@ -339,9 +339,16 @@ static inline void *kunit_kzalloc(struct kunit *test, size_t size, gfp_t gfp) >>>     void kunit_cleanup(struct kunit *test); >>>   +#ifdef CONFIG_PRINTK >> >> Please make this #if defined(CONFIG_PRINTK) > > explain why, please? > > thanks. > This can be used to do compound logic. I have been using this style for that reason starting a couple of years now. I seem to work in code paths where I have to look for multiple config vars. In this case, it probably doesn't matter as much either way. thanks, -- Shuah