From 1312b288b4f3227c373c8cf1ffc212ea229e7e70 Mon Sep 17 00:00:00 2001 From: Brian Gix Date: Wed, 14 Jul 2021 15:03:56 -0700 Subject: [PATCH] tool/mgmt-tester: Add fail_tolerant exception 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. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- 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 bd58187..e369d74 100755 --- 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.7.4