All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] unit: reduce macro expansion volume
@ 2025-12-09 20:26 Pauli Virtanen
  2025-12-09 21:21 ` [BlueZ] " bluez.test.bot
  2025-12-10 21:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Pauli Virtanen @ 2025-12-09 20:26 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

define_test() in some of unit tests expands the long command sequences
three times.

Make it expand only once.

This reduces preprocessor output e.g. for test-bap.c from 23 Mb to 5 Mb,
for faster compilation.
---
 unit/test-bap.c  | 4 ++--
 unit/test-bass.c | 4 ++--
 unit/test-gmap.c | 4 ++--
 unit/test-micp.c | 8 ++++----
 unit/test-tmap.c | 4 ++--
 unit/test-vcp.c  | 4 ++--
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/unit/test-bap.c b/unit/test-bap.c
index 83457bc7b..2da427694 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
@@ -121,8 +121,8 @@ static struct bt_bap_pac_qos lc3_qos = {
 			data.caps = data.cfg->pac_caps;		\
 		if (data.cfg && data.cfg->pac_qos)		\
 			data.qos = data.cfg->pac_qos;		\
-		data.iovcnt = ARRAY_SIZE(iov_data(args));	\
-		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \
+		data.iovcnt = ARRAY_SIZE(iov);			\
+		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov));	\
 		data.streams = queue_new(); \
 		tester_add(name, &data, setup, function,	\
 				test_teardown);			\
diff --git a/unit/test-bass.c b/unit/test-bass.c
index 8d914cffa..0cdee043e 100644
--- a/unit/test-bass.c
+++ b/unit/test-bass.c
@@ -491,8 +491,8 @@ struct ccc_state {
 	do {							\
 		const struct iovec iov[] = { args };		\
 		static struct test_data data;			\
-		data.iovcnt = ARRAY_SIZE(iov_data(args));	\
-		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \
+		data.iovcnt = ARRAY_SIZE(iov);			\
+		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov));	\
 		tester_add(name, &data, NULL, function,	\
 				test_teardown);			\
 	} while (0)
diff --git a/unit/test-gmap.c b/unit/test-gmap.c
index ce9eeb8f9..8b37efd18 100644
--- a/unit/test-gmap.c
+++ b/unit/test-gmap.c
@@ -54,8 +54,8 @@ struct test_data {
 	do {							\
 		const struct iovec iov[] = { args };		\
 		static struct test_data data;			\
-		data.iovcnt = ARRAY_SIZE(iov_data(args));	\
-		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \
+		data.iovcnt = ARRAY_SIZE(iov);			\
+		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov));	\
 		data.cfg = _cfg;				\
 		tester_add(name, &data, setup, function,	\
 				test_teardown);			\
diff --git a/unit/test-micp.c b/unit/test-micp.c
index 9c4f834e7..ff17300d5 100644
--- a/unit/test-micp.c
+++ b/unit/test-micp.c
@@ -70,8 +70,8 @@ struct notify {
 	do {							\
 		const struct iovec iov[] = { args };		\
 		static struct test_data_mics data;			\
-		data.iovcnt = ARRAY_SIZE(iov_data(args));	\
-		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \
+		data.iovcnt = ARRAY_SIZE(iov);			\
+		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov));	\
 		tester_add(name, &data, NULL, function,	\
 				test_teardown_mics);			\
 	} while (0)
@@ -80,8 +80,8 @@ struct notify {
 	do {							\
 		const struct iovec iov[] = { args };		\
 		static struct test_data_micp data;			\
-		data.iovcnt = ARRAY_SIZE(iov_data(args));	\
-		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \
+		data.iovcnt = ARRAY_SIZE(iov);			\
+		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov));	\
 		tester_add(name, &data, test_setup, function,	\
 				test_teardown_micp);			\
 	} while (0)
diff --git a/unit/test-tmap.c b/unit/test-tmap.c
index 937dac6ee..e75d62119 100644
--- a/unit/test-tmap.c
+++ b/unit/test-tmap.c
@@ -51,8 +51,8 @@ struct test_data {
 	do {							\
 		const struct iovec iov[] = { args };		\
 		static struct test_data data;			\
-		data.iovcnt = ARRAY_SIZE(iov_data(args));	\
-		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \
+		data.iovcnt = ARRAY_SIZE(iov);			\
+		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov));	\
 		data.cfg = _cfg;				\
 		tester_add(name, &data, setup, function,	\
 				test_teardown);			\
diff --git a/unit/test-vcp.c b/unit/test-vcp.c
index 71c545656..4a60842e5 100644
--- a/unit/test-vcp.c
+++ b/unit/test-vcp.c
@@ -59,8 +59,8 @@ struct ccc_state {
 	do {							\
 		const struct iovec iov[] = { args };		\
 		static struct test_data data;			\
-		data.iovcnt = ARRAY_SIZE(iov_data(args));	\
-		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov_data(args))); \
+		data.iovcnt = ARRAY_SIZE(iov);			\
+		data.iov = util_iov_dup(iov, ARRAY_SIZE(iov));	\
 		tester_add(name, &data, NULL, function,	\
 				test_teardown);			\
 	} while (0)
-- 
2.51.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-10 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-09 20:26 [PATCH BlueZ] unit: reduce macro expansion volume Pauli Virtanen
2025-12-09 21:21 ` [BlueZ] " bluez.test.bot
2025-12-10 21:40 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.