Linux bluetooth development
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Subject: [BlueZ v11 08/14] unit: Run test-bap tests concurrently
Date: Tue, 24 Nov 2026 16:50:39 +0100	[thread overview]
Message-ID: <20261124155319.1752879-9-hadess@hadess.net> (raw)
In-Reply-To: <20261124155319.1752879-1-hadess@hadess.net>

---
 meson.build           |  2 +-
 unit/meson.build      | 25 ++++++++++++++++++++++---
 unit/unittest_list.sh | 15 +++++++++++++++
 3 files changed, 38 insertions(+), 4 deletions(-)
 create mode 100644 unit/unittest_list.sh

diff --git a/meson.build b/meson.build
index d8ded120bb7d..d3cd76c1032b 100644
--- a/meson.build
+++ b/meson.build
@@ -297,6 +297,7 @@ endif
 if rst2man.found()
   subdir('doc')
 endif
+sh = find_program('sh', required: true)
 if get_option('tests').allowed()
   subdir('test')
   subdir('unit')
@@ -304,7 +305,6 @@ endif
 
 # Fix permissions on install
 install = find_program('install')
-sh = find_program('sh')
 if get_option('daemon').enabled()
   meson.add_install_script(sh, '-c', 'install -dm755 ${DESTDIR}/' + configdir)
 endif
diff --git a/unit/meson.build b/unit/meson.build
index 317f138b97d9..973fa82a24f8 100644
--- a/unit/meson.build
+++ b/unit/meson.build
@@ -8,7 +8,6 @@ tests1 = [
   [ 'test-avrcp.c', '../src/log.c', 'avctp.c', 'avrcp-lib.c', '../profiles/audio/avrcp-parse.c' ],
   [ 'test-lib.c' ],
   [ 'test-gatt.c' ],
-  [ 'test-bap.c' ],
   [ 'test-micp.c' ],
   [ 'test-bass.c' ],
   [ 'test-vcp.c' ],
@@ -34,6 +33,26 @@ foreach t: tests1
 endforeach
 
 tests2 = [
+  [ 'test-bap.c' ],
+]
+
+unittest_list = find_program('unittest_list.sh')
+
+foreach t: tests2
+  test_name = t[0].substring(0, -2)
+  exe = executable(test_name,
+    sources: t,
+    dependencies: [ libshared_glib_dep, libbluetooth_internal_dep ],
+  )
+
+  r = run_command(sh, unittest_list, t, check: true)
+  unit_tests = r.stdout().strip().split(' ')
+  foreach ut: unit_tests
+    test(ut, exe, args: [ '-p', ut ])
+  endforeach
+endforeach
+
+tests3 = [
   [ 'test-textfile.c', '../src/textfile.c' ],
   [ 'test-crc.c', '../monitor/crc.c' ],
   [ 'test-crypto.c' ],
@@ -49,7 +68,7 @@ tests2 = [
 ]
 
 if ical_dep.found()
-  tests2 += [
+  tests3 += [
     [ 'test-gobex.c', 'util.c', gobex_sources ],
     [ 'test-gobex-packet.c', 'util.c', gobex_sources ],
     [ 'test-gobex-header.c', 'util.c', gobex_sources ],
@@ -58,7 +77,7 @@ if ical_dep.found()
   ]
 endif
 
-foreach t: tests2
+foreach t: tests3
   test_name = t[0].substring(0, -2)
   exe = executable(test_name,
     sources: t,
diff --git a/unit/unittest_list.sh b/unit/unittest_list.sh
new file mode 100644
index 000000000000..c478edc9d3e4
--- /dev/null
+++ b/unit/unittest_list.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ $# -lt 1 ] ; then
+	echo "Usage: $0 FILE..."
+	exit 1
+fi
+
+TESTS=$(grep '^[[:space:]]*define_test[_a-z]*("' $* | cut -d \" -f 2 | cut -d " " -f 1)
+if [ -z "$TESTS" ] ; then
+	TESTS=$(grep '^[[:space:]]*tester_add("' $* | cut -d \" -f 2 | cut -d " " -f 1)
+fi
+if [ -z "$TESTS" ] ; then
+	TESTS=$(grep '^[[:space:]]*g_test_add_*func("' $* | cut -d \" -f 2 | cut -d " " -f 1)
+fi
+echo $TESTS
-- 
2.56.0


  parent reply	other threads:[~2026-11-24 15:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 15:50 [BlueZ v11 00/14] Add meson build system, tool unit tests, and HTML docs Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 01/14] build: Add meson wrap for libell Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 02/14] build: Add meson build system Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 03/14] build: Separate systemd and libsystemd dependencies Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 04/14] tools: Install avinfo tool by default Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 05/14] emulator: Install the emulator if built Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 06/14] build: Add option to allow disabling bluetoothd Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 07/14] build: Only build profiles if the daemon is built Bastien Nocera
2026-11-24 15:50 ` Bastien Nocera [this message]
2026-11-24 15:50 ` [BlueZ v11 09/14] unit: Make gobex-transfer tests run concurrently Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 10/14] build: Only build gdbus library if there is a user Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 11/14] unit: Add command-line tool tests Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 12/14] doc: Add HTML documentation Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 13/14] github: Add docs deployment Bastien Nocera
2026-11-24 15:50 ` [BlueZ v11 14/14] doc: Add introduction to GATT Bastien Nocera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124155319.1752879-9-hadess@hadess.net \
    --to=hadess@hadess.net \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox