Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp886235ybm; Fri, 29 May 2020 14:51:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3cOlQmGq8t64P+LfEFZ9nV0tg7LTVV+dcRDy89EcI2mfxh+DRAnSsBuPwVy9id8IYP300 X-Received: by 2002:a17:906:b859:: with SMTP id ga25mr10114661ejb.523.1590789060621; Fri, 29 May 2020 14:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590789060; cv=none; d=google.com; s=arc-20160816; b=aTbpGdyA11hO+2gOEUKPXCfOAToRGOpi9Pvu4oWiEmGzcjPcAdvSW7Df70c6om4vP8 vwYYoQtEc7dZ9FEvaQ/Hu6Wi4ZoRKmY30OW7VU93ZjQatbgLjwgDUhQi72Nk7PNmKU76 9Hd4vIPbfg0PsYRoFoeW6OhzkG6r5NHaUoJ2ZnX3jRK/eRizse22lCosjBJFOCPfgYrb RCAYEwR5wp40muPQd8HwIAOi4O3S0y31DZAY04fbLgopg83DXVfjqGVh2/FdTRfy9FCk ZypEJuULbR45kZ4Bq/Xjnz07AGdFLqdHIkinjGKQzRzblEWmd7XiI9jjGqdD4GpTjC+H GzHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=u5x9D0t4tZz+1cMYmC9qV2MbmC6jm9OFvlDRzwpEAJ0=; b=HhEWRQfxlC3c8LhOiCI15mW1bZeFW4615OB1dQcPBrnnshBeOp2tTk5szw13K5dOhe aHGp1qUUaOh5c0ZVMMyVcg2r+6lDdjE7hLKyhI8/Axo9PFMYoIZMSqgIcGkMTnqPMQo9 UqrkjfrC477izKzPNefkn6/3Sy0/uRsFKHpNVf5x+QLyPziiFkCW1w7cyUtO1+3ikMUK 722XFWUImu3ytBryET2csas8Upu9zNf7XKxdbws1kDAxZO80B6pgakKkuHBeNMRDzicD b5avEZNzmykLQrnNWylAXBG45LmxTxlAJ8kwRxmeoJVqkGhDaJjCmxgpluyJh2COnFyO OGfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=Yvq9yZBy; 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=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l10si5813701edi.562.2020.05.29.14.50.37; Fri, 29 May 2020 14:51:00 -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=@oracle.com header.s=corp-2020-01-29 header.b=Yvq9yZBy; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728471AbgE2Vqk (ORCPT + 99 others); Fri, 29 May 2020 17:46:40 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:57498 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727947AbgE2Vqk (ORCPT ); Fri, 29 May 2020 17:46:40 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04TLbtK5004146; Fri, 29 May 2020 21:46:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2020-01-29; bh=u5x9D0t4tZz+1cMYmC9qV2MbmC6jm9OFvlDRzwpEAJ0=; b=Yvq9yZByXssUUAK9+XEwjin2JPS+2qwRuy2omBhf0BErZH2leyfvVg6v8lcYSlEXIqgX 3+M2HBQoCErUH4JO/QdHPYir8stCUVPJYd4rJYcrSJKrg4kvKhHJWYkde4r5Q3j+FQij zlJo9ELK7KFWBSStZ3vMaCav/HZg/e1Fhizw68GdKiWQhNvwYXKSN5TrxbVeyaEA8jx6 NQQbZypOyrNrgzXHYwoSDSGkroU7wwj8njDgEF5hw7llEaYWm4XySaM050NfYVxOnGJm O3fz2XGMmLOTjTlATGU7K6taLvHdEqnKV5SWOXqD12NVKc/6l2Jmte8QINUmhAZKUgKP Og== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 316u8rcmbv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 May 2020 21:46:35 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04TLXA9p091790; Fri, 29 May 2020 21:46:35 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 317ddv06nv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 29 May 2020 21:46:34 +0000 Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 04TLkXui020880; Fri, 29 May 2020 21:46:33 GMT Received: from localhost.uk.oracle.com (/10.175.189.67) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 29 May 2020 14:46:32 -0700 From: Alan Maguire To: brendanhiggins@google.com, skhan@linuxfoundation.org Cc: davidgow@google.com, trishalfonso@google.com, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Alan Maguire Subject: [PATCH v4 kunit-next 0/2] kunit: extend kunit resources API Date: Fri, 29 May 2020 22:46:19 +0100 Message-Id: <1590788781-1895-1-git-send-email-alan.maguire@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9636 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290155 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9636 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 priorityscore=1501 spamscore=0 cotscore=-2147483648 suspectscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2005290155 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A recent RFC patch set [1] suggests some additional functionality may be needed around kunit resources. It seems to require 1. support for resources without allocation 2. support for lookup of such resources 3. support for access to resources across multiple kernel threads The proposed changes here are designed to address these needs. The idea is we first generalize the API to support adding resources with static data; then from there we support named resources. The latter support is needed because if we are in a different thread context and only have the "struct kunit *" to work with, we need a way to identify a resource in lookup. [1] https://lkml.org/lkml/2020/2/26/1286 Changes since v3: - removed unused "init" field from "struct kunit_resources" (Brendan) Changes since v2: - moved a few functions relating to resource retrieval in patches 1 and 2 into include/kunit/test.h and defined as "static inline"; this allows built-in consumers to use these functions when KUnit is built as a module Changes since v1: - reformatted longer parameter lists to have one parameter per-line (Brendan, patch 1) - fixed phrasing in various comments to clarify allocation of memory and added comment to kunit resource tests to clarify why kunit_put_resource() is used there (Brendan, patch 1) - changed #define to static inline function (Brendan, patch 2) - simplified kunit_add_named_resource() to use more of existing code for non-named resource (Brendan, patch 2) Alan Maguire (2): kunit: generalize kunit_resource API beyond allocated resources kunit: add support for named resources Alan Maguire (2): kunit: generalize kunit_resource API beyond allocated resources kunit: add support for named resources include/kunit/test.h | 210 +++++++++++++++++++++++++++++++++++++++------- lib/kunit/kunit-test.c | 111 +++++++++++++++++++----- lib/kunit/string-stream.c | 14 ++-- lib/kunit/test.c | 171 ++++++++++++++++++++++--------------- 4 files changed, 380 insertions(+), 126 deletions(-) -- 1.8.3.1