diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/cmd/Makefile | 2 | ||||
-rw-r--r-- | test/cmd/armffa.c | 33 | ||||
-rw-r--r-- | test/dm/Makefile | 3 | ||||
-rw-r--r-- | test/dm/cpu.c | 2 | ||||
-rw-r--r-- | test/dm/ffa.c | 261 | ||||
-rw-r--r-- | test/dm/pinmux.c | 92 | ||||
-rw-r--r-- | test/lib/Makefile | 1 | ||||
-rw-r--r-- | test/lib/uuid.c | 41 |
8 files changed, 392 insertions, 43 deletions
diff --git a/test/cmd/Makefile b/test/cmd/Makefile index a3cf983739..6e3d7e919e 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 <open-source-office@arm.com> ifdef CONFIG_HUSH_PARSER obj-$(CONFIG_CONSOLE_RECORD) += test_echo.o @@ -24,6 +25,7 @@ obj-$(CONFIG_CMD_SEAMA) += seama.o ifdef CONFIG_SANDBOX obj-$(CONFIG_CMD_READ) += rw.o obj-$(CONFIG_CMD_SETEXPR) += setexpr.o +obj-$(CONFIG_ARM_FFA_TRANSPORT) += 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 0000000000..9a44a397e8 --- /dev/null +++ b/test/cmd/armffa.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test for armffa command + * + * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> + * + * Authors: + * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> + */ + +#include <common.h> +#include <string.h> +#include <asm/sandbox_arm_ffa.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h> + +/* Basic test of 'armffa' command */ +static int dm_test_armffa_cmd(struct unit_test_state *uts) +{ + /* armffa getpart <UUID> */ + ut_assertok(run_command("armffa getpart " SANDBOX_SERVICE1_UUID, 0)); + + /* armffa ping <ID> */ + ut_assertok(run_commandf("armffa ping 0x%x", SANDBOX_SP1_ID)); + + /* armffa devlist */ + ut_assertok(run_command("armffa devlist", 0)); + + return 0; +} + +DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); diff --git a/test/dm/Makefile b/test/dm/Makefile index 3799b1ae8f..7ed00733c1 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ # # Copyright (c) 2013 Google, Inc -# Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com> +# Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> obj-$(CONFIG_UT_DM) += test-dm.o @@ -92,6 +92,7 @@ obj-$(CONFIG_POWER_DOMAIN) += power-domain.o obj-$(CONFIG_ACPI_PMC) += pmc.o obj-$(CONFIG_DM_PMIC) += pmic.o obj-$(CONFIG_DM_PWM) += pwm.o +obj-$(CONFIG_ARM_FFA_TRANSPORT) += ffa.o obj-$(CONFIG_QFW) += qfw.o obj-$(CONFIG_RAM) += ram.o obj-y += regmap.o diff --git a/test/dm/cpu.c b/test/dm/cpu.c index d7e596ee39..5734cd0a92 100644 --- a/test/dm/cpu.c +++ b/test/dm/cpu.c @@ -37,7 +37,7 @@ static int dm_test_cpu(struct unit_test_state *uts) ut_assertok(cpu_get_info(dev, &info)); ut_asserteq(info.cpu_freq, 42 * 42 * 42 * 42 * 42); ut_asserteq(info.features, 0x42424242); - ut_asserteq(info.address_width, 32); + ut_asserteq(info.address_width, IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32); ut_asserteq(cpu_get_count(dev), 42); diff --git a/test/dm/ffa.c b/test/dm/ffa.c new file mode 100644 index 0000000000..6912666bb4 --- /dev/null +++ b/test/dm/ffa.c @@ -0,0 +1,261 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Functional tests for UCLASS_FFA class + * + * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> + * + * Authors: + * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> + */ + +#include <common.h> +#include <console.h> +#include <dm.h> +#include <asm/sandbox_arm_ffa.h> +#include <asm/sandbox_arm_ffa_priv.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h> + +/* Functional tests for the UCLASS_FFA */ + +static int check_fwk_version(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + struct ffa_sandbox_data func_data; + u32 fwk_version = 0; + + func_data.data0 = &fwk_version; + func_data.data0_size = sizeof(fwk_version); + ut_assertok(sandbox_query_ffa_emul_state(FFA_VERSION, &func_data)); + ut_asserteq(uc_priv->fwk_version, fwk_version); + + return 0; +} + +static int check_endpoint_id(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + ut_asserteq(0, uc_priv->id); + + return 0; +} + +static int check_rxtxbuf(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + ut_assertnonnull(uc_priv->pair.rxbuf); + ut_assertnonnull(uc_priv->pair.txbuf); + + return 0; +} + +static int check_features(struct ffa_priv *uc_priv, struct unit_test_state *uts) +{ + ut_assert(uc_priv->pair.rxtx_min_pages == RXTX_4K || + uc_priv->pair.rxtx_min_pages == RXTX_16K || + uc_priv->pair.rxtx_min_pages == RXTX_64K); + + return 0; +} + +static int check_rxbuf_mapped_flag(u32 queried_func_id, + u8 rxbuf_mapped, + struct unit_test_state *uts) +{ + switch (queried_func_id) { + case FFA_RXTX_MAP: + ut_asserteq(1, rxbuf_mapped); + break; + case FFA_RXTX_UNMAP: + ut_asserteq(0, rxbuf_mapped); + break; + default: + ut_assert(false); + } + + return 0; +} + +static int check_rxbuf_release_flag(u8 rxbuf_owned, struct unit_test_state *uts) +{ + ut_asserteq(0, rxbuf_owned); + + return 0; +} + +static int test_ffa_msg_send_direct_req(u16 part_id, struct unit_test_state *uts) +{ + struct ffa_send_direct_data msg; + u8 cnt; + struct udevice *dev; + + ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev)); + + ut_assertok(ffa_sync_send_receive(dev, part_id, &msg, 1)); + + for (cnt = 0; cnt < sizeof(struct ffa_send_direct_data) / sizeof(u64); cnt++) + ut_asserteq_64(-1UL, ((u64 *)&msg)[cnt]); + + return 0; +} + +static int test_partitions_and_comms(const char *service_uuid, + struct unit_test_state *uts) +{ + struct ffa_partition_desc *descs; + u32 count, i, j, valid_sps = 0; + struct udevice *dev; + struct ffa_sandbox_data func_data; + struct ffa_partitions *partitions; + + ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev)); + + /* Get from the driver the count and information of the SPs matching the UUID */ + ut_assertok(ffa_partition_info_get(dev, service_uuid, &count, &descs)); + + /* Make sure the count is correct */ + ut_asserteq(SANDBOX_SP_COUNT_PER_VALID_SERVICE, count); + + /* SPs found , verify the partitions information */ + + func_data.data0 = &partitions; + func_data.data0_size = sizeof(struct ffa_partitions *); + ut_assertok(sandbox_query_ffa_emul_state(FFA_PARTITION_INFO_GET, &func_data)); + + for (i = 0; i < count ; i++) { + for (j = 0; + j < partitions->count; + j++) { + if (descs[i].info.id == + partitions->descs[j].info.id) { + valid_sps++; + ut_asserteq_mem(&descs[i], + &partitions->descs[j], + sizeof(struct ffa_partition_desc)); + /* Send and receive data from the current partition */ + test_ffa_msg_send_direct_req(descs[i].info.id, uts); + } + } + } + + /* Verify expected partitions found in the emulated secure world */ + ut_asserteq(SANDBOX_SP_COUNT_PER_VALID_SERVICE, valid_sps); + + return 0; +} + +static int dm_test_ffa_ack(struct unit_test_state *uts) +{ + struct ffa_priv *uc_priv; + struct ffa_sandbox_data func_data; + u8 rxbuf_flag = 0; + const char *svc1_uuid = SANDBOX_SERVICE1_UUID; + const char *svc2_uuid = SANDBOX_SERVICE2_UUID; + struct udevice *dev; + + /* Test probing the sandbox FF-A bus */ + ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev)); + + /* Get a pointer to the sandbox FF-A bus private data */ + uc_priv = dev_get_uclass_priv(dev); + + /* Make sure the private data pointer is retrieved */ + ut_assertnonnull(uc_priv); + + /* Test FFA_VERSION */ + check_fwk_version(uc_priv, uts); + + /* Test FFA_ID_GET */ + check_endpoint_id(uc_priv, uts); + + /* Test FFA_FEATURES */ + check_features(uc_priv, uts); + + /* Test RX/TX buffers */ + check_rxtxbuf(uc_priv, uts); + + /* Test FFA_RXTX_MAP */ + func_data.data0 = &rxbuf_flag; + func_data.data0_size = sizeof(rxbuf_flag); + + rxbuf_flag = 0; + sandbox_query_ffa_emul_state(FFA_RXTX_MAP, &func_data); + check_rxbuf_mapped_flag(FFA_RXTX_MAP, rxbuf_flag, uts); + + /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */ + test_partitions_and_comms(svc1_uuid, uts); + + /* Test FFA_RX_RELEASE */ + rxbuf_flag = 1; + sandbox_query_ffa_emul_state(FFA_RX_RELEASE, &func_data); + check_rxbuf_release_flag(rxbuf_flag, uts); + + /* FFA_PARTITION_INFO_GET / FFA_MSG_SEND_DIRECT_REQ */ + test_partitions_and_comms(svc2_uuid, uts); + + /* Test FFA_RX_RELEASE */ + rxbuf_flag = 1; + ut_assertok(sandbox_query_ffa_emul_state(FFA_RX_RELEASE, &func_data)); + check_rxbuf_release_flag(rxbuf_flag, uts); + + return 0; +} + +DM_TEST(dm_test_ffa_ack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); + +static int dm_test_ffa_nack(struct unit_test_state *uts) +{ + struct ffa_priv *uc_priv; + const char *valid_svc_uuid = SANDBOX_SERVICE1_UUID; + const char *unvalid_svc_uuid = SANDBOX_SERVICE3_UUID; + const char *unvalid_svc_uuid_str = SANDBOX_SERVICE4_UUID; + struct ffa_send_direct_data msg; + int ret; + u32 count; + u16 part_id = 0; + struct udevice *dev; + struct ffa_partition_desc *descs = NULL; + + /* Test probing the sandbox FF-A bus */ + ut_assertok(uclass_first_device_err(UCLASS_FFA, &dev)); + + /* Get a pointer to the sandbox FF-A bus private data */ + uc_priv = dev_get_uclass_priv(dev); + + /* Make sure the private data pointer is retrieved */ + ut_assertnonnull(uc_priv); + + /* Query partitions count using invalid arguments */ + ret = ffa_partition_info_get(dev, NULL, NULL, NULL); + ut_asserteq(-EINVAL, ret); + ret = ffa_partition_info_get(dev, unvalid_svc_uuid, NULL, NULL); + ut_asserteq(-EINVAL, ret); + ret = ffa_partition_info_get(dev, unvalid_svc_uuid, &count, NULL); + ut_asserteq(-EINVAL, ret); + + /* Query partitions count using an invalid UUID string */ + ret = ffa_partition_info_get(dev, unvalid_svc_uuid_str, &count, &descs); + ut_asserteq(-EINVAL, ret); + + /* Query partitions count using an invalid UUID (no matching SP) */ + count = 0; + ret = ffa_partition_info_get(dev, unvalid_svc_uuid, &count, &descs); + ut_asserteq(0, count); + + /* Query partitions data using a valid UUID */ + count = 0; + ut_assertok(ffa_partition_info_get(dev, valid_svc_uuid, &count, &descs)); + /* Make sure partitions are detected */ + ut_asserteq(SANDBOX_SP_COUNT_PER_VALID_SERVICE, count); + ut_assertnonnull(descs); + + /* Send data to an invalid partition */ + ret = ffa_sync_send_receive(dev, part_id, &msg, 1); + ut_asserteq(-EINVAL, ret); + + /* Send data to a valid partition */ + part_id = uc_priv->partitions.descs[0].info.id; + ut_assertok(ffa_sync_send_receive(dev, part_id, &msg, 1)); + + return 0; +} + +DM_TEST(dm_test_ffa_nack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); diff --git a/test/dm/pinmux.c b/test/dm/pinmux.c index 265df4ccb9..6880b2d2cd 100644 --- a/test/dm/pinmux.c +++ b/test/dm/pinmux.c @@ -15,6 +15,16 @@ static char buf[64]; ut_asserteq_str(expected, (char *)&buf); \ } while (0) +#define test_muxing_regaddr(selector, regaddr, expected) do { \ + char estr[64] = { 0 }; \ + if (IS_ENABLED(CONFIG_PHYS_64BIT)) \ + snprintf(estr, sizeof(estr), "0x%016llx %s", (u64)regaddr, expected); \ + else \ + snprintf(estr, sizeof(estr), "0x%08x %s", (u32)regaddr, expected); \ + ut_assertok(pinctrl_get_pin_muxing(dev, selector, buf, sizeof(buf))); \ + ut_asserteq_str(estr, (char *)&buf); \ +} while (0) + #define test_name(selector, expected) do { \ ut_assertok(pinctrl_get_pin_name(dev, selector, buf, sizeof(buf))); \ ut_asserteq_str(expected, (char *)&buf); \ @@ -79,14 +89,14 @@ static int dm_test_pinctrl_single(struct unit_test_state *uts) test_name(0, "PIN0"); test_name(141, "PIN141"); test_name(142, "Error"); - test_muxing(0, "0x00000000 0x00000000 UNCLAIMED"); - test_muxing(18, "0x00000048 0x00000006 pinmux_pwm_pins"); - test_muxing(28, "0x00000070 0x00000030 pinmux_uart0_pins"); - test_muxing(29, "0x00000074 0x00000000 pinmux_uart0_pins"); - test_muxing(100, "0x00000190 0x0000000c pinmux_spi0_pins"); - test_muxing(101, "0x00000194 0x0000000c pinmux_spi0_pins"); - test_muxing(102, "0x00000198 0x00000023 pinmux_spi0_pins"); - test_muxing(103, "0x0000019c 0x0000000c pinmux_spi0_pins"); + test_muxing_regaddr(0, 0x0, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(18, 0x48, "0x00000006 pinmux_pwm_pins"); + test_muxing_regaddr(28, 0x70, "0x00000030 pinmux_uart0_pins"); + test_muxing_regaddr(29, 0x74, "0x00000000 pinmux_uart0_pins"); + test_muxing_regaddr(100, 0x190, "0x0000000c pinmux_spi0_pins"); + test_muxing_regaddr(101, 0x194, "0x0000000c pinmux_spi0_pins"); + test_muxing_regaddr(102, 0x198, "0x00000023 pinmux_spi0_pins"); + test_muxing_regaddr(103, 0x19c, "0x0000000c pinmux_spi0_pins"); ret = pinctrl_get_pin_muxing(dev, 142, buf, sizeof(buf)); ut_asserteq(-EINVAL, ret); ut_assertok(uclass_get_device_by_name(UCLASS_I2C, "i2c@0", &dev)); @@ -97,39 +107,39 @@ static int dm_test_pinctrl_single(struct unit_test_state *uts) test_name(0, "PIN0"); test_name(159, "PIN159"); test_name(160, "Error"); - test_muxing(0, "0x00000000 0x00000000 UNCLAIMED"); - test_muxing(34, "0x00000010 0x00000200 pinmux_i2c0_pins"); - test_muxing(35, "0x00000010 0x00002000 pinmux_i2c0_pins"); - test_muxing(130, "0x00000040 0x00000200 pinmux_lcd_pins"); - test_muxing(131, "0x00000040 0x00002000 pinmux_lcd_pins"); - test_muxing(132, "0x00000040 0x00020000 pinmux_lcd_pins"); - test_muxing(133, "0x00000040 0x00200000 pinmux_lcd_pins"); - test_muxing(134, "0x00000040 0x02000000 pinmux_lcd_pins"); - test_muxing(135, "0x00000040 0x20000000 pinmux_lcd_pins"); - test_muxing(136, "0x00000044 0x00000002 pinmux_lcd_pins"); - test_muxing(137, "0x00000044 0x00000020 pinmux_lcd_pins"); - test_muxing(138, "0x00000044 0x00000200 pinmux_lcd_pins"); - test_muxing(139, "0x00000044 0x00002000 pinmux_lcd_pins"); - test_muxing(140, "0x00000044 0x00020000 pinmux_lcd_pins"); - test_muxing(141, "0x00000044 0x00200000 pinmux_lcd_pins"); - test_muxing(142, "0x00000044 0x02000000 pinmux_lcd_pins"); - test_muxing(143, "0x00000044 0x20000000 pinmux_lcd_pins"); - test_muxing(144, "0x00000048 0x00000002 pinmux_lcd_pins"); - test_muxing(145, "0x00000048 0x00000020 pinmux_lcd_pins"); - test_muxing(146, "0x00000048 0x00000000 UNCLAIMED"); - test_muxing(147, "0x00000048 0x00000000 UNCLAIMED"); - test_muxing(148, "0x00000048 0x00000000 UNCLAIMED"); - test_muxing(149, "0x00000048 0x00000000 UNCLAIMED"); - test_muxing(150, "0x00000048 0x02000000 pinmux_lcd_pins"); - test_muxing(151, "0x00000048 0x00000000 UNCLAIMED"); - test_muxing(152, "0x0000004c 0x00000002 pinmux_lcd_pins"); - test_muxing(153, "0x0000004c 0x00000020 pinmux_lcd_pins"); - test_muxing(154, "0x0000004c 0x00000000 UNCLAIMED"); - test_muxing(155, "0x0000004c 0x00000000 UNCLAIMED"); - test_muxing(156, "0x0000004c 0x00000000 UNCLAIMED"); - test_muxing(157, "0x0000004c 0x00000000 UNCLAIMED"); - test_muxing(158, "0x0000004c 0x02000000 pinmux_lcd_pins"); - test_muxing(159, "0x0000004c 0x00000000 UNCLAIMED"); + test_muxing_regaddr(0, 0x0, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(34, 0x10, "0x00000200 pinmux_i2c0_pins"); + test_muxing_regaddr(35, 0x10, "0x00002000 pinmux_i2c0_pins"); + test_muxing_regaddr(130, 0x40, "0x00000200 pinmux_lcd_pins"); + test_muxing_regaddr(131, 0x40, "0x00002000 pinmux_lcd_pins"); + test_muxing_regaddr(132, 0x40, "0x00020000 pinmux_lcd_pins"); + test_muxing_regaddr(133, 0x40, "0x00200000 pinmux_lcd_pins"); + test_muxing_regaddr(134, 0x40, "0x02000000 pinmux_lcd_pins"); + test_muxing_regaddr(135, 0x40, "0x20000000 pinmux_lcd_pins"); + test_muxing_regaddr(136, 0x44, "0x00000002 pinmux_lcd_pins"); + test_muxing_regaddr(137, 0x44, "0x00000020 pinmux_lcd_pins"); + test_muxing_regaddr(138, 0x44, "0x00000200 pinmux_lcd_pins"); + test_muxing_regaddr(139, 0x44, "0x00002000 pinmux_lcd_pins"); + test_muxing_regaddr(140, 0x44, "0x00020000 pinmux_lcd_pins"); + test_muxing_regaddr(141, 0x44, "0x00200000 pinmux_lcd_pins"); + test_muxing_regaddr(142, 0x44, "0x02000000 pinmux_lcd_pins"); + test_muxing_regaddr(143, 0x44, "0x20000000 pinmux_lcd_pins"); + test_muxing_regaddr(144, 0x48, "0x00000002 pinmux_lcd_pins"); + test_muxing_regaddr(145, 0x48, "0x00000020 pinmux_lcd_pins"); + test_muxing_regaddr(146, 0x48, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(147, 0x48, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(148, 0x48, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(149, 0x48, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(150, 0x48, "0x02000000 pinmux_lcd_pins"); + test_muxing_regaddr(151, 0x48, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(152, 0x4c, "0x00000002 pinmux_lcd_pins"); + test_muxing_regaddr(153, 0x4c, "0x00000020 pinmux_lcd_pins"); + test_muxing_regaddr(154, 0x4c, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(155, 0x4c, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(156, 0x4c, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(157, 0x4c, "0x00000000 UNCLAIMED"); + test_muxing_regaddr(158, 0x4c, "0x02000000 pinmux_lcd_pins"); + test_muxing_regaddr(159, 0x4c, "0x00000000 UNCLAIMED"); ret = pinctrl_get_pin_muxing(dev, 160, buf, sizeof(buf)); ut_asserteq(-EINVAL, ret); return 0; diff --git a/test/lib/Makefile b/test/lib/Makefile index e0bd9e04e8..e75a263e6a 100644 --- a/test/lib/Makefile +++ b/test/lib/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_AES) += test_aes.o obj-$(CONFIG_GETOPT) += getopt.o obj-$(CONFIG_CRC8) += test_crc8.o obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o +obj-$(CONFIG_LIB_UUID) += uuid.o else obj-$(CONFIG_SANDBOX) += kconfig_spl.o endif diff --git a/test/lib/uuid.c b/test/lib/uuid.c new file mode 100644 index 0000000000..e24331a136 --- /dev/null +++ b/test/lib/uuid.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Functional tests for UCLASS_FFA class + * + * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> + * + * Authors: + * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> + */ + +#include <common.h> +#include <uuid.h> +#include <test/lib.h> +#include <test/test.h> +#include <test/ut.h> + +/* test UUID */ +#define TEST_SVC_UUID "ed32d533-4209-99e6-2d72-cdd998a79cc0" + +#define UUID_SIZE 16 + +/* The UUID binary data (little-endian format) */ +static const u8 ref_uuid_bin[UUID_SIZE] = { + 0x33, 0xd5, 0x32, 0xed, + 0x09, 0x42, 0xe6, 0x99, + 0x72, 0x2d, 0xc0, 0x9c, + 0xa7, 0x98, 0xd9, 0xcd +}; + +static int lib_test_uuid_to_le(struct unit_test_state *uts) +{ + const char *uuid_str = TEST_SVC_UUID; + u8 ret_uuid_bin[UUID_SIZE] = {0}; + + ut_assertok(uuid_str_to_le_bin(uuid_str, ret_uuid_bin)); + ut_asserteq_mem(ref_uuid_bin, ret_uuid_bin, UUID_SIZE); + + return 0; +} + +LIB_TEST(lib_test_uuid_to_le, 0); |