{"id":800474,"url":"http://patchwork.ozlabs.org/api/1.2/patches/800474/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1502441568-22896-11-git-send-email-pantelis.antoniou@konsulko.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.2/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1502441568-22896-11-git-send-email-pantelis.antoniou@konsulko.com>","list_archive_url":null,"date":"2017-08-11T08:52:48","name":"[U-Boot,v2,10/10] test: overlay: Add unit test for stacked overlay","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e6cce0347fc57f157cce3cf4d1ebea7d99ed51ac","submitter":{"id":64098,"url":"http://patchwork.ozlabs.org/api/1.2/people/64098/?format=json","name":"Pantelis Antoniou","email":"pantelis.antoniou@konsulko.com"},"delegate":{"id":3184,"url":"http://patchwork.ozlabs.org/api/1.2/users/3184/?format=json","username":"sjg","first_name":"Simon","last_name":"Glass","email":"sjg@chromium.org"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1502441568-22896-11-git-send-email-pantelis.antoniou@konsulko.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/800474/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/800474/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=konsulko.com header.i=@konsulko.com\n\theader.b=\"U/bNrY6K\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xTJpv2bJdz9t2W\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 11 Aug 2017 18:59:35 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 2AD0FC21C4F; Fri, 11 Aug 2017 08:59:06 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 0B672C21E07;\n\tFri, 11 Aug 2017 08:56:41 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 58D6AC21DDC; Fri, 11 Aug 2017 08:55:57 +0000 (UTC)","from mail-wm0-f46.google.com (mail-wm0-f46.google.com\n\t[74.125.82.46])\n\tby lists.denx.de (Postfix) with ESMTPS id F37DEC21D5D\n\tfor <u-boot@lists.denx.de>; Fri, 11 Aug 2017 08:55:53 +0000 (UTC)","by mail-wm0-f46.google.com with SMTP id f15so41936771wmg.1\n\tfor <u-boot@lists.denx.de>; Fri, 11 Aug 2017 01:55:53 -0700 (PDT)","from localhost.localdomain ([195.97.110.117])\n\tby smtp.gmail.com with ESMTPSA id\n\to71sm759811wmg.15.2017.08.11.01.55.51\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 11 Aug 2017 01:55:53 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=EiiquOuYww0ExSYvhacceNPdH2wtNIIQ6xbmA7ajnqE=;\n\tb=U/bNrY6KrAvXTK82E8BfKLb7S0ig89r/LCqCmletE/FeNvpzw9kwX2ven9bYCdC6i3\n\tl0nBswDpfyBesuvlPgjl06h4AF4INPOBG7Wg3bqiSbkME8qg8TWuUuu8l47q+iSZhaL8\n\tutdNZu+STvqQMNimFMJWKxlqYgS1vyiWVLau0=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=EiiquOuYww0ExSYvhacceNPdH2wtNIIQ6xbmA7ajnqE=;\n\tb=prH46Hi0Yv5NdJ8ihVCKJtkPMAc4FT22yN0CsgITY4wb16MMWKHbWlg8u7R9xqFLkx\n\tF2gQ7mGKRc5QtQaYSXPUMCa+4tNfXO5l3iMzCkjBqnDWGrXWDQyuBW0GkiUEnlF6DhWG\n\tO+BTS3dvnbG+tu19uEcOy5Aoa+3FJxRt3h2l+xTY8rnrLUGUDBO2kCIqumxwa4L8zZnw\n\temAhp3wTyIPV6gU0t1dj8FkoLjOeZr/nQCYwVr5g8gBdek6xkpVD8j2s+e1Y1HqawLFK\n\tj5fioYOqUmmSP6SG0+I9ZmIyjIXrU+5H086Q7Cfi3oxfGZXaew+2tazLP/gb6V4mC7I+\n\tbBig==","X-Gm-Message-State":"AHYfb5gTKCLopsOEJP6wfipvZBaE9CIvVbdZ35U04u4n4AFZaZU4Cy+2\n\t0BtC5h31qGIUqAUe","X-Received":"by 10.28.33.85 with SMTP id h82mr8912362wmh.18.1502441753689;\n\tFri, 11 Aug 2017 01:55:53 -0700 (PDT)","From":"Pantelis Antoniou <pantelis.antoniou@konsulko.com>","To":"Tom Rini <trini@konsulko.com>","Date":"Fri, 11 Aug 2017 11:52:48 +0300","Message-Id":"<1502441568-22896-11-git-send-email-pantelis.antoniou@konsulko.com>","X-Mailer":"git-send-email 2.1.4","In-Reply-To":"<1502441568-22896-1-git-send-email-pantelis.antoniou@konsulko.com>","References":"<1502441568-22896-1-git-send-email-pantelis.antoniou@konsulko.com>","Cc":"Marek Vasut <marex@denx.de>,\n\tPantelis Antoniou <pantelis.antoniou@konsulko.com>,\n\tTero Kristo <t-kristo@ti.com>, u-boot@lists.denx.de,\n\tMaxime Ripard <maxime.ripard@free-electrons.com>,\n\tStefan Roese <sr@denx.de>, Alan Ott <alan@signal11.us>","Subject":"[U-Boot] [PATCH v2 10/10] test: overlay: Add unit test for stacked\n\toverlay","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Verify that stacked overlays work.\n\nSigned-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>\n---\n test/overlay/Makefile                     |  1 +\n test/overlay/cmd_ut_overlay.c             | 34 ++++++++++++++++++++++++++++++-\n test/overlay/test-fdt-overlay-stacked.dts | 21 +++++++++++++++++++\n 3 files changed, 55 insertions(+), 1 deletion(-)\n create mode 100644 test/overlay/test-fdt-overlay-stacked.dts","diff":"diff --git a/test/overlay/Makefile b/test/overlay/Makefile\nindex 907f085..416645c 100644\n--- a/test/overlay/Makefile\n+++ b/test/overlay/Makefile\n@@ -13,3 +13,4 @@ DTC_FLAGS += -@\n # DT overlays\n obj-y += test-fdt-base.dtb.o\n obj-y += test-fdt-overlay.dtb.o\n+obj-y += test-fdt-overlay-stacked.dtb.o\ndiff --git a/test/overlay/cmd_ut_overlay.c b/test/overlay/cmd_ut_overlay.c\nindex 7106f42..24891ee 100644\n--- a/test/overlay/cmd_ut_overlay.c\n+++ b/test/overlay/cmd_ut_overlay.c\n@@ -20,6 +20,7 @@\n \n extern u32 __dtb_test_fdt_base_begin;\n extern u32 __dtb_test_fdt_overlay_begin;\n+extern u32 __dtb_test_fdt_overlay_stacked_begin;\n \n static int ut_fdt_getprop_u32_by_index(void *fdt, const char *path,\n \t\t\t\t    const char *name, int index,\n@@ -201,6 +202,19 @@ static int fdt_overlay_local_phandles(struct unit_test_state *uts)\n }\n OVERLAY_TEST(fdt_overlay_local_phandles, 0);\n \n+static int fdt_overlay_stacked(struct unit_test_state *uts)\n+{\n+\tvoid *fdt = uts->priv;\n+\tu32 val = 0;\n+\n+\tut_assertok(ut_fdt_getprop_u32(fdt, \"/new-local-node\",\n+\t\t\t\t       \"stacked-test-int-property\", &val));\n+\tut_asserteq(43, val);\n+\n+\treturn CMD_RET_SUCCESS;\n+}\n+OVERLAY_TEST(fdt_overlay_stacked, 0);\n+\n int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n {\n \tstruct unit_test *tests = ll_entry_start(struct unit_test,\n@@ -210,7 +224,8 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n \tstruct unit_test *test;\n \tvoid *fdt_base = &__dtb_test_fdt_base_begin;\n \tvoid *fdt_overlay = &__dtb_test_fdt_overlay_begin;\n-\tvoid *fdt_base_copy, *fdt_overlay_copy;\n+\tvoid *fdt_overlay_stacked = &__dtb_test_fdt_overlay_stacked_begin;\n+\tvoid *fdt_base_copy, *fdt_overlay_copy, *fdt_overlay_stacked_copy;\n \n \tuts = calloc(1, sizeof(*uts));\n \tif (!uts)\n@@ -228,6 +243,10 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n \tif (!fdt_overlay_copy)\n \t\treturn -ENOMEM;\n \n+\tfdt_overlay_stacked_copy = malloc(FDT_COPY_SIZE);\n+\tif (!fdt_overlay_stacked_copy)\n+\t\treturn -ENOMEM;\n+\n \t/*\n \t * Resize the FDT to 4k so that we have room to operate on\n \t *\n@@ -245,9 +264,21 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n \tut_assertok(fdt_open_into(fdt_overlay, fdt_overlay_copy,\n \t\t\t\t  FDT_COPY_SIZE));\n \n+\t/*\n+\t * Resize the stacked overlay to 4k so that we have room to operate on\n+\t *\n+\t * (and relocate it since the memory might be mapped\n+\t * read-only)\n+\t */\n+\tut_assertok(fdt_open_into(fdt_overlay_stacked, fdt_overlay_stacked_copy,\n+\t\t\t\t  FDT_COPY_SIZE));\n+\n \t/* Apply the overlay */\n \tut_assertok(fdt_overlay_apply(fdt_base_copy, fdt_overlay_copy));\n \n+\t/* Apply the stacked overlay */\n+\tut_assertok(fdt_overlay_apply(fdt_base_copy, fdt_overlay_stacked_copy));\n+\n \tif (argc == 1)\n \t\tprintf(\"Running %d environment tests\\n\", n_ents);\n \n@@ -263,6 +294,7 @@ int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])\n \n \tprintf(\"Failures: %d\\n\", uts->fail_count);\n \n+\tfree(fdt_overlay_stacked_copy);\n \tfree(fdt_overlay_copy);\n \tfree(fdt_base_copy);\n \tfree(uts);\ndiff --git a/test/overlay/test-fdt-overlay-stacked.dts b/test/overlay/test-fdt-overlay-stacked.dts\nnew file mode 100644\nindex 0000000..9fb7c7b\n--- /dev/null\n+++ b/test/overlay/test-fdt-overlay-stacked.dts\n@@ -0,0 +1,21 @@\n+/*\n+ * Copyright (c) 2016 NextThing Co\n+ * Copyright (c) 2016 Free Electrons\n+ * Copyright (c) 2018 Konsulko Group\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+/dts-v1/;\n+/plugin/;\n+\n+/ {\n+\t/* Test that we can reference an overlay symbol */\n+\tfragment@0 {\n+\t\ttarget = <&local>;\n+\n+\t\t__overlay__ {\n+\t\t\tstacked-test-int-property = <43>;\n+\t\t};\n+\t};\n+};\n","prefixes":["U-Boot","v2","10/10"]}