public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 4/4] test: Add basic tests for remoteproc
Date: Thu, 27 Aug 2015 23:07:33 -0500	[thread overview]
Message-ID: <1440734853-6552-5-git-send-email-nm@ti.com> (raw)
In-Reply-To: <1440734853-6552-1-git-send-email-nm@ti.com>

Use the sandbox environment for the basic tests.

Signed-off-by: Nishanth Menon <nm@ti.com>
---
New patch.

 test/dm/Makefile     |  1 +
 test/dm/remoteproc.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 test/dm/remoteproc.c

diff --git a/test/dm/Makefile b/test/dm/Makefile
index eda964318593..7b3626cb3294 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_DM_MMC) += mmc.o
 obj-$(CONFIG_DM_PCI) += pci.o
 obj-$(CONFIG_RAM) += ram.o
 obj-y += regmap.o
+obj-$(CONFIG_REMOTEPROC) += remoteproc.o
 obj-$(CONFIG_RESET) += reset.o
 obj-$(CONFIG_DM_RTC) += rtc.o
 obj-$(CONFIG_DM_SPI_FLASH) += sf.o
diff --git a/test/dm/remoteproc.c b/test/dm/remoteproc.c
new file mode 100644
index 000000000000..924eae854078
--- /dev/null
+++ b/test/dm/remoteproc.c
@@ -0,0 +1,67 @@
+/*
+ * (C) Copyright 2015
+ * Texas Instruments Incorporated - http://www.ti.com/
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <remoteproc.h>
+#include <dm/test.h>
+#include <test/ut.h>
+/**
+ * dm_test_remoteproc_base() - test the operations after initializations
+ * @uts:	unit test state
+ *
+ * Return:	0 if test passed, else error
+ */
+static int dm_test_remoteproc_base(struct unit_test_state *uts)
+{
+	if (!rproc_is_initialized())
+		ut_assertok(rproc_init());
+
+	/* Ensure we are initialized */
+	ut_asserteq(true, rproc_is_initialized());
+
+
+	/* platform data device 1 */
+	ut_assertok(rproc_stop(0));
+	ut_assertok(rproc_reset(0));
+	/* -> invalid attempt tests.. */
+	ut_asserteq(-EINVAL, rproc_start(0));
+	ut_asserteq(-EINVAL, rproc_ping(0));
+	/* Valid tests.. */
+	ut_assertok(rproc_load(0, 1, 0));
+	ut_assertok(rproc_start(0));
+	ut_assertok(rproc_is_running(0));
+	ut_assertok(rproc_ping(0));
+	ut_assertok(rproc_reset(0));
+	ut_assertok(rproc_stop(0));
+
+	/* dt device device 1 */
+	ut_assertok(rproc_stop(1));
+	ut_assertok(rproc_reset(1));
+	ut_assertok(rproc_load(1, 1, 0));
+	ut_assertok(rproc_start(1));
+	ut_assertok(rproc_is_running(1));
+	ut_assertok(rproc_ping(1));
+	ut_assertok(rproc_reset(1));
+	ut_assertok(rproc_stop(1));
+
+	/* dt device device 2 */
+	ut_assertok(rproc_stop(0));
+	ut_assertok(rproc_reset(0));
+	/* -> invalid attempt tests.. */
+	ut_asserteq(-EINVAL, rproc_start(0));
+	ut_asserteq(-EINVAL, rproc_ping(0));
+	/* Valid tests.. */
+	ut_assertok(rproc_load(2, 1, 0));
+	ut_assertok(rproc_start(2));
+	ut_assertok(rproc_is_running(2));
+	ut_assertok(rproc_ping(2));
+	ut_assertok(rproc_reset(2));
+	ut_assertok(rproc_stop(2));
+
+	return 0;
+}
+DM_TEST(dm_test_remoteproc_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
-- 
2.1.4

  parent reply	other threads:[~2015-08-28  4:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28  4:07 [U-Boot] [PATCH V2 0/4] drivers/sandbox: Introduce a simplified remoteproc framework Nishanth Menon
2015-08-28  4:07 ` [U-Boot] [PATCH V2 1/4] drivers: " Nishanth Menon
2015-09-02  3:46   ` Simon Glass
2015-09-16 23:47     ` Nishanth Menon
2015-08-28  4:07 ` [U-Boot] [PATCH V2 2/4] remoteproc: Introduce a sandbox dummy driver Nishanth Menon
2015-09-02  3:46   ` Simon Glass
2015-09-16 23:50     ` Nishanth Menon
2015-08-28  4:07 ` [U-Boot] [PATCH V2 3/4] sandbox: Introduce dummy remoteproc nodes Nishanth Menon
2015-09-02  3:46   ` Simon Glass
2015-08-28  4:07 ` Nishanth Menon [this message]
2015-09-02  3:46   ` [U-Boot] [PATCH V2 4/4] test: Add basic tests for remoteproc Simon Glass
2015-09-16 23:57     ` Nishanth Menon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440734853-6552-5-git-send-email-nm@ti.com \
    --to=nm@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox