This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: cec-compliance: add --show-timestamp option Author: Hans Verkuil <hverkuil-ci...@xs4all.nl> Date: Fri Mar 1 11:26:24 2024 +0100 Add a new option to prefix the test name with a timestamp. This helps associating the test commands with the timestamps you see when monitoring the CEC traffic. Without this it is hard to discover when each test starts and ends and which CEC messages are actually from each specific test. Hopefully this will help with that. Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl> utils/cec-compliance/cec-compliance.1.in | 5 ++++- utils/cec-compliance/cec-compliance.cpp | 17 +++++++++++++++-- utils/cec-compliance/cec-compliance.h | 3 ++- utils/cec-compliance/cec-test.cpp | 25 +++++++++++++++++-------- 4 files changed, 38 insertions(+), 12 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=9552cb779371bf984ca0e25dc8b08772769c0819 diff --git a/utils/cec-compliance/cec-compliance.1.in b/utils/cec-compliance/cec-compliance.1.in index fadeebb638d4..f212d88f43bd 100644 --- a/utils/cec-compliance/cec-compliance.1.in +++ b/utils/cec-compliance/cec-compliance.1.in @@ -123,7 +123,10 @@ Turn on verbose reporting. Show version information. .TP \fB\-w\fR, \fB\-\-wall\-clock\fR -Show timestamps as wall-clock time. This also turns on verbose reporting. +Show timestamps as wall-clock time. +.TP +\fB\-S\fR, \fB\-\-show\-timestamp\fR +For each test, show the timestamp of when the test started. .TP \fB\-T\fR, \fB\-\-trace\fR Trace all called ioctls. Useful for debugging. diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp index ce8fde3d96a3..8075e1d6ff5a 100644 --- a/utils/cec-compliance/cec-compliance.cpp +++ b/utils/cec-compliance/cec-compliance.cpp @@ -38,6 +38,7 @@ enum Option { OptRemote = 'r', OptReplyThreshold = 'R', OptSkipInfo = 's', + OptShowTimestamp = 'S', OptTimeout = 't', OptTrace = 'T', OptVerbose = 'v', @@ -122,6 +123,7 @@ static struct option long_options[] = { {"color", required_argument, nullptr, OptColor}, {"skip-info", no_argument, nullptr, OptSkipInfo}, {"wall-clock", no_argument, nullptr, OptWallClock}, + {"show-timestamp", no_argument, nullptr, OptShowTimestamp}, {"interactive", no_argument, nullptr, OptInteractive}, {"reply-threshold", required_argument, nullptr, OptReplyThreshold}, @@ -229,7 +231,8 @@ static void usage() " -T, --trace Trace all called ioctls\n" " -v, --verbose Turn on verbose reporting\n" " --version Show version information\n" - " -w, --wall-clock Show timestamps as wall-clock time (implies -v)\n" + " -w, --wall-clock Show timestamps as wall-clock time\n" + " -S, --show-timestamp Show timestamp of the start of each test\n" " -W, --exit-on-warn Exit on the first warning.\n" ); } @@ -280,6 +283,14 @@ static std::string ts2s(__u64 ts) return s + "." + buf; } +std::string current_ts() +{ + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + return ts2s(ts.tv_sec * 1000000000ULL + ts.tv_nsec); +} + const char *power_status2s(__u8 power_status) { switch (power_status) { @@ -1004,6 +1015,7 @@ int main(int argc, char **argv) test_remote = true; break; case OptWallClock: + break; case OptVerbose: show_info = true; break; @@ -1274,7 +1286,8 @@ int main(int argc, char **argv) for (unsigned to = 0; to <= 15; to++) if (!(node.adap_la_mask & (1 << to)) && (remote_la_mask & (1 << to))) - testRemote(&node, from, to, test_tags, options[OptInteractive]); + testRemote(&node, from, to, test_tags, + options[OptInteractive], options[OptShowTimestamp]); } } diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h index 5a693f7ae73b..aae72842e5fd 100644 --- a/utils/cec-compliance/cec-compliance.h +++ b/utils/cec-compliance/cec-compliance.h @@ -426,6 +426,7 @@ int util_receive(struct node *node, unsigned la, unsigned timeout, struct cec_msg *msg, __u8 sent_msg, __u8 reply1, __u8 reply2 = 0); std::string safename(const char *name); +std::string current_ts(); // CEC adapter tests void testAdapter(struct node &node, struct cec_log_addrs &laddrs, @@ -454,7 +455,7 @@ void collectTests(void); void listTests(void); int setExpectedResult(char *optarg, bool no_warnings); void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags, - bool interactive); + bool interactive, bool show_ts); // cec-test-tuner-record-timer.cpp extern const vec_remote_subtests tuner_ctl_subtests; diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp index ba63232f1c52..d61dd4635edc 100644 --- a/utils/cec-compliance/cec-test.cpp +++ b/utils/cec-compliance/cec-test.cpp @@ -1150,7 +1150,7 @@ int setExpectedResult(char *optarg, bool no_warnings) } void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags, - bool interactive) + bool interactive, bool show_ts) { printf("testing CEC local LA %d (%s) to remote LA %d (%s):\n", me, cec_la2s(me), la, cec_la2s(la)); @@ -1197,6 +1197,7 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags, if (!laddrs.log_addr_mask) continue; } + std::string start_ts = current_ts(); node->in_standby = subtest.in_standby; mode_set_initiator(node); unsigned old_warnings = warnings; @@ -1206,20 +1207,28 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags, ret = OK_UNEXPECTED; if (mapTests[safename(name)] != DONT_CARE) { + if (show_ts) + printf("\t %s: %s: ", start_ts.c_str(), name); + else + printf("\t %s: ", name); if (ret != mapTests[safename(name)]) - printf("\t %s: %s (Expected '%s', got '%s')\n", - name, ok(FAIL), + printf("%s (Expected '%s', got '%s')\n", + ok(FAIL), result_name(mapTests[safename(name)], false), result_name(ret, false)); else if (has_warnings && mapTestsNoWarnings[safename(name)]) - printf("\t %s: %s (Expected no warnings, but got %d)\n", - name, ok(FAIL), warnings - old_warnings); + printf("%s (Expected no warnings, but got %d)\n", + ok(FAIL), warnings - old_warnings); else if (ret == FAIL) - printf("\t %s: %s\n", name, ok(OK_EXPECTED_FAIL)); + printf("%s\n", ok(OK_EXPECTED_FAIL)); + else + printf("%s\n", ok(ret)); + } else if (ret != NOTAPPLICABLE) { + if (show_ts) + printf("\t %s: %s: %s\n", start_ts.c_str(), name, ok(ret)); else printf("\t %s: %s\n", name, ok(ret)); - } else if (ret != NOTAPPLICABLE) - printf("\t %s: %s\n", name, ok(ret)); + } if (ret == FAIL_CRITICAL) return; }