From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 4/4] test-uhid: Test bt_uhid_create and bt_uhid_destroy
Date: Fri, 8 Mar 2024 17:10:07 -0500 [thread overview]
Message-ID: <20240308221007.250681-4-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20240308221007.250681-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This test bt_uhid_create and bt_uhid_destroy instead of directly
submitting UHID_CREATE and UHID_DESTROY.
---
unit/test-uhid.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/unit/test-uhid.c b/unit/test-uhid.c
index 8a8eef855bc5..f2f9cda097af 100644
--- a/unit/test-uhid.c
+++ b/unit/test-uhid.c
@@ -228,19 +228,31 @@ static const struct uhid_event ev_feature = {
static void test_client(gconstpointer data)
{
struct context *context = create_context(data);
+ int err;
- if (g_str_equal(context->data->test_name, "/uhid/command/create"))
- bt_uhid_send(context->uhid, &ev_create);
+ err = bt_uhid_create(context->uhid, "", NULL, NULL, 0, 0, 0, 0, NULL,
+ 0);
+ if (err < 0)
+ tester_test_failed();
- if (g_str_equal(context->data->test_name, "/uhid/command/destroy"))
- bt_uhid_send(context->uhid, &ev_destroy);
+ if (g_str_equal(context->data->test_name, "/uhid/command/destroy")) {
+ err = bt_uhid_destroy(context->uhid);
+ if (err < 0)
+ tester_test_failed();
+ }
if (g_str_equal(context->data->test_name,
- "/uhid/command/feature_answer"))
- bt_uhid_send(context->uhid, &ev_feature_answer);
+ "/uhid/command/feature_answer")) {
+ err = bt_uhid_send(context->uhid, &ev_feature_answer);
+ if (err < 0)
+ tester_test_failed();
+ }
- if (g_str_equal(context->data->test_name, "/uhid/command/input"))
- bt_uhid_send(context->uhid, &ev_input);
+ if (g_str_equal(context->data->test_name, "/uhid/command/input")) {
+ err = bt_uhid_send(context->uhid, &ev_input);
+ if (err < 0)
+ tester_test_failed();
+ }
context_quit(context);
}
--
2.43.0
next prev parent reply other threads:[~2024-03-08 22:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 22:10 [PATCH BlueZ v1 1/4] shared/uhid: Add bt_uhid_create Luiz Augusto von Dentz
2024-03-08 22:10 ` [PATCH BlueZ v1 2/4] hog-lib: Use bt_uhid_create instead of UHID_CREATE2 Luiz Augusto von Dentz
2024-03-08 22:10 ` [PATCH BlueZ v1 3/4] input: Use bt_uhid_create instead of UHID_CREATE Luiz Augusto von Dentz
2024-03-08 22:10 ` Luiz Augusto von Dentz [this message]
2024-03-09 0:53 ` [BlueZ,v1,1/4] shared/uhid: Add bt_uhid_create bluez.test.bot
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=20240308221007.250681-4-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;
as well as URLs for NNTP newsgroup(s).