Skip to contentSkip to conversation

Unit tests speed-up

PATCH Applied Bastien Nocera 3 participants 7 messages Jan 9 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

cover Unit tests speed-up

With those small changes, as well as running tests concurrently using meson, I was able to make the whole test suite run in less than 4 seconds on my desktop system, with a baseline of 50 seconds for "make -j8 check" under the autotools.

make -j8 check: 50 seconds
meson before changes: 13 seconds
meson after changes: 3.6 seconds

Bastien Nocera (3):
unit: Speed up unit-avdtp test
unit: Speed up unit-gobex-transfer test
unit: Speed up unit-ringbuf test

 unit/test-avdtp.c          | 2 +-
 unit/test-gobex-transfer.c | 2 +-
 unit/test-ringbuf.c        | 3 ---
 3 files changed, 2 insertions(+), 5 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/3 unit: Speed up unit-avdtp test

Speed up /TP/SIG/SMG/BI-02-C by reducing the timeout length from 1 second to 100 milliseconds.

This reduces the runtime from 1.5 secs to 0.1 secs.

---
 unit/test-avdtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
unit/test-avdtp.c +1 -1
index 460982b2c542..9833b03be408 100644
@@ -148,7 +148,7 @@ static gboolean send_pdu(gpointer user_data)
 	g_assert_cmpint(len, ==, pdu->size);
 
 	if (g_str_equal(context->data->test_name, "/TP/SIG/SMG/BI-02-C"))
-		g_timeout_add_seconds(1, context_quit, context);
+		g_timeout_add(100, context_quit, context);
 
 	if (pdu->fragmented)
 		return send_pdu(user_data);
Signature · 1 line
2.52.0
#2 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1040361

---Test result---

Test Summary:

CheckPatch                    PENDING   0.37 seconds
GitLint                       PENDING   0.40 seconds
BuildEll                      PASS      18.70 seconds
BluezMake                     PASS      633.86 seconds
MakeCheck                     PASS      18.63 seconds
MakeDistcheck                 PASS      217.16 seconds
CheckValgrind                 PASS      276.15 seconds
CheckSmatch                   PASS      309.87 seconds
bluezmakeextell               PASS      167.47 seconds
IncrementalBuild              PENDING   0.41 seconds
ScanBuild                     PASS      913.96 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#3 lore raw

FWIW,

Those are the speed-up results for the bot.

Quoted 1 line · On Fri, 2026-01-09 at 02:26 -0800, [email protected] wrote:

<snip>

Quoted 1 line

MakeCheck                     PASS      18.63 seconds

vs. an earlier run:

Quoted 1 line

MakeCheck PASS 21.64 seconds

#4 lore raw

PATCH 2/3 unit: Speed up unit-gobex-transfer test

In reply to Bastien Nocera

Speed up /gobex/test_packet_put_req_suspend_resume by reducing the timeout length from seconds to hundreds of milliseconds.

This reduces the runtime from 1.5 secs to 0.1 secs.

---
 unit/test-gobex-transfer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
unit/test-gobex-transfer.c +1 -1
index 4fc97f4541b8..d97e0ae430f7 100644
@@ -1123,7 +1123,7 @@ static gssize provide_seq_delay(void *buf, gsize len, gpointer user_data)
 
 	if (d->provide_delay > 0) {
 		g_obex_suspend(d->obex);
-		g_timeout_add_seconds(d->provide_delay, resume_obex, d);
+		g_timeout_add(d->provide_delay * 100, resume_obex, d);
 		d->provide_delay = 0;
 	}
 
Signature · 1 line
2.52.0
#5 lore raw

PATCH 3/3 unit: Speed up unit-ringbuf test

In reply to Bastien Nocera

Speed up /gobex/test_packet_put_req_suspend_resume by not printing debug for each of the million of iterations of our test.

If we carry on printing this, then either the terminal's output speed, or the debug capture from the test suite will throttle the test.

This reduces the runtime from 3.3 secs to 0.007 secs.

---
 unit/test-ringbuf.c | 3 ---
 1 file changed, 3 deletions(-)
unit/test-ringbuf.c +0 -3
index b1cf51115a41..0e348a49b8c9 100644
@@ -57,9 +57,6 @@ static void test_power2(const void *data)
 		while (size3 < i && size3 < SIZE_MAX)
 			size3 <<= 1;
 
-		tester_debug("%zu -> size1=%zu size2=%zu size3=%zu\n",
-						i, size1, size2, size3);
-
 		g_assert(size1 == size2);
 		g_assert(size2 == size3);
 		g_assert(size3 == size1);
Signature · 1 line
2.52.0
#6 lore raw
In reply to Bastien Nocera
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Fri, 9 Jan 2026 10:28:59 +0100 you wrote:

With those small changes, as well as running tests concurrently using meson, I was able to make the whole test suite run in less than 4 seconds on my desktop system, with a baseline of 50 seconds for "make -j8 check" under the autotools.

make -j8 check: 50 seconds
meson before changes: 13 seconds
meson after changes: 3.6 seconds

[...]

Here is the summary with links:
- [BlueZ,v1,1/3] unit: Speed up unit-avdtp test

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=51d93aca7afa
  - [BlueZ,v1,2/3] unit: Speed up unit-gobex-transfer test
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=027e29c34225
  - [BlueZ,v1,3/3] unit: Speed up unit-ringbuf test
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=00e5c016145a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html