From patchwork Mon Oct 26 02:38:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1387436 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=T07VG+wR; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CKJvf4d2lz9sSn for ; Mon, 26 Oct 2020 13:39:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 42767824B8; Mon, 26 Oct 2020 03:39:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="T07VG+wR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7723A824C4; Mon, 26 Oct 2020 03:38:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 15D3C8248D for ; Mon, 26 Oct 2020 03:38:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id k21so8482733ioa.9 for ; Sun, 25 Oct 2020 19:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3Z93gXoDlprHsu/NRinYkjz0uYJkLU0BDJVsYdRoQh4=; b=T07VG+wRoomsmb5sunskAJ9ZkBBFjRQfOujH6DfKy+J7yAXutBy+eIH5wJdX/wkDlU aUETTCEGn59SCx5Jre0t7JOTv1yk4OVfZBYmIjYZ10i/nlOUnuoQEmnVmETbqjww1kwX clXJz41nt3PHLcHjnj8Ux+BTC/mTHqtXTt/Tg= 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:mime-version:content-transfer-encoding; bh=3Z93gXoDlprHsu/NRinYkjz0uYJkLU0BDJVsYdRoQh4=; b=nMeVYyfF2LgCi3+KTt8YjxvqQIoQ9MaYRVCadUQBV4QaDN+UkJqHvhfY0nvEAlESzC vM+5fEytzp9mDse5wxjwaJT8V9iPiu9d/cBx0rb5RYsDoMOR3tGKjCLtxmIqNQC6g/xW vuptNjwQsrlr8YPx/vbxxmpsxZZmitIaGoaXKwW1FLuXmaQeK/V+mipMau031706Up6y L10M3fSPTnICOszNom+td4jBL441200WNksspiuEOe83pzlquOIgir2RJGFri9cZy4ph ZUNpkyd18APbDA9fVWfyjFNr4ZLitIn8eFXtBD8wMnfvJCRmbo/cD1G5iCwdb4riUtbB Gcug== X-Gm-Message-State: AOAM532kqckhxgS/qkcp2xks7X+AxIa60ztkI9BR71YPx/HC/jUwf0K3 4CGtyiX2pkgG8eWkXBfjKaMUY/x19CB+PgMJ X-Google-Smtp-Source: ABdhPJwJfWehvoQ5tvodN9U760o5LkdcPo946xHqrGHNie9JcGeyUnYa98xJXurEdnWwmqlSNiqHmA== X-Received: by 2002:a02:1349:: with SMTP id 70mr10050453jaz.130.1603679930861; Sun, 25 Oct 2020 19:38:50 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id y3sm4632838ioq.18.2020.10.25.19.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Oct 2020 19:38:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Stephen Warren , Stephen Warren , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH v2 04/11] dm: test: Add a very simple of-platadata test Date: Sun, 25 Oct 2020 20:38:29 -0600 Message-Id: <20201026023836.1629465-5-sjg@chromium.org> X-Mailer: git-send-email 2.29.0.rc2.309.g374f81d7ae-goog In-Reply-To: <20201026023836.1629465-1-sjg@chromium.org> References: <20201026023836.1629465-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean At present we have a pytest that covers of-platadata. Add a very simple unit test that just checks that a device can be found. This shows the ability to write these tests in C. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) test/dm/Makefile | 4 +++- test/dm/of_platdata.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/dm/of_platdata.c diff --git a/test/dm/Makefile b/test/dm/Makefile index 2a18b5360d6..a8a590c7423 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -6,7 +6,9 @@ obj-$(CONFIG_UT_DM) += test-main.o # Tests for particular subsystems - when enabling driver model for a new # subsystem you must add sandbox tests here. -ifeq ($(CONFIG_SPL_BUILD),) +ifeq ($(CONFIG_SPL_BUILD),y) +obj-$(CONFIG_SPL_OF_PLATDATA) += of_platdata.o +else obj-$(CONFIG_UT_DM) += bus.o obj-$(CONFIG_UT_DM) += test-driver.o obj-$(CONFIG_UT_DM) += test-fdt.o diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c new file mode 100644 index 00000000000..7a864eb0fb3 --- /dev/null +++ b/test/dm/of_platdata.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include +#include +#include + +/* Test that we can find a device using of-platdata */ +static int dm_test_of_platdata_base(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_first_device_err(UCLASS_SERIAL, &dev)); + ut_asserteq_str("sandbox_serial", dev->name); + + return 0; +} +DM_TEST(dm_test_of_platdata_base, UT_TESTF_SCAN_PDATA);