Received: by 10.223.185.116 with SMTP id b49csp28358wrg; Tue, 20 Feb 2018 15:12:18 -0800 (PST) X-Google-Smtp-Source: AH8x225F1k+fAOIk6aYoRH1HuCdszn3YJDsGGRcBL7hDCeG0aLTMzc2BPuC7U3YhkM4NU993j6cN X-Received: by 2002:a17:902:20e6:: with SMTP id v35-v6mr1145314plg.226.1519168337974; Tue, 20 Feb 2018 15:12:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519168337; cv=none; d=google.com; s=arc-20160816; b=uKpUJY4mEjNtOvyziF15BU4hnBlGTGDPiTh2aErv/wzaFrNEaEVqTRENXuCu75oOxn bmUZfIpZ/mjVnVdtAMTdvc9eNyhW5qlH4aqDPcxGp6w6DL7Rnw4CqAGtUfen2K35XzaH hT3EzY9OUzcOqZtfoBzqQy8aQeV5iYv/lciczejssGSI8UI9JdPeoYoS6PcOp8mI7Tai hpHJArlgsioP/vs0SVJ+hVq/9P1wyHrteCS9RWb1u+mJxL3yudIjT6cztiFtBCSxY82x hGTtvgTldeBXKFIsyYQ+XumOuRCahXXkaIAtwEDIj+MocYfg8OhzdXWsfMKSni7Lq3BQ veyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=N0XTzAdTbvGi58eHw2eEYyclWdfP9TVLZ94TZASAn8k=; b=SDvHOTuAJVvQL+PCSuGJMJGShesCYaUvAncm5TDCAy/1E2bfI+p+yJuidvq2KGmfMI fcxIIYLUttQV5yl/1SdVfFIuIFVwbC4AEKS+CwFo3XhViNYQK0/KVuClz2n3v8OElwN+ oXbcfhgTqbABVt9HpSsSJpeyXEevSV0VuY4q7JdpcLwWUjM309YcTEA59RB+gnzwsnTL Wt/Kx9dThhkarnsutt0K+YxmYoIQkFVPUSQwpR3np6AoB/J1/Of6qUFYBrYlhqpE/nK9 RwulcPQFXmzbat6MMI9d/EKdsgil81P5iUym2lcDDwnuX/zGPCV3ReUudKYvno+pfapl 7U5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=MS6cGRDk; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1-v6si1485967plb.280.2018.02.20.15.12.03; Tue, 20 Feb 2018 15:12:17 -0800 (PST) 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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=MS6cGRDk; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751882AbeBTXKt (ORCPT + 99 others); Tue, 20 Feb 2018 18:10:49 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:38070 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbeBTXKQ (ORCPT ); Tue, 20 Feb 2018 18:10:16 -0500 Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id AD5AB202D7; Wed, 21 Feb 2018 00:08:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1519168111; bh=I4z/JnaPvWCKG8L124OzHmnjpcA39RQaWaWWgrVqw5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MS6cGRDk0c3Jspc4f2vTEVXXWEIxaNnyFpuXhRrMOKl6/GBCZWO1nE1cJlvdjYaIt iOZMVgSepTNhZRb8lTZ5SuagAMe+a88nkQEwujmsE1EJShA175Ca90RZu2SUBMmf1D pZvXxSOTRCd4qIpqa4rodimAO4RoD7fcGbUjzUGc= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, Pantelis Antoniou , Rob Herring , Frank Rowand , Matt Porter , Koen Kooi , Guenter Roeck , Marek Vasut , Wolfram Sang , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Subject: [PATCH v4 06/16] of: unittest: changeset helpers Date: Wed, 21 Feb 2018 01:10:36 +0200 Message-Id: <20180220231046.32638-7-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180220231046.32638-1-laurent.pinchart+renesas@ideasonboard.com> References: <20180220231046.32638-1-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pantelis Antoniou Add a unitest specific for the new changeset helpers. Signed-off-by: Pantelis Antoniou Signed-off-by: Laurent Pinchart --- drivers/of/unittest.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 7a9abaae874d..1b21d2c549a8 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -609,6 +609,59 @@ static void __init of_unittest_changeset(void) #endif } +static void __init of_unittest_changeset_helper(void) +{ +#ifdef CONFIG_OF_DYNAMIC + struct device_node *n1, *n2, *n21, *parent, *np; + struct of_changeset chgset; + + of_changeset_init(&chgset); + + parent = of_find_node_by_path("/testcase-data/changeset"); + + unittest(parent, "testcase setup failure\n"); + n1 = of_changeset_create_device_node(&chgset, + parent, "/testcase-data/changeset/n1"); + unittest(n1, "testcase setup failure\n"); + n2 = of_changeset_create_device_node(&chgset, + parent, "/testcase-data/changeset/n2"); + unittest(n2, "testcase setup failure\n"); + n21 = of_changeset_create_device_node(&chgset, n2, "%s/%s", + "/testcase-data/changeset/n2", "n21"); + unittest(n21, "testcase setup failure\n"); + + unittest(!of_changeset_add_property_string(&chgset, parent, + "prop-add", "foo"), "fail add prop\n"); + + unittest(!of_changeset_attach_node(&chgset, n1), "fail n1 attach\n"); + unittest(!of_changeset_attach_node(&chgset, n2), "fail n2 attach\n"); + unittest(!of_changeset_attach_node(&chgset, n21), "fail n21 attach\n"); + + unittest(!of_changeset_apply(&chgset), "apply failed\n"); + + /* Make sure node names are constructed correctly */ + np = of_find_node_by_path("/testcase-data/changeset/n1"); + unittest(np, "'%s' not added\n", n1->full_name); + of_node_put(np); + + /* Make sure node names are constructed correctly */ + np = of_find_node_by_path("/testcase-data/changeset/n2"); + unittest(np, "'%s' not added\n", n2->full_name); + of_node_put(np); + + np = of_find_node_by_path("/testcase-data/changeset/n2/n21"); + unittest(np, "'%s' not added\n", n21->full_name); + of_node_put(np); + + unittest(!of_changeset_revert(&chgset), "revert failed\n"); + + of_changeset_destroy(&chgset); + + of_node_put(parent); +#endif +} + + static void __init of_unittest_parse_interrupts(void) { struct device_node *np; @@ -2363,6 +2416,7 @@ static int __init of_unittest(void) of_unittest_property_string(); of_unittest_property_copy(); of_unittest_changeset(); + of_unittest_changeset_helper(); of_unittest_parse_interrupts(); of_unittest_parse_interrupts_extended(); of_unittest_match_node(); -- Regards, Laurent Pinchart