Skip to contentSkip to conversation

test_bbdev: enable to be compiled on Windows

PATCH Superseded Andre Muezerie 3 participants 5 messages Jun 12, 2025 – Aug 29, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test_bbdev: enable to be compiled on Windows

This patch fixes a few issues which were preventing this test from getting compiled on Windows:

1) VLAs were removed: Variable Length Arrays are not supported by MSVC. Where possible constant C arrays were used. Where that approach was not possible alloca() was called instead.

2) rte_os_shim is included because this test relies on getline() function, which is not provided by Windows APIs.

---
 app/test-bbdev/main.c                 |   1 +
 app/test-bbdev/meson.build            |   6 --
 app/test-bbdev/test_bbdev.c           |   8 +-
 app/test-bbdev/test_bbdev_perf.c      | 126 ++++++++++++++------------
 app/test-bbdev/test_bbdev_vector.c    |   1 +
 lib/eal/windows/include/rte_os_shim.h |   1 +
 6 files changed, 76 insertions(+), 67 deletions(-)
app/test-bbdev/main.c +1 -0
index 8f6852e2ef..aee8dbb0fa 100644
@@ -14,6 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_lcore.h>
+#include <rte_os_shim.h>
 
 #include "main.h"
 
app/test-bbdev/meson.build +0 -6
index 85b060edec..f85a20c5b0 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'main.c',
         'test_bbdev.c',
app/test-bbdev/test_bbdev.c +5 -3
index 0bbce6ca92..2422312f6b 100644
@@ -548,9 +548,9 @@ test_bbdev_op_pool(void)
 static int
 test_bbdev_op_type(void)
 {
+#define OPS_COUNT 32
 	struct rte_mempool *mp_dec;
 
-	const unsigned int OPS_COUNT = 32;
 	struct rte_bbdev_dec_op *dec_ops_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *enc_ops_arr[OPS_COUNT];
 
@@ -576,14 +576,15 @@ test_bbdev_op_type(void)
 	rte_mempool_free(mp_dec);
 
 	return TEST_SUCCESS;
+#undef OPS_COUNT
 }
 
 static int
 test_bbdev_op_pool_size(void)
 {
+#define OPS_COUNT 128
 	struct rte_mempool *mp_none;
 
-	const unsigned int OPS_COUNT = 128;
 	struct rte_bbdev_enc_op *ops_enc_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *ops_ext_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *ops_ext2_arr[OPS_COUNT];
@@ -627,6 +628,7 @@ test_bbdev_op_pool_size(void)
 	rte_mempool_free(mp_none);
 
 	return TEST_SUCCESS;
+#undef OPS_COUNT
 }
 
 static int
@@ -815,7 +817,7 @@ test_bbdev_driver_init(void)
 
 	TEST_ASSERT(dev1->data->dev_id < RTE_BBDEV_MAX_DEVS,
 			"Failed test rte_bbdev_allocate: "
-			"invalid dev_id %" PRIu8 ", max number of devices %d ",
+			"invalid dev_id %" PRIu16 ", max number of devices %d ",
 			dev1->data->dev_id, RTE_BBDEV_MAX_DEVS);
 
 	TEST_ASSERT(dev1->state == RTE_BBDEV_INITIALIZED,
app/test-bbdev/test_bbdev_perf.c +68 -58

318 lines not on this page · raw message

app/test-bbdev/test_bbdev_vector.c +1 -0
index 8b32850982..f3def6aaaf 100644
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <rte_malloc.h>
+#include <rte_os_shim.h>
 
 #include "test_bbdev_vector.h"
 
lib/eal/windows/include/rte_os_shim.h +1 -0
index 0e74eb19c7..f16b2230c8 100644
@@ -7,6 +7,7 @@
 
 #include <rte_os.h>
 #include <rte_windows.h>
+#include <getline.h>
 
 /**
  * @file
Signature · 1 line
2.49.0.vfs.0.3
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines

-----Original Message-----
From: Andre Muezerie <[email protected]>
Sent: Thursday, June 12, 2025 8:25 AM
To: Chautru, Nicolas <[email protected]>; Dmitry Kozlyuk <[email protected]>; Tyler Retzlaff <[email protected]>
Cc: [email protected]; Andre Muezerie <[email protected]>
Subject: [PATCH] test_bbdev: enable to be compiled on Windows

This patch fixes a few issues which were preventing this test from getting compiled on Windows:

1) VLAs were removed: Variable Length Arrays are not supported by MSVC. Where possible constant C arrays were used. Where that approach was not possible alloca() was called instead.

Quoted 5 lines

2) rte_os_shim is included because this test relies on getline() function, which is not provided by Windows APIs.

---

#2 lore raw

PATCH v2 1/1 test_bbdev: enable to be compiled on Windows

In reply to Andre Muezerie

This patch fixes a few issues which were preventing this test from getting compiled on Windows:

1) VLAs were removed: Variable Length Arrays are not supported by MSVC. Where possible constant C arrays were used. Where that approach was not possible alloca() was called instead.

2) rte_os_shim is included because this test relies on getline() function, which is not provided by Windows APIs.

---
 app/test-bbdev/main.c                 |   1 +
 app/test-bbdev/meson.build            |   6 --
 app/test-bbdev/test_bbdev.c           |   8 +-
 app/test-bbdev/test_bbdev_perf.c      | 126 ++++++++++++++------------
 app/test-bbdev/test_bbdev_vector.c    |   1 +
 lib/eal/windows/include/rte_os_shim.h |   1 +
 6 files changed, 76 insertions(+), 67 deletions(-)
app/test-bbdev/main.c +1 -0
index 8f6852e2ef..aee8dbb0fa 100644
@@ -14,6 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_lcore.h>
+#include <rte_os_shim.h>
 
 #include "main.h"
 
app/test-bbdev/meson.build +0 -6
index 85b060edec..f85a20c5b0 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'main.c',
         'test_bbdev.c',
app/test-bbdev/test_bbdev.c +5 -3
index 0bbce6ca92..2422312f6b 100644
@@ -548,9 +548,9 @@ test_bbdev_op_pool(void)
 static int
 test_bbdev_op_type(void)
 {
+#define OPS_COUNT 32
 	struct rte_mempool *mp_dec;
 
-	const unsigned int OPS_COUNT = 32;
 	struct rte_bbdev_dec_op *dec_ops_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *enc_ops_arr[OPS_COUNT];
 
@@ -576,14 +576,15 @@ test_bbdev_op_type(void)
 	rte_mempool_free(mp_dec);
 
 	return TEST_SUCCESS;
+#undef OPS_COUNT
 }
 
 static int
 test_bbdev_op_pool_size(void)
 {
+#define OPS_COUNT 128
 	struct rte_mempool *mp_none;
 
-	const unsigned int OPS_COUNT = 128;
 	struct rte_bbdev_enc_op *ops_enc_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *ops_ext_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *ops_ext2_arr[OPS_COUNT];
@@ -627,6 +628,7 @@ test_bbdev_op_pool_size(void)
 	rte_mempool_free(mp_none);
 
 	return TEST_SUCCESS;
+#undef OPS_COUNT
 }
 
 static int
@@ -815,7 +817,7 @@ test_bbdev_driver_init(void)
 
 	TEST_ASSERT(dev1->data->dev_id < RTE_BBDEV_MAX_DEVS,
 			"Failed test rte_bbdev_allocate: "
-			"invalid dev_id %" PRIu8 ", max number of devices %d ",
+			"invalid dev_id %" PRIu16 ", max number of devices %d ",
 			dev1->data->dev_id, RTE_BBDEV_MAX_DEVS);
 
 	TEST_ASSERT(dev1->state == RTE_BBDEV_INITIALIZED,
app/test-bbdev/test_bbdev_perf.c +68 -58

318 lines not on this page · raw message

app/test-bbdev/test_bbdev_vector.c +1 -0
index 8b32850982..f3def6aaaf 100644
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <rte_malloc.h>
+#include <rte_os_shim.h>
 
 #include "test_bbdev_vector.h"
 
lib/eal/windows/include/rte_os_shim.h +1 -0
index 0e74eb19c7..f16b2230c8 100644
@@ -7,6 +7,7 @@
 
 #include <rte_os.h>
 #include <rte_windows.h>
+#include <getline.h>
 
 /**
  * @file
Signature · 1 line
2.49.0.vfs.0.4
#3 lore raw

PATCH v3 1/1 test_bbdev: enable to be compiled on Windows

In reply to Andre Muezerie

This patch fixes a few issues which were preventing this test from getting compiled on Windows:

1) VLAs were removed: Variable Length Arrays are not supported by MSVC. Where possible constant C arrays were used. Where that approach was not possible alloca() was called instead.

2) rte_os_shim is included because this test relies on getline() function, which is not provided by Windows APIs.

---
 app/test-bbdev/main.c                 |   1 +
 app/test-bbdev/meson.build            |   6 --
 app/test-bbdev/test_bbdev.c           |   8 +-
 app/test-bbdev/test_bbdev_perf.c      | 126 ++++++++++++++------------
 app/test-bbdev/test_bbdev_vector.c    |   1 +
 lib/eal/windows/include/rte_os_shim.h |   1 +
 6 files changed, 76 insertions(+), 67 deletions(-)
app/test-bbdev/main.c +1 -0
index 8f6852e2ef..aee8dbb0fa 100644
@@ -14,6 +14,7 @@
 #include <rte_string_fns.h>
 #include <rte_cycles.h>
 #include <rte_lcore.h>
+#include <rte_os_shim.h>
 
 #include "main.h"
 
app/test-bbdev/meson.build +0 -6
index 85b060edec..f85a20c5b0 100644
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources = files(
         'main.c',
         'test_bbdev.c',
app/test-bbdev/test_bbdev.c +5 -3
index 0bbce6ca92..2422312f6b 100644
@@ -548,9 +548,9 @@ test_bbdev_op_pool(void)
 static int
 test_bbdev_op_type(void)
 {
+#define OPS_COUNT 32
 	struct rte_mempool *mp_dec;
 
-	const unsigned int OPS_COUNT = 32;
 	struct rte_bbdev_dec_op *dec_ops_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *enc_ops_arr[OPS_COUNT];
 
@@ -576,14 +576,15 @@ test_bbdev_op_type(void)
 	rte_mempool_free(mp_dec);
 
 	return TEST_SUCCESS;
+#undef OPS_COUNT
 }
 
 static int
 test_bbdev_op_pool_size(void)
 {
+#define OPS_COUNT 128
 	struct rte_mempool *mp_none;
 
-	const unsigned int OPS_COUNT = 128;
 	struct rte_bbdev_enc_op *ops_enc_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *ops_ext_arr[OPS_COUNT];
 	struct rte_bbdev_enc_op *ops_ext2_arr[OPS_COUNT];
@@ -627,6 +628,7 @@ test_bbdev_op_pool_size(void)
 	rte_mempool_free(mp_none);
 
 	return TEST_SUCCESS;
+#undef OPS_COUNT
 }
 
 static int
@@ -815,7 +817,7 @@ test_bbdev_driver_init(void)
 
 	TEST_ASSERT(dev1->data->dev_id < RTE_BBDEV_MAX_DEVS,
 			"Failed test rte_bbdev_allocate: "
-			"invalid dev_id %" PRIu8 ", max number of devices %d ",
+			"invalid dev_id %" PRIu16 ", max number of devices %d ",
 			dev1->data->dev_id, RTE_BBDEV_MAX_DEVS);
 
 	TEST_ASSERT(dev1->state == RTE_BBDEV_INITIALIZED,
app/test-bbdev/test_bbdev_perf.c +68 -58

318 lines not on this page · raw message

app/test-bbdev/test_bbdev_vector.c +1 -0
index 8b32850982..f3def6aaaf 100644
@@ -10,6 +10,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <rte_malloc.h>
+#include <rte_os_shim.h>
 
 #include "test_bbdev_vector.h"
 
lib/eal/windows/include/rte_os_shim.h +1 -0
index 0e74eb19c7..f16b2230c8 100644
@@ -7,6 +7,7 @@
 
 #include <rte_os.h>
 #include <rte_windows.h>
+#include <getline.h>
 
 /**
  * @file
Signature · 1 line
2.50.1.vfs.0.0
#4 lore raw
Quoted 8 lines · Andre Muezerie

This patch fixes a few issues which were preventing this test from getting compiled on Windows:

1) VLAs were removed: Variable Length Arrays are not supported by MSVC. Where possible constant C arrays were used. Where that approach was not possible alloca() was called instead.

Quoted 5 lines

2) rte_os_shim is included because this test relies on getline() function, which is not provided by Windows APIs.

Applied, thanks.

Signature · 1 line
David Marchand