From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 6/7] runner: Add a socket comms decoder
Date: Fri, 28 Oct 2022 15:52:08 +0200 [thread overview]
Message-ID: <Y1veiKhF4ScmaC9s@kamilkon-desk1> (raw)
In-Reply-To: <20221010145708.1986912-6-petri.latvala@intel.com>
On 2022-10-10 at 17:57:07 +0300, Petri Latvala wrote:
> When debugging, being able to read what is sent via socket comms is
> very useful.
>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arek@hiler.eu>
Acked-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
> ---
> runner/decoder.c | 131 +++++++++++++++++++++++++++++++++++++++++++++
> runner/meson.build | 8 +++
> 2 files changed, 139 insertions(+)
> create mode 100644 runner/decoder.c
>
> diff --git a/runner/decoder.c b/runner/decoder.c
> new file mode 100644
> index 00000000..850b6ad5
> --- /dev/null
> +++ b/runner/decoder.c
> @@ -0,0 +1,131 @@
> +#include <fcntl.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <sys/stat.h>
> +#include <sys/types.h>
> +
> +#include "runnercomms.h"
> +
> +static bool handle_log(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) LOG\tstream=%d,text=%s",
> + packet->senderpid, packet->sendertid,
> + helper.log.stream, helper.log.text);
> + if (strlen(helper.log.text) == 0 || helper.log.text[strlen(helper.log.text) - 1] != '\n')
> + printf("\n");
> +
> + return true;
> +}
> +
> +static bool handle_exec(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) EXEC\tcmdline=%s\n",
> + packet->senderpid, packet->sendertid,
> + helper.exec.cmdline);
> +
> + return true;
> +}
> +
> +static bool handle_exit(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) EXIT\texitcode=%d,timeused=%s\n",
> + packet->senderpid, packet->sendertid,
> + helper.exit.exitcode, helper.exit.timeused);
> +
> + return true;
> +}
> +
> +static bool handle_subtest_start(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) SUBTEST_START\tname=%s\n",
> + packet->senderpid, packet->sendertid,
> + helper.subteststart.name);
> +
> + return true;
> +}
> +
> +static bool handle_subtest_result(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) SUBTEST_RESULT\tname=%s,result=%s,timeused=%s,reason=%s\n",
> + packet->senderpid, packet->sendertid,
> + helper.subtestresult.name,
> + helper.subtestresult.result,
> + helper.subtestresult.timeused,
> + helper.subtestresult.reason ?: "<null>");
> +
> + return true;
> +}
> +
> +static bool handle_dynamic_subtest_start(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) DYNAMIC_SUBTEST_START\tname=%s\n",
> + packet->senderpid, packet->sendertid,
> + helper.dynamicsubteststart.name);
> +
> + return true;
> +}
> +
> +static bool handle_dynamic_subtest_result(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) DYNAMIC_SUBTEST_RESULT\tname=%s,result=%s,timeused=%s,reason=%s\n",
> + packet->senderpid, packet->sendertid,
> + helper.dynamicsubtestresult.name,
> + helper.dynamicsubtestresult.result,
> + helper.dynamicsubtestresult.timeused,
> + helper.dynamicsubtestresult.reason ?: "<null>");
> +
> + return true;
> +}
> +
> +static bool handle_versionstring(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("(pid=%d tid=%d) VERSIONSTRING\ttext=%s",
> + packet->senderpid, packet->sendertid,
> + helper.versionstring.text);
> + if (strlen(helper.versionstring.text) == 0 || helper.versionstring.text[strlen(helper.versionstring.text) - 1] != '\n')
> + printf("\n");
> +
> + return true;
> +}
> +
> +static bool handle_result_override(const struct runnerpacket *packet, runnerpacket_read_helper helper, void *userdata)
> +{
> + printf("pid=%d tid=%d) RESULT_OVERRIDE\tresult=%s\n",
> + packet->senderpid, packet->sendertid,
> + helper.resultoverride.result);
> +
> + return true;
> +}
> +
> +struct comms_visitor logger = {
> + .log = handle_log,
> + .exec = handle_exec,
> + .exit = handle_exit,
> + .subtest_start = handle_subtest_start,
> + .subtest_result = handle_subtest_result,
> + .dynamic_subtest_start = handle_dynamic_subtest_start,
> + .dynamic_subtest_result = handle_dynamic_subtest_result,
> + .versionstring = handle_versionstring,
> + .result_override = handle_result_override,
> +};
> +
> +int main(int argc, char **argv)
> +{
> + int fd;
> +
> + if (argc < 2) {
> + printf("Usage: %s igt-comms-data-file\n", argv[0]);
> + return 2;
> + }
> +
> + fd = open(argv[1], O_RDONLY);
> + if (fd < 0) {
> + fprintf(stderr, "Failure opening %s: %m\n", argv[1]);
> + return 1;
> + }
> +
> + comms_read_dump(fd, &logger);
> +
> + return 0;
> +}
> diff --git a/runner/meson.build b/runner/meson.build
> index c3927af5..dadfc75f 100644
> --- a/runner/meson.build
> +++ b/runner/meson.build
> @@ -10,6 +10,7 @@ runnerlib_sources = [ 'settings.c',
> runner_sources = [ 'runner.c' ]
> resume_sources = [ 'resume.c' ]
> results_sources = [ 'results.c' ]
> +decoder_sources = [ 'decoder.c' ]
> runner_test_sources = [ 'runner_tests.c' ]
> runner_json_test_sources = [ 'runner_json_tests.c' ]
>
> @@ -56,6 +57,13 @@ if jsonc.found()
> install_rpath : bindir_rpathdir,
> dependencies : igt_deps)
>
> + decoder = executable('igt_comms_decoder', decoder_sources,
> + link_with : runnerlib,
> + install : true,
> + install_dir : bindir,
> + install_rpath : bindir_rpathdir,
> + dependencies : igt_deps)
> +
> runner_test = executable('runner_test', runner_test_sources,
> c_args : '-DTESTDATA_DIRECTORY="@0@"'.format(testdata_dir),
> link_with : runnerlib,
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-10-28 13:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 14:57 [igt-dev] [PATCH i-g-t 1/7] lib/runnercomms: Structured communication from tests to igt_runner Petri Latvala
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 2/7] lib/igt_core: Send logs to runner with comms Petri Latvala
2022-10-28 13:46 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 3/7] runner: Use socket communications Petri Latvala
2022-10-28 13:47 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 4/7] runner/runner_tests: Add tests for " Petri Latvala
2022-10-28 13:49 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 5/7] lib/tests: Add unit tests for socket communication packet creation Petri Latvala
2022-10-28 13:51 ` Kamil Konieczny
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 6/7] runner: Add a socket comms decoder Petri Latvala
2022-10-28 13:52 ` Kamil Konieczny [this message]
2022-10-10 14:57 ` [igt-dev] [PATCH i-g-t 7/7] runner: Disable socket communications for now Petri Latvala
2022-10-28 13:59 ` Kamil Konieczny
2022-10-31 10:16 ` Petri Latvala
2022-10-10 15:56 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/7] lib/runnercomms: Structured communication from tests to igt_runner Patchwork
2022-10-10 21:05 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2022-10-11 6:25 ` Petri Latvala
2022-10-11 16:44 ` Vudum, Lakshminarayana
2022-10-11 6:45 ` Patchwork
2022-10-11 15:56 ` Patchwork
2022-10-11 16:38 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2022-10-28 13:42 ` [igt-dev] [PATCH i-g-t 1/7] " Kamil Konieczny
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=Y1veiKhF4ScmaC9s@kamilkon-desk1 \
--to=kamil.konieczny@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=petri.latvala@intel.com \
/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