Re: [PATCH v9 08/10] arm_ffa: introduce armffa command Sandbox test

2023-03-10 Thread Simon Glass
Hi Abdellatif,

On Fri, 10 Mar 2023 at 06:11, Abdellatif El Khlifi
 wrote:
>
> Add Sandbox test for the armffa command
>
> Signed-off-by: Abdellatif El Khlifi 
> Cc: Tom Rini 
> Cc: Simon Glass 
> Cc: Ilias Apalodimas 
> Cc: Jens Wiklander 
>
> ---
> Changelog:
> ===
>
> v9: align the test with FF-A discovery through DM
>
> v4: drop use of helper APIs
>
> v1: introduce armffa command sandbox test
>
>  MAINTAINERS   |  1 +
>  test/cmd/Makefile |  2 ++
>  test/cmd/armffa.c | 39 +++
>  3 files changed, 42 insertions(+)
>  create mode 100644 test/cmd/armffa.c

Reviewed-by: Simon Glass 

>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6939b832e4..b36fb41668 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -275,6 +275,7 @@ F:  doc/usage/cmd/armffa.rst
>  F: drivers/firmware/arm-ffa/
>  F: include/arm_ffa.h
>  F: include/sandbox_arm_ffa.h
> +F: test/cmd/armffa.c
>  F: test/dm/ffa.c
>
>  ARM FREESCALE IMX
> diff --git a/test/cmd/Makefile b/test/cmd/Makefile
> index 2ffde8703a..e74da56a29 100644
> --- a/test/cmd/Makefile
> +++ b/test/cmd/Makefile
> @@ -1,6 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0+
>  #
>  # Copyright (c) 2013 Google, Inc
> +# Copyright 2022-2023 Arm Limited and/or its affiliates 
> 
>
>  ifdef CONFIG_HUSH_PARSER
>  obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
> @@ -19,6 +20,7 @@ obj-$(CONFIG_CMD_PWM) += pwm.o
>  obj-$(CONFIG_CMD_SEAMA) += seama.o
>  ifdef CONFIG_SANDBOX
>  obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
> +obj-$(CONFIG_SANDBOX_FFA) += armffa.o
>  endif
>  obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
>  obj-$(CONFIG_CMD_WGET) += wget.o
> diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c
> new file mode 100644
> index 00..73c895f182
> --- /dev/null
> +++ b/test/cmd/armffa.c
> @@ -0,0 +1,39 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Test for armffa command
> + *
> + * Copyright 2022-2023 Arm Limited and/or its affiliates 
> 
> + *
> + * Authors:
> + *   Abdellatif El Khlifi 
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define PING_CMD_SIZE 19
> +
> +/* Basic test of 'armffa' command */
> +static int dm_test_armffa_cmd(struct unit_test_state *uts)
> +{
> +   char ping_cmd[PING_CMD_SIZE] = {0};
> +
> +   /* armffa getpart  */
> +   ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0));
> +
> +   snprintf(ping_cmd, PING_CMD_SIZE, "armffa ping 0x%x", SANDBOX_SP1_ID);
> +
> +   /* armffa ping  */
> +   ut_assertok(run_command(ping_cmd, 0));
> +
> +   /* armffa devlist */
> +   ut_assertok(run_command("armffa devlist", 0));
> +
> +   return CMD_RET_SUCCESS;

return 0

(this isn't even a command, it is a test)

> +}
> +
> +DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
> --
> 2.25.1
>

Regards,
Simon


[PATCH v9 08/10] arm_ffa: introduce armffa command Sandbox test

2023-03-10 Thread Abdellatif El Khlifi
Add Sandbox test for the armffa command

Signed-off-by: Abdellatif El Khlifi 
Cc: Tom Rini 
Cc: Simon Glass 
Cc: Ilias Apalodimas 
Cc: Jens Wiklander 

---
Changelog:
===

v9: align the test with FF-A discovery through DM

v4: drop use of helper APIs

v1: introduce armffa command sandbox test

 MAINTAINERS   |  1 +
 test/cmd/Makefile |  2 ++
 test/cmd/armffa.c | 39 +++
 3 files changed, 42 insertions(+)
 create mode 100644 test/cmd/armffa.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 6939b832e4..b36fb41668 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -275,6 +275,7 @@ F:  doc/usage/cmd/armffa.rst
 F: drivers/firmware/arm-ffa/
 F: include/arm_ffa.h
 F: include/sandbox_arm_ffa.h
+F: test/cmd/armffa.c
 F: test/dm/ffa.c
 
 ARM FREESCALE IMX
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index 2ffde8703a..e74da56a29 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (c) 2013 Google, Inc
+# Copyright 2022-2023 Arm Limited and/or its affiliates 

 
 ifdef CONFIG_HUSH_PARSER
 obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o
@@ -19,6 +20,7 @@ obj-$(CONFIG_CMD_PWM) += pwm.o
 obj-$(CONFIG_CMD_SEAMA) += seama.o
 ifdef CONFIG_SANDBOX
 obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
+obj-$(CONFIG_SANDBOX_FFA) += armffa.o
 endif
 obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o
 obj-$(CONFIG_CMD_WGET) += wget.o
diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c
new file mode 100644
index 00..73c895f182
--- /dev/null
+++ b/test/cmd/armffa.c
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test for armffa command
+ *
+ * Copyright 2022-2023 Arm Limited and/or its affiliates 

+ *
+ * Authors:
+ *   Abdellatif El Khlifi 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PING_CMD_SIZE 19
+
+/* Basic test of 'armffa' command */
+static int dm_test_armffa_cmd(struct unit_test_state *uts)
+{
+   char ping_cmd[PING_CMD_SIZE] = {0};
+
+   /* armffa getpart  */
+   ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0));
+
+   snprintf(ping_cmd, PING_CMD_SIZE, "armffa ping 0x%x", SANDBOX_SP1_ID);
+
+   /* armffa ping  */
+   ut_assertok(run_command(ping_cmd, 0));
+
+   /* armffa devlist */
+   ut_assertok(run_command("armffa devlist", 0));
+
+   return CMD_RET_SUCCESS;
+}
+
+DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);
-- 
2.25.1