aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance
diff options
context:
space:
mode:
authorHans Verkuil <hansverk@cisco.com>2018-10-19 14:05:24 +0200
committerHans Verkuil <hansverk@cisco.com>2018-10-19 14:05:24 +0200
commitad47b6e6ef01a9b9d407cd245ea1bf3589df31c7 (patch)
tree51a032b5d35b1d8bec108718412ae2204e7444e3 /utils/cec-compliance
parent53e874d36bc33baf8756999b5c54cbba84ee899a (diff)
cec-compliance: some standby tests should be a warning
Tests were added to check the handling of core messages while the remote device is in standby. After testing with various devices I realized that many of those do not handle this well, causing the compliance test to fail. For now I have turned them into warnings. This might change in the future. I feel that this falls in the category of "it is really a failure, but almost everyone does this", so for the time being a warning is more appropriate. Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Diffstat (limited to 'utils/cec-compliance')
-rw-r--r--utils/cec-compliance/cec-compliance.h29
-rw-r--r--utils/cec-compliance/cec-test.cpp36
2 files changed, 39 insertions, 26 deletions
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index 91439fab..0a890311 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -167,13 +167,14 @@ struct node {
unsigned remote_la_mask;
struct remote remote[16];
__u16 phys_addr;
+ bool in_standby;
};
struct remote_subtest {
const char *name;
const __u16 la_mask;
int (*const test_fn)(struct node *node, unsigned me, unsigned la, bool interactive);
- bool needs_pa;
+ bool in_standby;
};
#define PRESUMED_OK 1
@@ -213,14 +214,15 @@ struct remote_subtest {
} \
} while(0)
-#define warn(fmt, args...) \
- do { \
- warnings++; \
- if (show_warnings) \
- printf("\t\twarn: %s(%d): " fmt, __FILE__, __LINE__, ##args); \
- if (exit_on_warn) \
- exit(1); \
- } while (0)
+#define warn(fmt, args...) \
+({ \
+ warnings++; \
+ if (show_warnings) \
+ printf("\t\twarn: %s(%d): " fmt, __FILE__, __LINE__, ##args); \
+ if (exit_on_warn) \
+ exit(1); \
+ 0; \
+})
#define warn_once(fmt, args...) \
do { \
@@ -245,6 +247,15 @@ struct remote_subtest {
FAIL; \
})
+#define fail_or_warn(node, fmt, args...) \
+({ \
+ if ((node)->in_standby) \
+ warn(fmt, ##args); \
+ else \
+ fail(fmt, ##args); \
+ (node)->in_standby ? 0 : FAIL; \
+})
+
#define fail_on_test(test) \
do { \
if (test) \
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 504c3bd8..743f2d31 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -61,8 +61,8 @@ int system_info_phys_addr(struct node *node, unsigned me, unsigned la, bool inte
cec_msg_init(&msg, me, la);
cec_msg_give_physical_addr(&msg, true);
if (!transmit_timeout(node, &msg) || timed_out_or_abort(&msg)) {
- fail("Could not get the remote physical address\n");
- return FAIL_CRITICAL;
+ fail_or_warn(node, "Give Physical Addr timed out\n");
+ return node->in_standby ? 0 : FAIL_CRITICAL;
}
fail_on_test(node->remote[la].phys_addr != ((msg.msg[2] << 8) | msg.msg[3]));
fail_on_test(node->remote[la].prim_type != msg.msg[4]);
@@ -75,8 +75,8 @@ int system_info_version(struct node *node, unsigned me, unsigned la, bool intera
cec_msg_init(&msg, me, la);
cec_msg_get_cec_version(&msg, true);
- fail_on_test(!transmit_timeout(node, &msg));
- fail_on_test(timed_out(&msg));
+ if (!transmit_timeout(node, &msg) || timed_out(&msg))
+ return fail_or_warn(node, "Could not get the CEC version\n");
if (unrecognized_op(&msg))
return NOTSUPPORTED;
if (refused(&msg))
@@ -97,8 +97,8 @@ int system_info_get_menu_lang(struct node *node, unsigned me, unsigned la, bool
cec_msg_init(&msg, me, la);
cec_msg_get_menu_language(&msg, true);
- fail_on_test(!transmit_timeout(node, &msg));
- fail_on_test(timed_out(&msg));
+ if (!transmit_timeout(node, &msg) || timed_out(&msg))
+ return fail_or_warn(node, "Get Menu Languages timed out\n");
/* Devices other than TVs shall send Feature Abort [Unregcognized Opcode]
in reply to Get Menu Language. */
@@ -140,8 +140,8 @@ int system_info_give_features(struct node *node, unsigned me, unsigned la, bool
cec_msg_init(&msg, me, la);
cec_msg_give_features(&msg, true);
- fail_on_test(!transmit_timeout(node, &msg));
- fail_on_test(timed_out(&msg));
+ if (!transmit_timeout(node, &msg) || timed_out(&msg))
+ return fail_or_warn(node, "Give Features timed out\n");
if (unrecognized_op(&msg)) {
if (node->remote[la].cec_version < CEC_OP_CEC_VERSION_2_0)
return NOTSUPPORTED;
@@ -204,8 +204,8 @@ int core_unknown(struct node *node, unsigned me, unsigned la, bool interactive)
cec_msg_init(&msg, me, la);
msg.len = 2;
msg.msg[1] = unknown_opcode;
- fail_on_test(!transmit_timeout(node, &msg));
- fail_on_test(timed_out(&msg));
+ if (!transmit_timeout(node, &msg) || timed_out(&msg))
+ return fail_or_warn(node, "Unknown Opcode timed out\n");
fail_on_test(!cec_msg_status_is_abort(&msg));
__u8 abort_msg, reason;
@@ -232,8 +232,8 @@ int core_abort(struct node *node, unsigned me, unsigned la, bool interactive)
(with any abort reason) */
cec_msg_init(&msg, me, la);
cec_msg_abort(&msg);
- fail_on_test(!transmit_timeout(node, &msg));
- fail_on_test(timed_out(&msg));
+ if (!transmit_timeout(node, &msg) || timed_out(&msg))
+ return fail_or_warn(node, "Abort timed out\n");
fail_on_test(!cec_msg_status_is_abort(&msg));
return 0;
}
@@ -252,7 +252,8 @@ int vendor_specific_commands_id(struct node *node, unsigned me, unsigned la, boo
cec_msg_init(&msg, me, la);
cec_msg_give_device_vendor_id(&msg, true);
- fail_on_test(!transmit(node, &msg));
+ if (!transmit(node, &msg))
+ return fail_or_warn(node, "Give Device Vendor ID timed out\n");
if (unrecognized_op(&msg))
return NOTSUPPORTED;
if (refused(&msg))
@@ -299,8 +300,8 @@ int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool i
the same for each logical address. */
cec_msg_init(&msg, me, la);
cec_msg_give_osd_name(&msg, true);
- fail_on_test(!transmit(node, &msg));
- fail_on_test(timed_out(&msg));
+ if (!transmit_timeout(node, &msg) || timed_out(&msg))
+ return fail_or_warn(node, "Give OSD Name timed out\n");
fail_on_test(!is_tv(la, node->remote[la].prim_type) && unrecognized_op(&msg));
if (unrecognized_op(&msg))
return NOTSUPPORTED;
@@ -1429,13 +1430,14 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags,
printf("\t%s:\n", tests[i].name);
for (unsigned j = 0; j < tests[i].num_subtests; j++) {
- if (tests[i].subtests[j].needs_pa) {
+ if (tests[i].subtests[j].in_standby) {
struct cec_log_addrs laddrs = { };
doioctl(node, CEC_ADAP_G_LOG_ADDRS, &laddrs);
if (node->phys_addr == CEC_PHYS_ADDR_INVALID)
continue;
}
+ node->in_standby = tests[i].subtests[j].in_standby;
ret = tests[i].subtests[j].test_fn(node, me, la, interactive);
if (!(tests[i].subtests[j].la_mask & (1 << la)) && !ret) {
printf("\t %s: OK (Unexpected)\n",
@@ -1443,7 +1445,7 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags,
}
else if (ret != NOTAPPLICABLE)
printf("\t %s: %s\n", tests[i].subtests[j].name, ok(ret));
- if (ret == FAIL_CRITICAL && !tests[i].subtests[j].needs_pa)
+ if (ret == FAIL_CRITICAL)
return;
}
printf("\n");

Privacy Policy