linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BlueZ PATCH] tools: userchan-tester: Add test case for the closing channel
@ 2021-08-20  5:07 Tedd Ho-Jeong An
  2021-08-20  5:35 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 4+ messages in thread
From: Tedd Ho-Jeong An @ 2021-08-20  5:07 UTC (permalink / raw)
  To: linux-bluetooth

From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch adds a test casse for checking the controller power state
after closing the user channel.

When the user channel is closed, the controller should be powered down
state.
---
 tools/userchan-tester.c | 69 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/tools/userchan-tester.c b/tools/userchan-tester.c
index c17644fb8..095ef2689 100644
--- a/tools/userchan-tester.c
+++ b/tools/userchan-tester.c
@@ -40,6 +40,8 @@ struct test_data {
 	enum hciemu_type hciemu_type;
 	const void *test_data;
 	unsigned int remove_id;
+	struct bt_hci *hci;
+	uint32_t current_settings;
 };
 
 static void mgmt_debug(const char *str, void *user_data)
@@ -81,6 +83,8 @@ static void read_info_callback(uint8_t status, uint16_t length,
 	tester_print("  Name: %s", rp->name);
 	tester_print("  Short name: %s", rp->short_name);
 
+	data->current_settings = current_settings;
+
 	if (strcmp(hciemu_get_address(data->hciemu), addr)) {
 		tester_pre_setup_failed();
 		return;
@@ -291,6 +295,68 @@ static void test_open_failed(const void *test_data)
 	tester_test_failed();
 }
 
+static void close_read_info_callback(uint8_t status, uint16_t length,
+					const void *param, void *user_data)
+{
+	const struct mgmt_rp_read_info *rp = param;
+	uint32_t current_settings;
+
+	tester_print("Read Info callback");
+	tester_print("  Status: 0x%02x", status);
+
+	if (status || !param) {
+		tester_test_failed();
+		return;
+	}
+
+	current_settings = btohl(rp->current_settings);
+	if (current_settings & MGMT_SETTING_POWERED) {
+		tester_print("Controller is powered");
+		tester_test_failed();
+		return;
+	}
+
+	tester_test_passed();
+}
+
+static void setup_channel_open(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+
+	/* Check power off */
+	if (data->current_settings & MGMT_SETTING_POWERED) {
+		tester_print("Controller is powered");
+		tester_setup_failed();
+		return;
+	}
+
+	/* Open Channel */
+	data->hci = bt_hci_new_user_channel(data->mgmt_index);
+	if (!data->hci) {
+		mgmt_unregister(data->mgmt, data->remove_id);
+		data->remove_id = 0;
+
+		tester_setup_failed();
+		return;
+	}
+
+	tester_print("User Channel Opened");
+
+	tester_setup_complete();
+}
+
+static void test_close_success(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+
+	tester_print("Close User Channel");
+	bt_hci_unref(data->hci);
+
+	/* Check if power is off */
+	mgmt_send(data->mgmt, MGMT_OP_READ_INFO, data->mgmt_index, 0, NULL,
+					close_read_info_callback, NULL, NULL);
+}
+
 #define test_user(name, data, setup, func) \
 	do { \
 		struct test_data *user; \
@@ -316,6 +382,9 @@ int main(int argc, char *argv[])
 					setup_powered, test_open_failed);
 	test_user("User channel open - Power Toggle Success", INT_TO_PTR(true),
 					toggle_powered, test_open_success);
+	test_user("User channel close - Success", NULL,
+					setup_channel_open, test_close_success);
+
 
 	return tester_run();
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ] tools: userchan-tester: Add test case for the closing channel
  2021-08-20  5:07 [BlueZ PATCH] tools: userchan-tester: Add test case for the closing channel Tedd Ho-Jeong An
@ 2021-08-20  5:35 ` bluez.test.bot
  2021-09-17 20:32   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2021-08-20  5:35 UTC (permalink / raw)
  To: linux-bluetooth, hj.tedd.an

[-- Attachment #1: Type: text/plain, Size: 1953 bytes --]

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=534645

---Test result---

Test Summary:
CheckPatch                    PASS      0.40 seconds
GitLint                       PASS      0.12 seconds
Prep - Setup ELL              PASS      48.16 seconds
Build - Prep                  PASS      0.14 seconds
Build - Configure             PASS      8.45 seconds
Build - Make                  PASS      203.34 seconds
Make Check                    PASS      9.51 seconds
Make Distcheck                PASS      238.94 seconds
Build w/ext ELL - Configure   PASS      7.95 seconds
Build w/ext ELL - Make        PASS      190.48 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [BlueZ] tools: userchan-tester: Add test case for the closing channel
  2021-08-20  5:35 ` [BlueZ] " bluez.test.bot
@ 2021-09-17 20:32   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2021-09-17 20:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Tedd Ho-Jeong An

Hi Tedd,

On Thu, Aug 19, 2021 at 11:00 PM <bluez.test.bot@gmail.com> wrote:
>
> 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=534645
>
> ---Test result---
>
> Test Summary:
> CheckPatch                    PASS      0.40 seconds
> GitLint                       PASS      0.12 seconds
> Prep - Setup ELL              PASS      48.16 seconds
> Build - Prep                  PASS      0.14 seconds
> Build - Configure             PASS      8.45 seconds
> Build - Make                  PASS      203.34 seconds
> Make Check                    PASS      9.51 seconds
> Make Distcheck                PASS      238.94 seconds
> Build w/ext ELL - Configure   PASS      7.95 seconds
> Build w/ext ELL - Make        PASS      190.48 seconds
>
> Details
> ##############################
> Test: CheckPatch - PASS
> Desc: Run checkpatch.pl script with rule in .checkpatch.conf
>
> ##############################
> Test: GitLint - PASS
> Desc: Run gitlint with rule in .gitlint
>
> ##############################
> Test: Prep - Setup ELL - PASS
> Desc: Clone, build, and install ELL
>
> ##############################
> Test: Build - Prep - PASS
> Desc: Prepare environment for build
>
> ##############################
> Test: Build - Configure - PASS
> Desc: Configure the BlueZ source tree
>
> ##############################
> Test: Build - Make - PASS
> Desc: Build the BlueZ source tree
>
> ##############################
> Test: Make Check - PASS
> Desc: Run 'make check'
>
> ##############################
> Test: Make Distcheck - PASS
> Desc: Run distcheck to check the distribution
>
> ##############################
> Test: Build w/ext ELL - Configure - PASS
> Desc: Configure BlueZ source with '--enable-external-ell' configuration
>
> ##############################
> Test: Build w/ext ELL - Make - PASS
> Desc: Build BlueZ source with '--enable-external-ell' configuration
>
>
>
> ---
> Regards,
> Linux Bluetooth

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [BlueZ] tools: userchan-tester: Add test case for the closing channel
  2021-08-20  4:56 [BlueZ PATCH] " Tedd Ho-Jeong An
@ 2021-08-20  5:36 ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2021-08-20  5:36 UTC (permalink / raw)
  To: linux-bluetooth, hj.tedd.an

[-- Attachment #1: Type: text/plain, Size: 1953 bytes --]

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=534641

---Test result---

Test Summary:
CheckPatch                    PASS      0.38 seconds
GitLint                       PASS      0.13 seconds
Prep - Setup ELL              PASS      50.36 seconds
Build - Prep                  PASS      0.15 seconds
Build - Configure             PASS      9.09 seconds
Build - Make                  PASS      220.21 seconds
Make Check                    PASS      9.07 seconds
Make Distcheck                PASS      258.98 seconds
Build w/ext ELL - Configure   PASS      8.71 seconds
Build w/ext ELL - Make        PASS      207.69 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-17 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20  5:07 [BlueZ PATCH] tools: userchan-tester: Add test case for the closing channel Tedd Ho-Jeong An
2021-08-20  5:35 ` [BlueZ] " bluez.test.bot
2021-09-17 20:32   ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2021-08-20  4:56 [BlueZ PATCH] " Tedd Ho-Jeong An
2021-08-20  5:36 ` [BlueZ] " bluez.test.bot

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).