blob: 9722677c5d1821cd71881766b0b89d427df377c7 [file] [log] [blame]
Patrick Williams8dd68482022-10-04 07:57:18 -05001From 5be8c1d52045cbdc1adf79299792a6a49fef66c3 Mon Sep 17 00:00:00 2001
2From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
3Date: Mon, 6 Jun 2022 17:30:44 +0100
4Subject: [PATCH 13/26] arm_ffa: introduce armffa command Sandbox test
5
6Add Sandbox test for the armffa command
7
8Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
9Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20220926101723.9965-1-abdellatif.elkhlifi@arm.com/]
10---
11
12Changelog:
13===============
14
15v4: drop use of helper APIs
16
17v1: introduce armffa command sandbox test
18
19 MAINTAINERS | 1 +
20 test/cmd/Makefile | 1 +
21 test/cmd/armffa.c | 40 ++++++++++++++++++++++++++++++++++++++++
22 3 files changed, 42 insertions(+)
23 create mode 100644 test/cmd/armffa.c
24
25diff --git a/MAINTAINERS b/MAINTAINERS
26index e5b71b0ade..505fffff14 100644
27--- a/MAINTAINERS
28+++ b/MAINTAINERS
29@@ -252,6 +252,7 @@ F: doc/README.ffa.drv
30 F: drivers/firmware/arm-ffa/
31 F: include/arm_ffa.h
32 F: include/sandbox_arm_ffa.h
33+F: test/cmd/armffa.c
34 F: test/dm/ffa.c
35
36 ARM FREESCALE IMX
37diff --git a/test/cmd/Makefile b/test/cmd/Makefile
38index a59adb1e6d..d9dc0809d6 100644
39--- a/test/cmd/Makefile
40+++ b/test/cmd/Makefile
41@@ -11,3 +11,4 @@ obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
42 obj-$(CONFIG_CMD_PINMUX) += pinmux.o
43 obj-$(CONFIG_CMD_PWM) += pwm.o
44 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
45+obj-$(CONFIG_SANDBOX_FFA) += armffa.o
46diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c
47new file mode 100644
48index 0000000000..531f82066e
49--- /dev/null
50+++ b/test/cmd/armffa.c
51@@ -0,0 +1,40 @@
52+// SPDX-License-Identifier: GPL-2.0+
53+/*
54+ * Test for armffa command
55+ *
56+ * (C) Copyright 2022 ARM Limited
57+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
58+ */
59+
60+#include <common.h>
61+#include <dm.h>
62+#include <dm/test.h>
63+#include <sandbox_arm_ffa.h>
64+#include <string.h>
65+#include <test/test.h>
66+#include <test/ut.h>
67+
68+#define PING_CMD_SIZE 19
69+
70+/* Basic test of 'armffa' command */
71+static int dm_test_armffa_cmd(struct unit_test_state *uts)
72+{
73+ char ping_cmd[PING_CMD_SIZE] = {0};
74+
75+ ut_assertok(ffa_bus_discover());
76+
77+ /* armffa getpart <UUID> */
78+ ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0));
79+
80+ snprintf(ping_cmd, PING_CMD_SIZE, "armffa ping 0x%x", SANDBOX_SP1_ID);
81+
82+ /* armffa ping <ID> */
83+ ut_assertok(run_command(ping_cmd, 0));
84+
85+ /* armffa devlist */
86+ ut_assertok(run_command("armffa devlist", 0));
87+
88+ return CMD_RET_SUCCESS;
89+}
90+
91+DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
92--
932.17.1
94