linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org, hj.tedd.an@gmail.com,
	brian.gix@intel.com
Subject: [PATCH BlueZ v2 3/3] tool/mgmt-tester: Add fail_tolerant exception
Date: Fri, 16 Jul 2021 12:39:32 -0700	[thread overview]
Message-ID: <20210716193932.2939264-3-brian.gix@intel.com> (raw)
In-Reply-To: <20210716193932.2939264-1-brian.gix@intel.com>

Race conditions with the cmd-sync changes can cause fail status codes to
be different than originally expected. New test parameter fail_tolerant
allows a trivial fail-code mismatches to "Pass" while also warning that
the status wasn't exactly as expected.
---
 tools/mgmt-tester.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c
index bd581874e..e369d7488 100644
--- a/tools/mgmt-tester.c
+++ b/tools/mgmt-tester.c
@@ -302,6 +302,7 @@ struct generic_data {
 	bool expect_sc_key;
 	bool force_power_off;
 	bool addr_type_avail;
+	bool fail_tolerant;
 	uint8_t addr_type;
 	bool set_adv;
 	const uint8_t *adv_data;
@@ -4063,6 +4064,7 @@ static const struct generic_data get_conn_info_power_off_test = {
 	.force_power_off = true,
 	.expect_status = MGMT_STATUS_NOT_POWERED,
 	.expect_func = get_conn_info_expect_param_power_off_func,
+	.fail_tolerant = true,
 };
 
 static const uint8_t load_conn_param_nval_1[16] = { 0x12, 0x11 };
@@ -7038,8 +7040,13 @@ static void command_generic_callback(uint8_t status, uint16_t length,
 			test->send_opcode, mgmt_errstr(status), status);
 
 	if (status != test->expect_status) {
-		tester_test_abort();
-		return;
+		if (!test->fail_tolerant || !!status != !!test->expect_status) {
+			tester_test_abort();
+			return;
+		}
+
+		tester_warn("Unexpected status got %d expected %d",
+						status, test->expect_status);
 	}
 
 	if (!test->expect_ignore_param) {
-- 
2.31.1


  parent reply	other threads:[~2021-07-16 19:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16 19:39 [PATCH BlueZ v2 1/3] emulator/btdev: Add support HCI_READ_CLOCK command Brian Gix
2021-07-16 19:39 ` [PATCH BlueZ v2 2/3] tool/mgmt-tester: Add test cases for Read Clock Information API Brian Gix
2021-07-16 19:39 ` Brian Gix [this message]
2021-07-16 20:37 ` [BlueZ,v2,1/3] emulator/btdev: Add support HCI_READ_CLOCK command 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=20210716193932.2939264-3-brian.gix@intel.com \
    --to=brian.gix@intel.com \
    --cc=hj.tedd.an@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).