From patchwork Wed Oct 10 05:19:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 981692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42VMsm5t6qz9sB7 for ; Wed, 10 Oct 2018 16:22:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42VMsm4gr1zF31F for ; Wed, 10 Oct 2018 16:22:04 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=stewart@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42VMqR31qFzF2Dx for ; Wed, 10 Oct 2018 16:20:03 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9A5Isol032483 for ; Wed, 10 Oct 2018 01:20:00 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n1631hqd6-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Oct 2018 01:19:59 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 9 Oct 2018 23:19:58 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 9 Oct 2018 23:19:56 -0600 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9A5Jti363701164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 9 Oct 2018 22:19:55 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15AB6136059 for ; Tue, 9 Oct 2018 23:19:55 -0600 (MDT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B9E4136055 for ; Tue, 9 Oct 2018 23:19:54 -0600 (MDT) Received: from birb.localdomain (unknown [9.81.205.182]) by b03ledav002.gho.boulder.ibm.com (Postfix) with SMTP for ; Tue, 9 Oct 2018 23:19:54 -0600 (MDT) Received: by birb.localdomain (Postfix, from userid 1000) id 2A1E24EC632; Wed, 10 Oct 2018 16:19:51 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Wed, 10 Oct 2018 16:19:47 +1100 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181010051950.13202-1-stewart@linux.ibm.com> References: <20181010051950.13202-1-stewart@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18101005-0016-0000-0000-0000093EB6EB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009852; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01100468; UDB=6.00569371; IPR=6.00880516; MB=3.00023689; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-10 05:19:57 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101005-0017-0000-0000-000040A64362 Message-Id: <20181010051950.13202-3-stewart@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-10_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810100053 Subject: [Skiboot] [PATCH 2/5] core/device: Add test for duplicate nodes with dt_attach_root() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Signed-off-by: Stewart Smith --- core/test/run-device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/test/run-device.c b/core/test/run-device.c index c3e46793f120..c317d4cc76f3 100644 --- a/core/test/run-device.c +++ b/core/test/run-device.c @@ -103,7 +103,7 @@ const char **props_to_fix(struct dt_node *node) int main(void) { - struct dt_node *root, *c1, *c2, *gc1, *gc2, *gc3, *ggc1, *ggc2; + struct dt_node *root, *other_root, *c1, *c2, *gc1, *gc2, *gc3, *ggc1, *ggc2; struct dt_node *addrs, *addr1, *addr2; struct dt_node *i, *subtree, *ev1, *ut1, *ut2; const struct dt_property *p; @@ -388,6 +388,13 @@ int main(void) assert(is_sorted(root)); + /* Now test dt_attach_root */ + other_root = dt_new_root("other_root"); + dt_new(other_root, "d@1"); + + assert(dt_attach_root(root, other_root)); + other_root = dt_new_root("other_root"); + assert(!dt_attach_root(root, other_root)); dt_free(root); /* Test child node sorting */