From patchwork Mon Aug 20 09:10:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 144553 Delivered-To: patches@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3722037ljj; Mon, 20 Aug 2018 02:10:14 -0700 (PDT) X-Received: by 2002:a19:a053:: with SMTP id j80-v6mr13354463lfe.115.1534756214600; Mon, 20 Aug 2018 02:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534756214; cv=none; d=google.com; s=arc-20160816; b=F76Xmaam0hFfR01uU7/6WGj4tcALOusZaEY7BP+k7c755d+UVRxpzuuZjmlkqaQz0d jJACwG+MxqqgUD/AT0j1LBIeRNpPi8ynSCCr526k4/DsUMk3HKmimJo6RnUnuxLm4/9x HXgxNOMjgsXQ/V3TtZ1n4BywULhcjI1B4rvVuPxbP29vNf+VC5a9NBEcXg4xHo+WvaNW lyFvv2ANz/CroOGjq6hxEAp+ltGkjbJt9yBsYDql+cCIxlW8G9lNVgjISjgZ10G+OV5R FJygLeZMjZ6LMh2jIPzcAlMMOsQqqEZSXv/QFYe/rVGljPSBz1mSX8nPUmH09VqYxI85 tGKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=EOLNa8mCsKuzKP4cTXAhkiicPXdmoJck1D3okfiW3SI=; b=bjnzKbPUX1UfXCrgH7Jn/8JCkw9HhDtlhhWNU6ILOW4FTvUfGdifbWoMYBJ4PthrCl Sg4QJEnCAyrZaQbGL3P0ffvXqwUXdy2du9hEvM/MUHAlR+W1WODgV8zI6jnAIAh6IMDi 9lJChcKUH6m35Qx3on/SHDZnhrqSy6R+d6OqlWEoEK0cIFB9K5pRvXKXWdaJETObT2oJ udjQcsNy8vwai1Usl9kQvcFIwz/sd+/GQn2uwGTjSSHqskjs4jOl51FgBpKs4LsaknVc 2NW8OSaoOkeDElA7uWu21oJtIlSeoZND340CSMTzRjaBZwqT1YIK1/+Xc1Zknz0T1HBq cB4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cfs2vHaH; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id u16-v6sor1585830ljk.102.2018.08.20.02.10.14 for (Google Transport Security); Mon, 20 Aug 2018 02:10:14 -0700 (PDT) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cfs2vHaH; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EOLNa8mCsKuzKP4cTXAhkiicPXdmoJck1D3okfiW3SI=; b=cfs2vHaHr2wQ4OaXEXN0sB7h4kstcNn3aU1NZTwXhCVm7TH3gjRTi+djXt78FiyFAz SEcu7u43zOrTiN8Fz7xM0LfDaz4ksEa6WACjfUeqGYWQB3O18a98nFDwwduAjRTV0A6m eTHd7cCKS3FycFk4zUC16g6o48wjAVJJ83X70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EOLNa8mCsKuzKP4cTXAhkiicPXdmoJck1D3okfiW3SI=; b=avG7lrrm3VntSTJCetPF1BKkb/yk7gztoGcPT7q7aqvIeoSV9jLZbnDFo7JyjIrsUD 1BnesivwkRkFzhKyBiq3IkjPupzVI2h9ys1K7Msr63T+A/cTX3OitfbrQuD9i4ECG3p1 qTrUvE82yLUj4tQboKjcdHT/m/w8mYeqaIpZ3ogtPqI04pp/q5AtBzqdVicq5ruLv9j9 QJpf0tiauKpm9oiX5xDa4rOySgyrG0f5jh+ryaRcx5nC+EX8Ab1pZbdL7b711X63Pfdb Nehvm0shpK1FXY/tOGR7rVyZkQDRgwTv1e7PwfZGtX1qltp5nK4fBa2LaDUGCPXHHVBy YU/Q== X-Gm-Message-State: AOUpUlFnZtkkJGTmKpfpfWrT371eyZbP818uZ3sNarXcns5HaCTKSjZC ppDI1tqd9T+U7v92r2nzWtYKVzy8TqvF8A== X-Google-Smtp-Source: AA+uWPymiUhhpSIC7he5fjSVdIMRP9CHLLaCh3GwXKZ5MFbf2puVLTJPD9bfxPVEqs+e2zXsEB6/Ww== X-Received: by 2002:a2e:9bc9:: with SMTP id w9-v6mr25225692ljj.33.1534756214444; Mon, 20 Aug 2018 02:10:14 -0700 (PDT) Return-Path: Received: from jax.urgonet (h-84-105.A175.priv.bahnhof.se. [79.136.84.105]) by smtp.gmail.com with ESMTPSA id i2-v6sm1041025lfa.78.2018.08.20.02.10.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 02:10:13 -0700 (PDT) From: Jens Wiklander To: u-boot@lists.denx.de Cc: Simon Glass , Jens Wiklander Subject: [PATCH v2 3/3] test: ofnode: test ofnode_by_prop_value() Date: Mon, 20 Aug 2018 11:10:00 +0200 Message-Id: <20180820091000.3241-4-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180820091000.3241-1-jens.wiklander@linaro.org> References: <20180820091000.3241-1-jens.wiklander@linaro.org> Test ofnode_by_prop_value() Signed-off-by: Jens Wiklander --- test/dm/ofnode.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.17.1 Reviewed-by: Simon Glass diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 8db1f9857f7d..907d1ddbdb6f 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -15,3 +15,30 @@ static int dm_test_ofnode_compatible(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_compatible, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_ofnode_by_prop_value(struct unit_test_state *uts) +{ + const char propname[] = "compatible"; + const char propval[] = "denx,u-boot-fdt-test"; + const char *str; + ofnode node = ofnode_null(); + + /* Find first matching node, there should be at least one */ + node = ofnode_by_prop_value(node, propname, propval, sizeof(propval)); + ut_assert(ofnode_valid(node)); + str = ofnode_read_string(node, propname); + ut_assert(str && !strcmp(str, propval)); + + /* Find the rest of the matching nodes */ + while (true) { + node = ofnode_by_prop_value(node, propname, propval, + sizeof(propval)); + if (!ofnode_valid(node)) + break; + str = ofnode_read_string(node, propname); + ut_assert(str && !strcmp(str, propval)); + } + + return 0; +} +DM_TEST(dm_test_ofnode_by_prop_value, DM_TESTF_SCAN_FDT);