From: Luiz Augusto von Dentz <[email protected]>
This adds Basic RFCOMM Socket Client - Close test which attempt to close
socket while connecting.
---
tools/rfcomm-tester.c | 43 ++++++++++++++++++++++++++++++++++++++-----
1 file changed, 38 insertions(+), 5 deletions(-)
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index d594ebf345ce..a9adf7f0f52d 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -47,6 +47,7 @@ struct test_data {
struct rfcomm_client_data {
uint8_t server_channel;
uint8_t client_channel;
+ bool close;
int expected_connect_err;
const uint8_t *send_data;
const uint8_t *read_data;
@@ -297,6 +298,12 @@ const struct rfcomm_client_data connect_success = {
.client_channel = 0x0c
};
+const struct rfcomm_client_data connect_close = {
+ .server_channel = 0x0c,
+ .client_channel = 0x0c,
+ .close = true
+};
+
const uint8_t data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
const struct rfcomm_client_data connect_send_success = {
@@ -519,6 +526,8 @@ static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
return false;
}
+ data->io = NULL;
+
if (err < 0)
tester_test_failed();
else
@@ -527,6 +536,20 @@ static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
return false;
}
+static gboolean rc_close_cb(GIOChannel *io, GIOCondition cond,
+ gpointer user_data)
+{
+ struct test_data *data = tester_get_data();
+
+ data->io_id = 0;
+
+ tester_print("Closed");
+
+ tester_test_passed();
+
+ return false;
+}
+
static void client_hook_func(const void *data, uint16_t len,
void *user_data)
{
@@ -627,13 +650,20 @@ static void test_connect(const void *test_data)
}
io = g_io_channel_unix_new(sk);
- g_io_channel_set_close_on_unref(io, TRUE);
-
- data->io_id = g_io_add_watch(io, G_IO_OUT, rc_connect_cb, NULL);
-
- g_io_channel_unref(io);
tester_print("Connect in progress %d", sk);
+
+ if (cli->close) {
+ data->io_id = g_io_add_watch(io, G_IO_NVAL, rc_close_cb, NULL);
+ close(sk);
+ tester_print("Close socket %d", sk);
+ } else {
+ g_io_channel_set_close_on_unref(io, TRUE);
+ data->io_id = g_io_add_watch(io, G_IO_OUT, rc_connect_cb,
+ NULL);
+ }
+
+ g_io_channel_unref(io);
}
static gboolean server_received_data(GIOChannel *io, GIOCondition cond,
@@ -815,6 +845,9 @@ int main(int argc, char *argv[])
test_connect);
test_rfcomm("Basic RFCOMM Socket Client - Conn Refused",
&connect_nval, setup_powered_client, test_connect);
+ test_rfcomm("Basic RFCOMM Socket Client - Close",
+ &connect_close, setup_powered_client,
+ test_connect);
test_rfcomm("Basic RFCOMM Socket Server - Success", &listen_success,
setup_powered_server, test_server);
test_rfcomm("Basic RFCOMM Socket Server - Write Success",
--
2.37.3
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=676715
---Test result---
Test Summary:
CheckPatch PASS 1.45 seconds
GitLint PASS 1.01 seconds
Prep - Setup ELL PASS 27.14 seconds
Build - Prep PASS 0.88 seconds
Build - Configure PASS 8.64 seconds
Build - Make PASS 954.48 seconds
Make Check PASS 12.11 seconds
Make Check w/Valgrind PASS 291.47 seconds
Make Distcheck PASS 240.42 seconds
Build w/ext ELL - Configure PASS 8.76 seconds
Build w/ext ELL - Make PASS 84.35 seconds
Incremental Build w/ patches PASS 0.00 seconds
Scan Build PASS 503.77 seconds
---
Regards,
Linux Bluetooth