From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 4/5] unit/test-gatt: Add Notify Multiple server tests
Date: Tue, 3 Nov 2026 15:30:33 -0500 [thread overview]
Message-ID: <20261103203034.3904499-5-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20261103203034.3904499-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds server tests for sending Notify Multiple with the default and
a positive timeout, disabling it while a notification is pending, and
sending with it disabled.
---
unit/test-gatt.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 535baafc6f70..6d6d0c73ed40 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
@@ -2336,6 +2336,70 @@ static const struct test_step test_notification_server_1 = {
.length = 0x03,
};
+static void test_server_mnotify(struct context *context)
+{
+ const struct test_step *step = context->data->step;
+
+ bt_gatt_server_send_notification(context->server, step->handle,
+ step->value, step->length, true);
+ bt_gatt_server_send_notification(context->server, step->handle,
+ step->value, step->length, true);
+}
+
+static const struct test_step test_mnotify_server_1 = {
+ .handle = 0x0003,
+ .func = test_server_mnotify,
+ .value = read_data_1,
+ .length = 0x03,
+};
+
+static void test_server_mnotify_timeout(struct context *context)
+{
+ bt_gatt_server_set_mnotify_timeout(context->server, 1);
+ test_server_mnotify(context);
+}
+
+static const struct test_step test_mnotify_server_2 = {
+ .handle = 0x0003,
+ .func = test_server_mnotify_timeout,
+ .value = read_data_1,
+ .length = 0x03,
+};
+
+static void test_server_mnotify_flush(struct context *context)
+{
+ const struct test_step *step = context->data->step;
+
+ bt_gatt_server_send_notification(context->server, step->handle,
+ step->value, step->length, true);
+
+ /* Disabling sends the pending notification right away */
+ bt_gatt_server_set_mnotify_timeout(context->server, -1);
+}
+
+static const struct test_step test_mnotify_server_3 = {
+ .handle = 0x0003,
+ .func = test_server_mnotify_flush,
+ .value = read_data_1,
+ .length = 0x03,
+};
+
+static void test_server_mnotify_disabled(struct context *context)
+{
+ const struct test_step *step = context->data->step;
+
+ bt_gatt_server_set_mnotify_timeout(context->server, -1);
+ bt_gatt_server_send_notification(context->server, step->handle,
+ step->value, step->length, true);
+}
+
+static const struct test_step test_mnotify_server_4 = {
+ .handle = 0x0003,
+ .func = test_server_mnotify_disabled,
+ .value = read_data_1,
+ .length = 0x03,
+};
+
static uint8_t indication_received;
static void test_indication_cb(void *user_data)
@@ -3337,6 +3401,41 @@ int main(int argc, char *argv[])
raw_pdu(),
raw_pdu(0x1B, 0x03, 0x00, 0x01, 0x02, 0x03));
+ define_test_server("/robustness/mnotify", test_server, ts_small_db,
+ &test_mnotify_server_1,
+ raw_pdu(0x03, 0x00, 0x02),
+ raw_pdu(0x12, 0x04, 0x00, 0x01, 0x00),
+ raw_pdu(0x13),
+ raw_pdu(),
+ raw_pdu(0x23, 0x03, 0x00, 0x03, 0x00, 0x01, 0x02, 0x03,
+ 0x03, 0x00, 0x03, 0x00, 0x01, 0x02, 0x03));
+
+ define_test_server("/robustness/mnotify-timeout", test_server,
+ ts_small_db, &test_mnotify_server_2,
+ raw_pdu(0x03, 0x00, 0x02),
+ raw_pdu(0x12, 0x04, 0x00, 0x01, 0x00),
+ raw_pdu(0x13),
+ raw_pdu(),
+ raw_pdu(0x23, 0x03, 0x00, 0x03, 0x00, 0x01, 0x02, 0x03,
+ 0x03, 0x00, 0x03, 0x00, 0x01, 0x02, 0x03));
+
+ define_test_server("/robustness/mnotify-flush", test_server,
+ ts_small_db, &test_mnotify_server_3,
+ raw_pdu(0x03, 0x00, 0x02),
+ raw_pdu(0x12, 0x04, 0x00, 0x01, 0x00),
+ raw_pdu(0x13),
+ raw_pdu(),
+ raw_pdu(0x23, 0x03, 0x00, 0x03, 0x00, 0x01, 0x02,
+ 0x03));
+
+ define_test_server("/robustness/mnotify-disabled", test_server,
+ ts_small_db, &test_mnotify_server_4,
+ raw_pdu(0x03, 0x00, 0x02),
+ raw_pdu(0x12, 0x04, 0x00, 0x01, 0x00),
+ raw_pdu(0x13),
+ raw_pdu(),
+ raw_pdu(0x1B, 0x03, 0x00, 0x01, 0x02, 0x03));
+
define_test_server("/TP/GAI/SR/BV-01-C", test_server, ts_small_db,
&test_indication_server_1,
raw_pdu(0x03, 0x00, 0x02),
--
2.56.0
next prev parent reply other threads:[~2026-11-03 20:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 20:30 [PATCH BlueZ v1 0/5] Make Notify Multiple timeout configurable Luiz Augusto von Dentz
2026-11-03 20:30 ` [PATCH BlueZ v1 1/5] shared/mainloop: Free removed idles without waiting for events Luiz Augusto von Dentz
2026-11-03 22:42 ` Make Notify Multiple timeout configurable bluez.test.bot
2026-11-03 20:30 ` [PATCH BlueZ v1 2/5] shared/mainloop: Fix idle ID overflow Luiz Augusto von Dentz
2026-11-03 20:30 ` [PATCH BlueZ v1 3/5] shared/gatt-server: Add bt_gatt_server_set_mnotify_timeout Luiz Augusto von Dentz
2026-11-03 20:30 ` Luiz Augusto von Dentz [this message]
2026-11-03 20:30 ` [PATCH BlueZ v1 5/5] main.conf: Add NotifyMultiple option to GATT section Luiz Augusto von Dentz
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=20261103203034.3904499-5-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--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