diff mbox series

[BlueZ,3/3] tools/mgmt-tester: Add test case for suspend while discovering

Message ID 20211006201300.186055-3-hj.tedd.an@gmail.com (mailing list archive)
State Superseded
Headers show
Series [BlueZ,1/3] doc/tester-config: Enable Runtime Debugging Feature | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS

Commit Message

Tedd Ho-Jeong An Oct. 6, 2021, 8:13 p.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch adds a test case for suspend while discovering state.
---
 tools/mgmt-tester.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
diff mbox series

Patch

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index 84d81c8ca..8fd82487d 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -10722,6 +10722,27 @@  static void test_suspend_resume_success_7(const void *test_data)
 	test_command_generic(test_data);
 }
 
+static const struct generic_data suspend_resume_success_8 = {
+	.setup_settings = settings_powered_le,
+	.send_opcode = MGMT_OP_START_DISCOVERY,
+	.send_param = start_discovery_le_param,
+	.send_len = sizeof(start_discovery_le_param),
+	.expect_status = MGMT_STATUS_SUCCESS,
+	.expect_param = start_discovery_le_param,
+	.expect_len = sizeof(start_discovery_le_param),
+	.expect_hci_command = BT_HCI_CMD_LE_SET_EXT_SCAN_ENABLE,
+	.expect_hci_param = start_discovery_valid_ext_scan_enable,
+	.expect_hci_len = sizeof(start_discovery_valid_ext_scan_enable),
+	.expect_alt_ev = MGMT_EV_CONTROLLER_SUSPEND,
+	.expect_alt_ev_param = suspend_state_param_disconnect,
+	.expect_alt_ev_len = sizeof(suspend_state_param_disconnect),
+};
+
+static void test_suspend_resume_success_8(const void *test_data)
+{
+	test_command_generic(test_data);
+	tester_wait(1, trigger_force_suspend, NULL);
+}
 
 int main(int argc, char *argv[])
 {
@@ -12497,6 +12518,15 @@  int main(int argc, char *argv[])
 				&suspend_resume_success_7,
 				NULL, test_suspend_resume_success_7);
 
+	/* Suspend/Resume
+	 * Setup : Power on
+	 * Run: Start discover and enable suspend
+	 * Expect: Receive the Suspend Event
+	 */
+	test_bredrle50_full("Suspend/Resume - Success 8 (Discovering)",
+				&suspend_resume_success_8,
+				NULL, test_suspend_resume_success_8, 4);
+
 	/* MGMT_OP_READ_EXP_FEATURE
 	 * Read Experimental features - success
 	 */