Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1630830

Re: [PATCH v2 2/2] of: Add unit tests for applying overlays

Path csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod
From Frank Rowand <frowand.list@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/2] of: Add unit tests for applying overlays
Date Tue, 25 Apr 2017 19:50:02 +0200
Message-ID <tAcL8-7Ju-9@gated-at.bofh.it> (permalink)
References <tzVhf-4Us-9@gated-at.bofh.it> <tzVhg-4Us-25@gated-at.bofh.it> <tAbP4-7aO-15@gated-at.bofh.it>
X-Original-To Rob Herring <robh+dt@kernel.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=z08OruUjAOS9wqaL1OtLLLB6idvnVEbbHqunRLGCmNE=; b=fbl7nCrGcniq+CIP/kDPnUW4FyCEn+7qASKymjnh+GKtXCZwFE2Sp6CibR4rni9kcV Laj0Pqrqr+wtDywQG/s7yXatsJOId/0bF3Tv31sr1sujodaxYwZrmmP76z9BjsLPz/8z r/2sOFLS/CykkfehpQtzppW57cgD5cd1OgVzTPfuH+QVIIGs0yhLjAIMKBlucmeKzf99 cwpQL9EfQS7ITREF5HmpJYn/9JPSozrWXXUFJnulns1y8VNMP/WSHeyJY0ZxSruwzO/N uhSWPMG85hV90LAFPY7MB0kL53KKs4gg7MP8Qz3NQKifWm5H5oviH1tSbdXPY73Qirgf v9Ag==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=z08OruUjAOS9wqaL1OtLLLB6idvnVEbbHqunRLGCmNE=; b=Nw1bDSRLmmk/SJVGcIV+/vo4fk7OC7vL+Dp8sTgtSfY37x61hwUl1y//8AupkjKEYM LI8UqhV7zKxF+f6W8dkd6bC+44VgGH7vLpjhUiBTybkEKwhQ+AVlCkhb4B1/nW8c1Pva LjK+TyDlIKA/+1paJYdwa7sqxk6LYS2vQ4XbirTi8UnZNoQUoR6irVxIOlMLuHRbfK6A EDrkIvuTlImg0ibwcYMkdckU/hDWammLLn9l5OSDjPqPDRP/pUBcSPkucqWAwzQ2N6kc VjjelYPfJ6nSxLMXfbZOOkPHJ3jcsdyDiv+GzS4hK3TO2PdprZEHlCcvDdku6Ogpn2uk 6qiA==
X-Gm-Message-State AN3rC/5hFIb7yz2BF9EUu8X6QKwRtMk2ClylI2lWET/Z2KUvrUaRIpoN S8NVcaJRs/Rp+a7BYZ8=
X-Received by 10.84.216.10 with SMTP id m10mr38996524pli.79.1493142366755; Tue, 25 Apr 2017 10:46:06 -0700 (PDT)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 143
Organization linux.* mail to news gateway
X-Original-Cc Stephen Boyd <stephen.boyd@linaro.org>, Michal Marek <mmarek@suse.com>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>
X-Original-Date Tue, 25 Apr 2017 10:45:38 -0700
X-Original-Message-ID <58FF8B42.6050406@gmail.com>
X-Original-References <1493075119-32026-1-git-send-email-frowand.list@gmail.com> <1493075119-32026-3-git-send-email-frowand.list@gmail.com> <CAL_Jsq+8fcDwe4iPxLRsKnw_UAc6JE3KRRbnx1aS+o0oJH9tPw@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1630830

Show key headers only | View raw


On 04/25/17 09:44, Rob Herring wrote:
> On Mon, Apr 24, 2017 at 6:05 PM,  <frowand.list@gmail.com> wrote:
>> From: Frank Rowand <frank.rowand@sony.com>
>>
>> Existing overlay unit tests examine individual pieces of the overlay
>> code.  The new tests target the entire process of applying an overlay.
> 
> Just a few nits.
> 
>> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
> 
> [...]
> 
>> diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
>> index 18bbb4517e25..cc76b3b81eab 100644
>> --- a/drivers/of/of_private.h
>> +++ b/drivers/of/of_private.h
>> @@ -55,6 +55,17 @@ static inline int of_property_notify(int action, struct device_node *np,
>>  }
>>  #endif /* CONFIG_OF_DYNAMIC */
>>
>> +#ifdef CONFIG_OF_UNITTEST
>> +extern void __init unittest_unflatten_overlay_base(void);
>> +extern void *__unflatten_device_tree(const void *blob,
> 
> This can and should be outside the ifdef.

Will do.

> 
>> +                             struct device_node *dad,
>> +                             struct device_node **mynodes,
>> +                             void *(*dt_alloc)(u64 size, u64 align),
>> +                             bool detached);
>> +#else
>> +static inline void unittest_unflatten_overlay_base(void) {};
>> +#endif
>> +
>>  /**
>>   * General utilities for working with live trees.
>>   *
> 
> [...]
> 
>> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
>> index 62db55b97c10..884f6c1f8ae9 100644
>> --- a/drivers/of/unittest.c
>> +++ b/drivers/of/unittest.c
>> @@ -8,6 +8,7 @@
>>  #include <linux/err.h>
>>  #include <linux/errno.h>
>>  #include <linux/hashtable.h>
>> +#include <linux/libfdt.h>
>>  #include <linux/of.h>
>>  #include <linux/of_fdt.h>
>>  #include <linux/of_irq.h>
>> @@ -1925,6 +1926,320 @@ static void __init of_unittest_overlay(void)
>>  static inline void __init of_unittest_overlay(void) { }
>>  #endif
>>
>> +#ifdef CONFIG_OF_OVERLAY
> 
> This can move down to...

Will do.

> 
>> +
>> +/*
>> + * __dtb_ot_begin[] and __dtb_ot_end[] are created by cmd_dt_S_dtb
>> + * in scripts/Makefile.lib
>> + */
>> +
>> +#define OVERLAY_INFO_EXTERN(name) \
>> +       extern uint8_t __dtb_##name##_begin[]; \
>> +       extern uint8_t __dtb_##name##_end[]
>> +
>> +#define OVERLAY_INFO(name, expected) \
>> +{      .dtb_begin       = __dtb_##name##_begin, \
>> +       .dtb_end         = __dtb_##name##_end, \
>> +       .expected_result = expected, \
>> +}
>> +
>> +struct overlay_info {
>> +       uint8_t            *dtb_begin;
>> +       uint8_t            *dtb_end;
>> +       void               *data;
>> +       struct device_node *np_overlay;
>> +       int                expected_result;
>> +       int                overlay_id;
>> +};
>> +
>> +OVERLAY_INFO_EXTERN(overlay_base);
>> +OVERLAY_INFO_EXTERN(overlay);
>> +OVERLAY_INFO_EXTERN(overlay_bad_phandle);
> 
> ...here. Maybe we want to move all this to a separate file instead.

In the medium term, yes.  At the moment it is good enough for this
localized use for unittest.  I do not think it is baked enough
for general use.  I want to see how well it works for the
previously existing overlay unit tests and make sure it meets
the majority of the needs of wider use cases before making it
more widely visible.


>> +
>> +/* order of entries is hard-coded into users of overlays[] */
>> +struct overlay_info overlays[] = {
> 
> static?

Yes, thanks.


>> +       OVERLAY_INFO(overlay_base, -9999),
>> +       OVERLAY_INFO(overlay, 0),
>> +       OVERLAY_INFO(overlay_bad_phandle, -EINVAL),
>> +       {}
>> +};
> 
> [...]
> 
>> @@ -1962,6 +2277,9 @@ static int __init of_unittest(void)
>>         /* Double check linkage after removing testcase data */
>>         of_unittest_check_tree_linkage();
>>
>> +
> 
> Extra blank line.

thanks

> 
>> +       of_unittest_overlay_high_level();
>> +
>>         pr_info("end of unittest - %i passed, %i failed\n",
>>                 unittest_results.passed, unittest_results.failed);
>>
>> --
>> Frank Rowand <frank.rowand@sony.com>
>>
> 

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/2] of: Add unit tests for applying overlays frowand.list@gmail.com - 2017-04-25 01:10 +0200
  [PATCH v2 2/2] of: Add unit tests for applying overlays frowand.list@gmail.com - 2017-04-25 01:10 +0200
    Re: [PATCH v2 2/2] of: Add unit tests for applying overlays Rob Herring <robh+dt@kernel.org> - 2017-04-25 18:50 +0200
      Re: [PATCH v2 2/2] of: Add unit tests for applying overlays Frank Rowand <frowand.list@gmail.com> - 2017-04-25 19:50 +0200

csiph-web