aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-08-06 11:29:24 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2018-08-06 11:33:50 +0200
commit90905c2e4b17d7595256f3824e2d30d19b0df1a1 (patch)
treeb9e8e9f46f05045c01135ecb5cd917e5f4da9fcc /utils/cec-compliance
parent70b13df426d30ca58c79cf8a366e73463bb22cbb (diff)
cec-compliance: measure pings per second
As part of the adapter test check how many pings per second you can do towards both a valid and invalid LA and warn if it is less than the expected value. Check this for 5 full consecutive seconds since the remote side might be sending messages as well which can influence this value. Also fix a bug in DQEVENT test in testAdapLogAddrs(): you can get pin events with the CEC_EVENT_FL_INITIAL_STATE flag set, thus causing a fail. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils/cec-compliance')
-rw-r--r--utils/cec-compliance/cec-test-adapter.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/utils/cec-compliance/cec-test-adapter.cpp b/utils/cec-compliance/cec-test-adapter.cpp
index 09ed5426..80263b68 100644
--- a/utils/cec-compliance/cec-test-adapter.cpp
+++ b/utils/cec-compliance/cec-test-adapter.cpp
@@ -222,6 +222,7 @@ int testTransmit(struct node *node)
{
struct cec_msg msg = { };
unsigned i, la = node->log_addr[0];
+ unsigned valid_la = 15, invalid_la = 15;
bool tested_self = false;
bool tested_valid_la = false;
bool tested_invalid_la = false;
@@ -292,6 +293,7 @@ int testTransmit(struct node *node)
if (tested_valid_la)
continue;
tested_valid_la = true;
+ valid_la = i;
// Send message to a remote LA
memset(&msg, 0xff, sizeof(msg));
msg.msg[0] = (la << 4) | i;
@@ -338,6 +340,7 @@ int testTransmit(struct node *node)
if (tested_invalid_la)
continue;
tested_invalid_la = true;
+ invalid_la = i;
// Send message to a remote non-existent LA
memset(&msg, 0xff, sizeof(msg));
msg.msg[0] = (la << 4) | i;
@@ -382,6 +385,54 @@ int testTransmit(struct node *node)
}
}
+ if (tested_valid_la) {
+ time_t cur_t = time(NULL), t;
+ time_t last_t = cur_t + 7;
+ unsigned max_cnt = 0;
+ unsigned cnt = 0;
+
+ do {
+ t = time(NULL);
+ if (t != cur_t) {
+ if (cnt > max_cnt)
+ max_cnt = cnt;
+ cnt = 0;
+ cur_t = t;
+ }
+ cec_msg_init(&msg, la, valid_la);
+ fail_on_test(doioctl(node, CEC_TRANSMIT, &msg));
+ cnt++;
+ } while (t < last_t);
+ // A ping can take 10 * 2.4 + 4.5 + 7 * 2.4 = 45.3 ms (SFT)
+ if (max_cnt < 21)
+ warn("Could only do %u pings per second to a valid LA, expected at least 21\n",
+ max_cnt);
+ }
+
+ if (tested_invalid_la) {
+ time_t cur_t = time(NULL), t;
+ time_t last_t = cur_t + 7;
+ unsigned max_cnt = 0;
+ unsigned cnt = 0;
+
+ do {
+ t = time(NULL);
+ if (t != cur_t) {
+ if (cnt > max_cnt)
+ max_cnt = cnt;
+ cnt = 0;
+ cur_t = t;
+ }
+ cec_msg_init(&msg, la, invalid_la);
+ fail_on_test(doioctl(node, CEC_TRANSMIT, &msg));
+ cnt++;
+ } while (t < last_t);
+ // A ping to an invalid LA can take 2 * (10 * 2.4 + 4.5) + (3 + 7) * 2.4 = 81 ms (SFT)
+ if (max_cnt < 12)
+ warn("Could only do %u pings per second to an invalid LA, expected at least 12\n",
+ max_cnt);
+ }
+
return 0;
}

Privacy Policy