From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4AB5C32750 for ; Tue, 13 Aug 2019 07:57:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 984DF206C2 for ; Tue, 13 Aug 2019 07:57:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fWxvwQ8J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727891AbfHMH5q (ORCPT ); Tue, 13 Aug 2019 03:57:46 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36348 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbfHMH5p (ORCPT ); Tue, 13 Aug 2019 03:57:45 -0400 Received: by mail-pg1-f193.google.com with SMTP id l21so50829552pgm.3 for ; Tue, 13 Aug 2019 00:57:45 -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=Qxe9OCB0IqyHnARJf+JfT+i9JEoP4MCbV860ULsGU5s=; b=fWxvwQ8Jg+CWf05NnJCeSWeVicnOoXy6BXG5VhOfTHwJWFVTHFtRdcNqJwjLSDCsVu jiiP3AZW2TJ9Y27gYXlQWYVFyW9cOeHAtkBDWUX3YWHKBu/HS+LKFfPpeMSX6W2l72tZ BRhzYAO288V5DleisjNQBfRbcy/Mz40/cEOLiUMhsZ95Bxp04BvhX0q6796bywFqCBqp NSnYasYkCLB4Txnd4bsLfaw/UOxBpmRM2L4ZKLjuNJtySeAykDmMbqKDwEkFdZmfV7CY oOe6Xd9hvm7QvXiKG5lkjN3mPEgj0ajH3yxwTU51S77P9cnCG7u1CaWqpN7xPuHVgKBk pF4g== 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=Qxe9OCB0IqyHnARJf+JfT+i9JEoP4MCbV860ULsGU5s=; b=A6rE1pIH7+gpybkMkIO0DXkNMZHXK0Tcn2lAgo1a1YLnS4vhONRIJpjFT8dfMhAg99 /D70zcCiUxvBHnaMkU4lk83KVQGdfQMDwJhkOreUm7zCG3DRqX5Dzxq/RW2/XczlYnxS bhdvppRc7dvj3rGg3tJXGl2WrqlgKBYloqJJvWbr4YqwRy3+TMZuFQunIM7PQqciAo6V WsF6zp6NAzjgHE+zGaUMpX2Ou1laHXESdIXi4GFXYRboDoqHO8aWpBswWCPbrH0wOtOc O50kvl1TR8ECqtVREMrB7S0MwWQEzBp6ZIuh+ofeMB/uHCJc+kPm4SJVWUOLYDkbZUC5 dQeA== X-Gm-Message-State: APjAAAWxKqmRpfGod6Q6Z9XzTUuVJ82q6p4gWS7VmShEIoA0kX125ClL Rl3S8ZifBxpP6ucIDDgXWe1VPE0PZBNaedzL/O81OA== X-Google-Smtp-Source: APXvYqzWk2rxD82fR19g3JsVNBllToOJJzR2xQFo11AJZitYxxxUqNbN9+PHkwurw7oZzFeN69t+CYdvTXIlmBWBICY= X-Received: by 2002:a63:205f:: with SMTP id r31mr31222917pgm.159.1565683064346; Tue, 13 Aug 2019 00:57:44 -0700 (PDT) MIME-Version: 1.0 References: <20190812182421.141150-1-brendanhiggins@google.com> <20190812182421.141150-13-brendanhiggins@google.com> <20190813043140.67FF320644@mail.kernel.org> In-Reply-To: <20190813043140.67FF320644@mail.kernel.org> From: Brendan Higgins Date: Tue, 13 Aug 2019 00:57:33 -0700 Message-ID: Subject: Re: [PATCH v12 12/18] kunit: test: add tests for KUnit managed resources To: Stephen Boyd Cc: Frank Rowand , Greg KH , Josh Poimboeuf , Kees Cook , Kieran Bingham , Luis Chamberlain , Peter Zijlstra , Rob Herring , shuah , "Theodore Ts'o" , Masahiro Yamada , devicetree , dri-devel , kunit-dev@googlegroups.com, "open list:DOCUMENTATION" , linux-fsdevel@vger.kernel.org, linux-kbuild , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , linux-nvdimm , linux-um@lists.infradead.org, Sasha Levin , "Bird, Timothy" , Amir Goldstein , Dan Carpenter , Daniel Vetter , Jeff Dike , Joel Stanley , Julia Lawall , Kevin Hilman , Knut Omang , Logan Gunthorpe , Michael Ellerman , Petr Mladek , Randy Dunlap , Richard Weinberger , David Rientjes , Steven Rostedt , wfg@linux.intel.com, Avinash Kondareddy Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Aug 12, 2019 at 9:31 PM Stephen Boyd wrote: > > Quoting Brendan Higgins (2019-08-12 11:24:15) > > + > > +static int kunit_resource_test_init(struct kunit *test) > > +{ > > + struct kunit_test_resource_context *ctx = > > + kzalloc(sizeof(*ctx), GFP_KERNEL); > > + > > + if (!ctx) > > + return -ENOMEM; > > Should this use the test assertion logic to make sure that it's not > failing allocations during init? Yep. Will fix. > BTW, maybe kunit allocation APIs should > fail the test if they fail to allocate in general. Unless we're unit > testing failure to allocate problems. Yeah, I thought about that. I wasn't sure how people would feel about it, and I thought it would be a pain to tease out all the issues arising from aborting in different contexts when someone might not expect it. I am thinking later we can have kunit_kmalloc_or_abort variants? And then we can punt this issue to a later time? > > + > > + test->priv = ctx; > > + > > + kunit_init_test(&ctx->test, "test_test_context"); > > + > > + return 0;